[Numpy-discussion] Matlab/Numpy index order

David Warde-Farley dwf at cs.toronto.edu
Tue May 12 16:14:48 EDT 2009


On 12-May-09, at 3:55 PM, Ryan May wrote:
>
> It's going to be faster to do it without the transpose.  Besides,  
> for numpy,
> that imshow becomes:
>
>    imshow(b[0])
>
> Which, IMHO, looks better than Matlab.

You're right, that is better, odd how I never thought of doing it like  
that. I've been stuck in my Matlab-esque world with dstack() as my  
default mental model of how images/matrices ought to be stacked.

Am I right in thinking that b[0] is stored in a big contiguous block  
of memory, thus making the read marginally faster than slicing on the  
third?

David



More information about the NumPy-Discussion mailing list