Numarray, numeric, NumPy, scpy_core ??!!

J jstier at cs.uvic.ca
Sat Jan 21 14:06:50 EST 2006


Ok, I will look at NumPy ...

I have another question about performance. Are the array operations
such as matrix multiplication implemented in
python or in C ? I was under the impression that the function calls in
numarray are only wrappers to C code, but now I suspect that matrix
multiplicaiton is implemented in python and executed in the
interpreter. Is that true ?

Can someone also please point me to examples of how I could make my own
array classes. Basically all I need is vectors and 3x3 matrices. I
already have all of the multiplication code in my C++ classes and only
need wrappers. But how can I create an array class and intercept
operators calls like * + -. This is not neccessarily a solution that I
want to follow, but it may be what
I have to do for now.

BTW, here is also the problem I have with a numarray. I have created a
vector like so...

mPyObject = PyArray_FromDimsAndData(GeoVec4f::sD,GeoVec4f::sDim,
PyArray_FLOAT,(char*)mValue.mValues);
Py_INCREF(mPyObject);

The PyObject is then used as a member called "gradient" in another
embedded class. When I execute the following
script

x.gradient*3

my app just crashes. But when I execute

print (x.gradient)
x.gradient*3

everything works fine... I assum there must be some kind of reference
count problem...


Cheers
Jochen




More information about the Python-list mailing list