Array of objects in numpy.

Pepijn Kenter pepijn.kenter at nospam.dlr.nl
Fri Aug 20 04:36:17 EDT 2004


Hi all.

I'm new to python and want to use it for an assignment.

I have succesfully implemented a galois field class including the _repr__,
__mul__, __div__, __add__ and __sub__ methods. Basically a galois field is
an integer modulo a prime number. Now I want to make a matrix of these
galois field objects using the numpy library. Constructing, printing and
multiplying arrays of GF's works fine. However there are several functions
that give problems, most importantly: dot, repeat. 

I'm affraid I've forgotten my memmory stick with the code and error
messages :-(, so I have to keep my question general. If I recall correctly,
the repeat function complained that my GF object didn't have the
__getelem__ method implemented (IMO this should not be necessary), the dot
function complained about an unsupported type. I know this is not the
preffered way of asking for help on usenet but I'd like some feedback so I
can work this weekend on the problem. I can use the dot & repeat with
normal numpy arrays of floats, so I'm sure it is not due to my inexperience
with python.

Does anybody have experience using object arrays in numpy? Should I be able
to get the dot & repeat function working, and what methods should my GF
object support? Or are there known problems and pitfalls?

Any help would be appreciated.

Regards, Pepijn Kenter.




More information about the Python-list mailing list