[Numpy-discussion] New arrays in 1.6 not always C-contiguous

Sturla Molden sturla at molden.no
Fri Jul 8 12:50:39 EDT 2011


Den 07.07.2011 14:10, skrev Jens Jørgen Mortensen:
> So, this means I can't count on new arrays being C-contiguous any more.
> I guess there is a good reason for this.

Work with linear algebra (LAPACK) caused excessive and redundant array 
transpositions. Arrays would be transposed from C to Fortran order 
before they were passed to LAPACK, and returned arrays were transposed 
from Fortran to C order when used in Python. Signal and image processing 
in SciPy (FFTPACK) suffered from the same issue, as did certain 
optimization (MINPACK). Computer graphics with OpenGL was similarly 
impaired. The OpenGL library has a C frontent, but requires that all 
buffers and matrices are stored in Fortran order.

The old behaviour of NumPy was very annoying. Now we can rely on NumPy 
to always use the most efficient memory layout, unless we request one in 
particular.

Yeah, and it also made NumPy look bad compared to Matlab, which always 
uses Fortran order for this reason ;-)

Sturla



More information about the NumPy-Discussion mailing list