Re: [Numpy-discussion] Creating and reshaping fortran order arrays

2006-08-14 Thread Travis Oliphant
Fernando Perez wrote: > Sweet! We now finally have mutable strings for Python: > > In [2]: astr = > '\x00\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00' > > In [4]: a = N.ndarray(shape=(2,2), dtype=N.int32, buffer=astr, order='F') > > In [5]: astr > Out[5]: '\x00\x00\x00\x00\x01\x00\

Re: [Numpy-discussion] Creating and reshaping fortran order arrays

2006-08-14 Thread Fernando Perez
On 8/14/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > Travis Oliphant wrote: > > 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

Re: [Numpy-discussion] Creating and reshaping fortran order arrays

2006-08-14 Thread Travis Oliphant
Travis Oliphant wrote: > 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. > Incidentally, the new array will be read-only. But, y

Re: [Numpy-discussion] Creating and reshaping fortran order arrays

2006-08-14 Thread Travis Oliphant
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