On 2009-09-08 22:03 PM, sturlamolden wrote:
On 9 Sep, 03:45, hi_roger<rechardc...@gmail.com>  wrote:

i know how to select a submatrix using the slice object in numpy. But
how can i select a submatrix
A[i1,i2,i3;j1,j2,j3] (elements in A on line i1,i2,i3 and column
j1,j2,j3 ,  and i1,i2,i3,j1,j2,j3 are all arbitrary numbers )

You just pass an array of ints for each dimension. If you want a 3x3
submatrix, you must pass in two 3x3 arrays of indices.

Oops! I just responded to the OP saying that you were "almost correct"; but I was just thinking of your latter 1D example rather than this correct statement. My apologies.

--
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

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to