[Numpy-discussion] memory layout, K vs C order (was: Numpy 1.6 schedule)

Mark Wiebe mwwiebe at gmail.com
Fri Mar 11 15:22:48 EST 2011


On Fri, Mar 11, 2011 at 1:13 AM, Ralf Gommers
<ralf.gommers at googlemail.com>wrote:

> On Tue, Mar 8, 2011 at 1:35 AM, Pauli Virtanen <pav at iki.fi> wrote:
> >
> > Ufuncs don't necessarily return arrays in C-order, but instead
> > try to keep the memory layout of the original if it seems
> > advantageous vs. memory access.
> >
> > Before:
> >
> >>>> np.sin(np.zeros((5,5,5)).transpose(1,2,0)).strides
> > (200, 40, 8)
> >
> > After:
> >
> >>>> np.sin(np.zeros((5,5,5)).transpose(1,2,0)).strides
> > (40, 8, 200)
> >
> > This gets +1 from me; the drawbacks to this are mostly in code that
> > makes too much assumptions and makes no checks.
>
> My conclusion of this discussion was that it can be left as-is. If an
> issue turns up during testing of the 1.6.0 beta it can still be
> changed. Correct?
>

Yes, this is very easy to revert if necessary. When using the ufuncs
directly, the old behavior is still accessible as np.add(a, b, order='C').

-Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110311/54df53be/attachment.html>


More information about the NumPy-Discussion mailing list