[Numpy-discussion] Contiguous flags not quite right yet.

Charles R Harris charlesr.harris@gmail....
Thu Mar 22 15:25:11 CDT 2007


Example.

In [18]:a = array([1,2,3])

In [19]:a.flags
Out[19]:
  C_CONTIGUOUS : True
  F_CONTIGUOUS : True
  OWNDATA : True
  WRITEABLE : True
  ALIGNED : True
  UPDATEIFCOPY : False

In [20]:a.shape = (1,3)

In [21]:a.flags
Out[21]:
  C_CONTIGUOUS : True
  F_CONTIGUOUS : False
  OWNDATA : True
  WRITEABLE : True
  ALIGNED : True
  UPDATEIFCOPY : False

In [22]:a.shape = (3,1)

In [23]:a.flags
Out[23]:
  C_CONTIGUOUS : True
  F_CONTIGUOUS : False
  OWNDATA : True
  WRITEABLE : True
  ALIGNED : True
  UPDATEIFCOPY : False

All three shapes are both C_CONTIGUOUS and F_CONTIGUOUS. I think ignoring
all 1's in the shape would give the right results  for otherwise contiguous
arrays because in those positions the index can only take the value 0.


Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20070322/aca71cec/attachment.html 


More information about the Numpy-discussion mailing list