With current Scipy master + Numpy master, the following fails:
>>> x = np.ones(4)
>>> y = scipy.sparse.csr_matrix(x)
>>> x += y
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: __numpy_ufunc__ not implemented for this type.
This used to work via csr_matrix.__radd__, but the current behavior in Numpy master is to pass through the exception rather than return NotImplemented, so that __radd__ is never called.
Two places to fix:
(i) The scipy.spmatrix should support the out array argument
(ii) Numpy should be fixed so that __radd__ gets called even if the __numpy_ufunc__ mechanism ends up with the conclusion that the operation is not supported.
Fixed in gh-2940