[Numpy-discussion] newaxis and contiguity
Charles R Harris
Fri Oct 31 11:16:27 CDT 2008
On Fri, Oct 31, 2008 at 12:51 AM, David Cournapeau <
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion