[Numpy-discussion] Superfluous array transpose (cf. ticket #1054)
Mon Mar 16 09:05:31 CDT 2009
On 3/16/2009 9:27 AM, Pearu Peterson wrote:
> If a operation produces new array then the new array should have the
> storage properties of the lhs operand.
That would not be enough, as 1+a would behave differently from a+1. The
former would change storage order and the latter would not.
Broadcasting arrays adds futher to the complexity of the problem.
It seems necessary to something like this to avoid the trap when using f2py:
shape = x.shape[::-1]
_x = x.reshape(shape, order='F')
_y = _f2py_wrapper(_x)
shape = _y.shape[::-1]
return y.reshape(shape, order='C')
And then preferably never use Fortran ordered arrays directly.
More information about the Numpy-discussion