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

Joseph Turian turian@gmail....
Tue Apr 15 12:37:25 CDT 2008


Is there a reason that sparse matrices don't support this functionality?
What is actually happening when I try equality testing for A == B?
It seems undesirable that equality comparison is permitted, even though it
has unexpected behavior.

On Mon, Apr 14, 2008 at 7:57 PM, Nathan Bell <wnbell@gmail.com> wrote:

> 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
> http://graphics.cs.uiuc.edu/~wnbell/<http://graphics.cs.uiuc.edu/%7Ewnbell/>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>



-- 
Academic: http://www-etud.iro.umontreal.ca/~turian/
Business: http://www.metaoptimize.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20080415/796f6653/attachment.html 


More information about the SciPy-user mailing list