[Numpy-discussion] indexing question

Alan G Isaac aisaac@american....
Sun Dec 20 19:58:05 CST 2009


Why is s3 F_CONTIGUOUS, and perhaps equivalently,
why is its C_CONTIGUOUS data in s3.base (below)?
Thanks,
Alan Isaac

>>> a3
array([[ 0,  1,  2,  3,  4,  5],
        [ 6,  7,  8,  9, 10, 11]])
>>> a3.flags
   C_CONTIGUOUS : True
   F_CONTIGUOUS : False
   OWNDATA : True
   WRITEABLE : True
   ALIGNED : True
   UPDATEIFCOPY : False
>>> ind
array([3, 1, 2, 4, 5, 0])
>>> s3 = a3[:,ind]
>>> s3.flags
   C_CONTIGUOUS : False
   F_CONTIGUOUS : True
   OWNDATA : False
   WRITEABLE : True
   ALIGNED : True
   UPDATEIFCOPY : False
>>> s3.base
array([[ 3,  9],
        [ 1,  7],
        [ 2,  8],
        [ 4, 10],
        [ 5, 11],
        [ 0,  6]])
>>> s3
array([[ 3,  1,  2,  4,  5,  0],
        [ 9,  7,  8, 10, 11,  6]])
>>>


More information about the NumPy-Discussion mailing list