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

Joseph Turian turian@gmail....
Wed Apr 16 16:02:12 CDT 2008


My preference is that if something does not work as expected, then throw an
exception. This is better than silently doing the wrong thing, plus it
doesn't take much time to code :^)

Best,
  Joseph

On Tue, Apr 15, 2008 at 4:27 PM, Anne Archibald <peridot.faceted@gmail.com>
wrote:

> On 15/04/2008, Nathan Bell <wnbell@gmail.com> wrote:
> > On Tue, Apr 15, 2008 at 12:37 PM, Joseph Turian <turian@gmail.com>
> wrote:
> >  > 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.
> >
> > I agree that __eq__ should either work or raise an exception.  As to
> >  why __eq__ isn't supported, I haven't written the necessary code to
> >  handle arrays with dtype='bool'.
> >
> >  Offhand, I don't know what specifically needs to be changed to make
> >  sparse matrices agree with numpy's handling of boolean arrays.  Many
> >  of the necessary ingredients are already present, but I have not fully
> >  explored this matter.
> >
> >  I created a ticket in Trac for this issue:
> >  http://scipy.org/scipy/scipy/ticket/639
> >
> >  Unfortunately, time is scarce for me at the moment, so I can't say
> >  when I'll get around to it.
>
> This is actually tricky: you definitely want "not" to be a reasonable
> operation on sparse boolean arrays, which means you can't just store
> the "True" values as nonzero entries. It's still doable, with some
> sort of flag in the sparse object indicating whether the array as a
> whole has been negated, but it's going to be a pain.
>
> Anne
> _______________________________________________
> 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/20080416/a16fe5a6/attachment.html 


More information about the SciPy-user mailing list