[Numpy-discussion] concatenate and non-contiguous arrays?
Christopher Barker
Chris.Barker@noaa....
Fri Aug 7 18:31:59 CDT 2009
Hi all,
I just noticed that np.concatenate does not necessarily produce
contiguous arrays.
I has figured that it was making a copy, so would produce a C-contiguous
array, but not so:
In [88]: a = np.arange(60).reshape((4,5,3))
In [89]: b = np.concatenate((a, a[:, -1:, :]), axis=1)
In [90]: b.flags
Out[90]:
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.
Explanation?
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
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
Chris.Barker@noaa.gov
More information about the NumPy-Discussion
mailing list