[Numpy-discussion] newaxis and contiguity

Charles R Harris charlesr.harris@gmail....
Fri Oct 31 11:16:27 CDT 2008


On Fri, Oct 31, 2008 at 12:51 AM, David Cournapeau <
david@ar.media.kyoto-u.ac.jp> wrote:

> Hi,
>
>    I was wondering about the following behavior:
>
> a = np.random.randn(10)
> b = a[:. np.newaxis]
> print b.flags # F_CONTIGUOUS and C_CONTIGUOUS are both false
>
> Is it for simplicity purpose, or is there a more fundamental reason why
> a rank 2, 'column' vector can't be F_CONTIGUOUS in this case ? Does the
> operation involving newaxis modifies the data buffer ?
>

There are other cases like this. The problem seems to be detecting the
contiguous cases with the result that the flags don't always reflect
reality, i.e., they are on the pessimistic side. This is an area where
improvements could be made.

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


More information about the Numpy-discussion mailing list