[SciPy-dev] empty_like/zeros_like don't preserve Fortran-ness
Christopher Stawarz
chris at pseudogreen.org
Mon Dec 19 16:08:03 EST 2005
Hi,
Just a small bug to report: When given a Fortran-contiguous array as
input, the empty_like and zeros_like functions return a C-contiguous
array:
>>> a = array([[1,2,3],[4,5,6]], fortran=True)
>>> isfortran(a)
True
>>> b = empty_like(a)
>>> isfortran(b)
False
>>> c = zeros_like(a)
>>> isfortran(c)
False
I tested this on scipy_core 0.8.4, but I see the same problem in the
code in SVN. The problem is that both functions first call asanyarray
with default arguments, which includes fortran=False. I'm not sure
what the right way to fix this is, but it does seem like asarray and
asanyarray should preserve the memory layout of existing arrays.
Thanks,
Chris
More information about the SciPy-Dev
mailing list