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 ? thanks, David
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
participants (2)
-
Charles R Harris
-
David Cournapeau