[SciPy-user] arbitrary submatrices of a sparse matrix?

Robert Cimrman cimrman3@ntc.zcu...
Fri Dec 14 04:21:05 CST 2007


David Warde-Farley wrote:
> Hmm, I've just noticed that get_submatrix() in SVN *claims* to do  
> what I want it to do, but actually doesn't. It works fine with  
> slices, but with tuples it always returns a 1x1. Is it supposed to do  
> that? (There's no test case for this particular functionality and the  
> documentation is, shall we say, sparse)

It works for slices only. Yes, the docstring, as I reread it now, is not 
clear. What it should say is, that the slice can be given as:
1. slice object
2. a tuple (from, to)
3. a scalar for single row/column selection
The method should probably be named _get_submatrix(), as it is used 
internally in __getitem__().

r.


More information about the SciPy-user mailing list