[SciPy-Dev] Sparse boolean specification
Blake Griffith
blake.a.griffith@gmail....
Sun Apr 21 21:00:48 CDT 2013
Hello, I've been thinking about how I would write the bool handling. I
wanted to bounce some ideas off the list, to see what y'all thought.
When comparing two sparse matrices of the same type. A sparse matrix of the
same type, with bool dtype, should be returned with all True elements with
original sets of elements. A element without a corresponding value in the
other spmatrix is False. Does this make sense? An example:
>>> coo_matrix([True, True], [1,1], [2,2]) == coo_matrix([True, True],
[1,3], [1,3])
coo_matrix([True], [1], [1])
When comparing sparse matrices with numpy ndarrays or matrices. The
sparsematrix can probably be easily expressed as a dense matrix. So we
should spmatrix.toarray() or spmatrix.todense() and compare it with the
ndarray or matrix. Returning a ndarray or matrix with bool dtype where each
element is a[i,j] = (b[i,j] == c[i,j]), for comparing B == C. Like wise for
other comparisons.
Does this sound good so far?
Also, should I write this up like a PEP?
Thanks!
Blake G. -- http://cwl.cx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-dev/attachments/20130421/dfa08396/attachment.html
More information about the SciPy-Dev
mailing list