Robert Kern wrote:
On 2009-09-08 20:45 PM, hi_roger wrote:
hello, i want to ask a question about numpy.

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 )
The submatrix must share data memory with original matrix.

Any one help? thank you

Sturla is almost correct. What you really want is this:

  i = [[i1], [i2], [i3]]
  j = [[j1, j2, j3]]
  B = A[i, j]

http://docs.scipy.org/doc/numpy/reference/arrays.indexing.html#integer

If you have more numpy questions, please ask on the numpy mailing list.

  http://www.scipy.org/Mailing_Lists

wow...,  thank you all :)
but it seems it is impossible to make the submatrix share data with the original matrix in pure numpy code ?
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to