[SciPy-Dev] sparse boolean comparisons

Blake Griffith blake.a.griffith@gmail....
Tue Jun 11 15:40:59 CDT 2013

I'm currently trying to implement boolean comparison operators in the
sparse package. My first priority is csr & csc. So far it looks like
comparisons where 2 zeros are compared to return false are easy, like !=
(but not ==). I got this working using the existing csr_binopt_csr routine
in sparsetools/csr.h.

But for operations like ==, which should return True for all the zero
entries, the binopt routines do not apply the binopt when both elements are
zero. So I think the best way to implement == would just be by negating the
!= result in python. Since it will return a very dense matrix, it will be
slow anyway.

What sort of syntax would be best for implementing negation? It should only
be applicable if the sparse matrix is dtype=bool. Should it be a method, or
a function in sparse?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-dev/attachments/20130611/3d034e08/attachment.html 

More information about the SciPy-Dev mailing list