[Numpy-discussion] concatenate and non-contiguous arrays?
Fri Aug 7 18:31:59 CDT 2009
I just noticed that np.concatenate does not necessarily produce
I has figured that it was making a copy, so would produce a C-contiguous
array, but not so:
In : a = np.arange(60).reshape((4,5,3))
In : b = np.concatenate((a, a[:, -1:, :]), axis=1)
In : b.flags
C_CONTIGUOUS : False
F_CONTIGUOUS : False
OWNDATA : False
WRITEABLE : True
ALIGNED : True
UPDATEIFCOPY : False
I'm also not sure why OWNDATA is false is it sharing data with
somethign else? It doesn't look like it is with a.
I'll toss a ascontiguous() in my code to take care of this, but I'd like
to understand it.
Christopher Barker, Ph.D.
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
More information about the NumPy-Discussion