I'm not sure why the data ends up F_CONTIGUOUS, but it appears that you can
get things to end up as C_CONTIGUOUS by transposing before the indexing and
then transposing back. I don't think that this results in extra copies, but
I'm not certain of that.
a = np.arange(6).reshape(3,2)
a
array([[0, 1],
[2, 3],
[4, 5]])
b1 = a[:,[1,0]]
a.flags
C_CONTIGUOUS : True
F_CONTIGUOUS : False
OWNDATA : False
WRITEABLE : True
ALIGNED : True
UPDATEIFCOPY : False
b1.flags
C_CONTIGUOUS : False
F_CONTIGUOUS : True
OWNDATA : False
WRITEABLE : True
ALIGNED : True
UPDATEIFCOPY : False
b2 = a.transpose()[[(1,0)]].transpose()
b2.flags
C_CONTIGUOUS : True
F_CONTIGUOUS : False
OWNDATA : False
WRITEABLE : True
ALIGNED : True
UPDATEIFCOPY : False
b1 == b2
array([[True, True],
[True, True],
[True, True]], dtype=bool)
--
//=][=\\
[EMAIL PROTECTED]
_______________________________________________
Numpy-discussion mailing list
[email protected]
http://projects.scipy.org/mailman/listinfo/numpy-discussion