[SciPy-dev] Problem with ravel for non-contiguous 1-d arrays
Prabhu Ramachandran
prabhu_r at users.sf.net
Sun Nov 20 12:35:25 CST 2005
Hi,
Here is a simple example that works with numeric/numarray but fails
with scipy.
>>> import scipy
>>> data = scipy.array([[0,0,0,10], [1,0,0,20], [0,1,0,20], [0,0,1,30]], 'f')
>>> p = data[:,:3]
>>> z = scipy.ravel(p)
>>> z.flags.contiguous
True
# So far so good...
>>> t = data[:,-1]
>>> t.flags.contiguous
False
>>> z = scipy.ravel(t)
>>> z.flags.contiguous
False
As you can see, the 1D array when ravelled does is still
non-contiguous. However, scipy.flatten does the job correctly but
always makes a copy (which is something I don't want).
Numeric/numarray work correctly.
cheers,
prabhu
More information about the Scipy-dev
mailing list