Re: SUB-MATRIX extraction

2009-12-08 Thread Martin P. Hellwig
Jon Clements wrote: On Dec 8, 1:36 pm, Pierre wrote: Hello, let b = array([ [0,1,2] , [3,4,5] , [6,7,8] ]) How can I easily extract the submatrix [ [0 ,1], [3, 4]] ? One possiblity is : b[[0,1],:][:,[0,1]] but it is not really easy ! Thanks. x = numpy.array([ [0,1,2], [3,4,5], [6,7,8] ])

Re: SUB-MATRIX extraction

2009-12-08 Thread Jon Clements
On Dec 8, 1:36 pm, Pierre wrote: > Hello, > > let b = array([ [0,1,2] , [3,4,5] , [6,7,8] ]) > > How can I easily extract the submatrix [ [0 ,1], [3, 4]] ? > > One possiblity is : b[[0,1],:][:,[0,1]] but it is not really easy ! > > Thanks. x = numpy.array([ [0,1,2], [3,4,5], [6,7,8] ]) print x[0: