[SciPy-dev] Refactoring of csc/csr sparse matrices

Tim Leslie tim.leslie at gmail.com
Thu Jan 11 00:15:37 EST 2007


Hi All,

i've been cleaning up some of the sparse.py code, and I noticed that
there's a lot of duplicated code between csr_matrix and csc_matrix. I
was able to resolve quite a lot of this into a single parent class
_cs_matrix which I checked in yesterday.

I've made some further changes, but they involve possible changes to
the interface, so I'd like to get some opinions before committing
them. The rowind/colind attributes in the respective classes play
equivalent roles. By changing their names to be the same (say
'indices'), the two classes could be further reconciled into a single
base class.

The problem is that changing these names would break the current
interface. This could be un-broken by using __getattr__/__setattr__ to
trap all calls to rowind/colind and pass them on to 'indices'.

So, the question is should we a) make no change, b) make the change
and change the interface or c) make the change but keep the old
interface. I'm personally in favour or c), but I'd like to hear what
other people have to say.

Cheers,

Tim



More information about the SciPy-Dev mailing list