[SciPy-user] scipy.sparse -=

Nathan Bell wnbell at gmail.com
Fri Apr 18 13:40:59 EDT 2008


On Thu, Apr 17, 2008 at 4:43 PM, Joseph Turian <turian at gmail.com> wrote:
> Is there a -= for scipy.sparse matrices?

Not currently.   Unless the sparsity patterns of A and B in A -= B
were the same, then there's little benefit in supporting in-place
arithmetic.

If A and B are CSR or CSC matrices with the same index arrays (i.e.
A.indptr == B.indptr and A.indices == B.indices) then A -= B is
equivalent to A.data -= B.data

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



More information about the SciPy-User mailing list