[SciPy-user] __eq__ for scipy.sparse not working?

Nathan Bell wnbell at gmail.com
Mon Apr 14 19:57:29 EDT 2008


On Mon, Apr 14, 2008 at 4:45 PM, Joseph Turian <turian at gmail.com> wrote:
> I am having trouble determining equality of sparse matrices.
> Consider this code snippet. Although the sparse matrices appear to be equal,
> z==y returns false (until I convert the matrices to dense matrices).
> What is the problem with the equality test here?

Sparse matrices don't currently support that functionality.  A
workaround could be abs(A-B).nnz == 0

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



More information about the SciPy-User mailing list