[SciPy-user] F2Py works great, thanks Pearu! + numarray question

Todd Miller jmiller at stsci.edu
Wed Sep 11 15:54:23 EDT 2002


Pearu Peterson wrote:

>Namely, according to the essay in
>
>  http://www.pfdubois.com/numpy/
>
>the properties of numarray arrays are immutable. In order to
>manage the difference in Fortran and C data ordering, f2py temporarily
>resets the strides of an array when preparing arrays to be passed over to
>Fortran. Now with the immutability of array properties, f2py cannot use
>this established approach anymore (though, I don't see how one can force
>immutability in the C context...).
>
I haven't looked at f2py,  but the interface files for it in SciPy look 
really nice.   I think what the essay was trying to say is that 
extension functions which use the numpy compatability interface cannot 
mutate array properties and have the mutations reflected back into 
python.  With that restriction, it should still be possible to 
temporarily modify the strides, and then restore them when you're done. 
 What you can't do at the moment, is write a function like "reshape" in 
C, because all of the shape and stride permutations are thrown away on 
exit from the extension function.  This may change in the future.

The numarray C-API may soon change fairly dramatically as we adopt C 
basetypes to improve performance.  Much of the API as it stands now was 
written to support operation on pre-2.2 Pythons with much of numarray 
still written in Python.  I would wait until the next numarray major 
release before bothering to look at the C-API.

Todd

>
>
>Pearu
>
>
>_______________________________________________
>SciPy-user mailing list
>SciPy-user at scipy.net
>http://www.scipy.net/mailman/listinfo/scipy-user
>


-- 
Todd Miller 			jmiller at stsci.edu
STSCI / SSG






More information about the SciPy-User mailing list