[Numpy-discussion] newaxis and contiguity

Charles R Harris charlesr.harris at gmail.com
Fri Oct 31 12:16:27 EDT 2008


On Fri, Oct 31, 2008 at 12:51 AM, David Cournapeau <
david at 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://mail.python.org/pipermail/numpy-discussion/attachments/20081031/c89c8e81/attachment.html>


More information about the NumPy-Discussion mailing list