scipy/scipy — pull request #2474 by Daniel-B-Smith (2013-05-09 20:40:21+00:00)
Title: CSR and CSC fancy indexing

This probably needs some refactoring, but it is a start. CSR and CSC now pass all but one of the tests for fancy __getitem__. The one test it fails is when you give it a slice object that would generate an empty matrix, the underlying CSR class doesn't like that. I don't know whether the test or the class should be rewritten, so I just left that alone.

__setitem__ was rewritten in the _cs_matrix class, so both CSC and CSR matrices have it. BSR might also, but I haven't run those tests.

Where refactoring/other help is probably needed is in getting CSC __getitem__(). The way I am reading the code now, the CSC __getitem__() is implicitly dependent upon the exact implementation of CSR __getitem__(). That's not the worst sin one could commit, but the code could probably be written in a smarter way.