[SciPy-Dev] Sparse boolean specification

Blake Griffith blake.a.griffith@gmail....
Mon Apr 22 23:27:39 CDT 2013

```Thanks for the suggestions Pauli, I've begun drafting a specification it is
on GitHub:

https://github.com/cowlicks/scipy-sparse-boolean-spec/blob/master/scipep.rst

It's still very rough and missing a lot. There is a citation to
your recommendation in there.

On Mon, Apr 22, 2013 at 2:17 PM, Pauli Virtanen <pav@iki.fi> wrote:

> 22.04.2013 21:51, Blake Griffith kirjoitti:
> > So Pauli, if this is implemented as you suggest, the specification could
> > recommend using the inverse of the typical bool_op. For example if you
> > think that A and B are approximately equal, instead of checking with `A
> > == B`. You could do `A != B` and check for an empty sparse matrix?
> >
> > However there does not seem to be an easy way to avoid a matrix full of
> > `True`'s if you don't know much about A or B.
>
> I think in the typical case where sparse matrices are useful, the
> matrixes contain mostly zeros, so the behavior in this case is something
> like
>
>         A == B -> mostly True
>         A >= B -> mostly True
>         A <= B -> mostly True
>         A != B -> mostly False
>         A > B  -> mostly False
>         A < B  -> mostly False
>         ...
>
> But I indeed think that we are very much constrained to make the
> semantics of the comparison and boolean operators identical with how
> dense arrays behave.
>
> The documentation/tutorial can tell the users what is efficient and what
> is not, and there is also the SparseEfficiencyWarning that can be
> invoked when something sub-optimal is done.
>
> The option of adding a special sparse array type with a nonzero
> "default" value could also be possible, but it would probably require
> quite a bit of work.
>
> --
> Pauli Virtanen
>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-dev/attachments/20130422/4029841a/attachment.html
```