[Numpy-discussion] Matlab/Numpy index order
Tue May 12 15:02:00 CDT 2009
In : c = b.reshape((256,256,150), order='F')
Ok, I needed more coffee.
If I do it this way (without the transpose), it should be as fast as
c=b.reshape((150,256,256)), right? It is just changing the stride (or
something like that)? Or is it going to be faster without changing the
Thanks for the help.
Ryan May-3 wrote:
> On Tue, May 12, 2009 at 2:51 PM, brechmos <email@example.com> wrote:
>> So, in Numpy I have to reshape it so the "slices" are in the first
>> dimension. Obviously, I can do a b.transpose( (1,2,0) ) to get it to
>> like Matlab, but...
>> I don't understand why the index ordering is different between Matlab and
>> Numpy. (It isn't a C/Fortran ordering thing, I don' think).
> Actually, that's precisely the reason.
>> Is the data access faster if I have b without the tranpose, or can I
>> transpose it so it "looks" like Matlab without taking a hit when I do
>> imshow( b[:,:,0] ).
> It's going to be faster to do it without the transpose. Besides, for
> that imshow becomes:
> Which, IMHO, looks better than Matlab.
> Ryan May
> Graduate Research Assistant
> School of Meteorology
> University of Oklahoma
> Numpy-discussion mailing list
View this message in context: http://www.nabble.com/Matlab-Numpy-index-order-tp23509178p23509345.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.
More information about the Numpy-discussion