[SciPy-dev] better sparse slicing

Nathan Bell wnbell@gmail....
Thu Feb 14 02:42:57 CST 2008


I've expanded on Robert C's earlier efforts in improving the state of
sparse slicing.

Previously you could do
A[1]
A[1:2]
A[1:2,1]
A[1:2,1:2]

Now you can do:
A[[1,2]]
A[1:2,[1,2]]
A[[1,2],1:2]
A[[1,2],[1,2]]

and the all important:
A[[1,2],:][:,[1,2]]


Currently this only works for csr_matrix (and not csc_matrix).  Once I
trust my csr_matrix implementation I'll make csc_matrix work also.
The above operations should mimic numpy.matrix exactly.

-- 
Nathan Bell wnbell@gmail.com
http://graphics.cs.uiuc.edu/~wnbell/


More information about the Scipy-dev mailing list