[SciPy-user] index arrangement standard

Robert Kern robert.kern at gmail.com
Mon May 21 15:08:47 EDT 2007


Trevis Crane wrote:
> Hi all,
> 
> As I understand it, an m x n array has m rows, and n columns.  So that
> 
> ones([2,3])
> 
> results in an array of ones that has two rows and three columns.
> 
> Why, when we want to add a third dimension, does that index go first? 
> That is,
> 
> ones([2,3,4])
> 
> doesn’t give me 2 rows, 3 columns and 4 pages (what is the right word
> for this?).  Instead, I get 2 pages with 3 rows and 4 columns each.  For
> me this seems counterintuitive, but obviously it was designed like this
> for a reason – what’s that reason?

You always have to add new dimensions "at the beginning" so to speak. a[i] is
always equivalent to a[i,...].

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco



More information about the SciPy-User mailing list