[SciPy-Dev] sparse matrices comparison

Denis Laxalde denis.laxalde at mcgill.ca
Tue Feb 21 14:36:10 EST 2012


Sparse matrices don't support comparison. E.g.:

  >>> a = csr_matrix([[1, 2], [0, 3]])
  >>> b = a.copy()
  >>> a == b
  False
  >>> a - b
  <2x2 sparse matrix of type '<type 'numpy.int64'>'
          with 0 stored elements in Compressed Sparse Row format>

This is apparently known (Ticket #639) but I was wondering if it
wouldn't be better to raise a NotImplemented error instead
returning wrong results.

-- 
Denis



More information about the SciPy-Dev mailing list