On Sun, March 15, 2009 8:57 pm, Sturla Molden wrote:
>
> Regarding ticket #1054. What is the reason for this strange behaviour?
>
>>>> a = np.zeros((10,10),order='F')
>>>> a.flags
>   C_CONTIGUOUS : False
>   F_CONTIGUOUS : True
>   OWNDATA : True
>   WRITEABLE : True
>   ALIGNED : True
>   UPDATEIFCOPY : False
>>>> (a+1).flags
>   C_CONTIGUOUS : True
>   F_CONTIGUOUS : False
>   OWNDATA : True
>   WRITEABLE : True
>   ALIGNED : True
>   UPDATEIFCOPY : False

I wonder if this behavior could be considered as a bug
because it does not seem to have any advantages but
only hides the storage order change and that may introduce
inefficiencies.

If a operation produces new array then the new array should have the
storage properties of the lhs operand.
That would allow writing code

  a = zeros(<shape>, order='F')
  b = a + 1

instead of

  a = zeros(<shape>, order='F')
  b = a[:]
  b += 1

to keep the storage properties in operations.

Regards,
Pearu



_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to