[SciPy-Dev] Sparse boolean specification
Mon Apr 22 23:27:39 CDT 2013
Thanks for the suggestions Pauli, I've begun drafting a specification it is
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 <firstname.lastname@example.org> 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
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-Dev