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

Mark Wiebe mwwiebe at gmail.com
Tue Jul 12 12:48:16 EDT 2011


2011/7/12 Frédéric Bastien <nouiz at nouiz.org>

> Hi,
>
> We depend highly on numpy, but don't have the time to follow all the
> mailing lists regularly of all our tools. Having some information on
> the release note about this would have been useful to many people I
> think.
>

You're absolutely right, not including information on this was an oversight
on our part. I apologize for that.

Also, did this affect the C-API? Do the default value of newlly
> created ndarray in C changed?
>

This only added to the C-API, pre-existing API remained the same for API/ABI
compatibility reasons. C code already had to deal with the possibility of
differing memory layouts, for example if someone passes in carr.T, something
in Fortran order.

This change primarily affected the output layout of ufuncs, newly created
ndarrays continue to be default 'C' order.


>
> Thanks for the great work.
>

Thanks,
Mark


>
> Frédéric Bastien
>
> On Fri, Jul 8, 2011 at 12:50 PM, Sturla Molden <sturla at molden.no> wrote:
> > 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
> > _______________________________________________
> > NumPy-Discussion mailing list
> > NumPy-Discussion at scipy.org
> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
> >
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110712/fd26c193/attachment.html>


More information about the NumPy-Discussion mailing list