[Numpy-discussion] insanely slow writing to memory mapped array
Charles R Harris
charlesr.harris at gmail.com
Wed Nov 29 21:18:15 CST 2006
On 11/29/06, Mathew Yeates <myeates at jpl.nasa.gov> wrote:
>
> whoa. I just found out that A=A.transpose() does nothing but change A's
> flags from C_CONTIGUOUS to F_CONTIGUOUS!!
>
> Okay, so heres the question ...... I am reading data into the columns of
> a matrix. In order to speed this up, I want to read values into the rows
> of a matrix and when I am all done, do a transpose. Whats the best way?
If you want a contiguous copy
In [13]: a
Out[13]:
array([[0, 1, 2, 3, 4],
[5, 6, 7, 8, 9]])
In [14]: b=a.transpose().copy()
In [15]: a.flags
Out[15]:
C_CONTIGUOUS : True
F_CONTIGUOUS : False
OWNDATA : False
WRITEABLE : True
ALIGNED : True
UPDATEIFCOPY : False
In [16]: b.flags
Out[16]:
C_CONTIGUOUS : True
F_CONTIGUOUS : False
OWNDATA : True
WRITEABLE : True
ALIGNED : True
UPDATEIFCOPY : False
The result isn't memory mapped, however. What exactly are you trying to do?
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20061129/11aca928/attachment-0001.html
More information about the Numpy-discussion
mailing list