Re: [Numpy-discussion] no typo: mixing NUMERIC and NUMARRAY
( PyQwt is a wrapper for Qwt, a Qt-based library with widgets useful for science and engineering -- http://gerard.vermeulen.free.fr )
I discovered by accident that PyQwt compiled with #include
plots Numeric-arrays and that PyQwt compiled with #include plots numarray-arrays. This part sounds a little backward. Presumably this was a typo.
No Todd, this is no typo. I launched a test program from the wrong directory and was shocked to see that it worked (have checked with python -vv which modules were loaded). The other way around worked, too. Of course, the normal cases work, too. (verified that multiplying a Numeric array with numarray does not work)
The only interface between PyQwt and Numeric (or numarray) passes through PyArray_ContiguousFromObject to cast sequences into arrays from which data is copied into Qwt's data structures.
PyQwt never returns Numeric- or numarray-arrays.
Is this feature platform dependent?
Yes, if I understand your question correctly.
Or is it safe to release PyQwt, claiming that a Numeric-compiled PyQwt is compatible with numarray and vice-versa?
No dice. numarray is currently trying for source level compatibility only, so an extension compiled for Numeric creates slightly different object code than one compiled for numarray; slightly different means inoperable. Still, it's good to know that PyQwt is very close to workable for numarray.
Well, my experience shows that on x86-Linux the layout of the data in a numarray-array and Numeric-array is sufficiently close that both PyArray_ContiguousFromObject() functions also interprete the arrays of the 'cousin' correctly (at least in 1D). I realize that this observation is very hackish, but it may help to speed up the acceptance of numarray. Gerard ------------------------------------------------------------- This message was sent using HTTPS service from CNRS Grenoble. ---> https://grenoble.cnrs.fr <---
participants (1)
-
gvermeul@grenoble.cnrs.fr