Matthew Brett wrote:
> Hi,
>
> I am sorry if this is obvious, but:
>   

It's O.K. I don't think many people are used to the fortran-order 
stuff.  So, I doubt it's obvious.
> For example, here is 0,1,2,3 as int32
>
> str = '\x00\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00'
>
> What is the best way of me putting this into a 2x2 array object so
> that the array recognizes the data is in fortran order.  Sort of:
>   
> a = somefunction(str, shape=(2,2), dtype=int32, order='F')
>   
There isn't really a function like this because the fromstring function 
only creates 1-d arrays that must be reshaped later (it also copies the 
data from the string).

However, you can use the ndarray creation function itself to do what you 
want:

a = ndarray(shape=(2,2), dtype=int32, buffer=str, order='F')

This will use the memory of the string as the new array memory.


-Travis


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion

Reply via email to