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

Nathan Bell wnbell@gmail....
Mon Apr 14 18:57:29 CDT 2008

On Mon, Apr 14, 2008 at 4:45 PM, Joseph Turian <turian@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@gmail.com

More information about the SciPy-user mailing list