[Numpy-discussion] assigning to submatrix
John Hunter
jdhunter at ace.bsd.uchicago.edu
Tue Jul 29 09:33:02 EDT 2003
If I have a large matrix, say
a = zeros( (20,20) )
and a small matrix
b = ones( 3,4 )
and a list of row indices and a list of col indices
rind = [2,4,9,15]
cind = [1,4,12]
what is the best way to assign the submatrix to a[rind,cind]. I
understand this is possible in numarray, but is there a good way to do
it in Numeric?
In matlab, you could do a(rind, cind)=b; Is there some reshape, put
magic I can do to make this efficient in Numeric?
Thanks,
John Hunter
More information about the NumPy-Discussion
mailing list