[Scipy-tickets] [SciPy] #1598: Bad behavior of sparse matrices in a binary ufunc
SciPy Trac
scipy-tickets@scipy....
Fri Feb 17 05:26:48 CST 2012
#1598: Bad behavior of sparse matrices in a binary ufunc
--------------------------+-------------------------------------------------
Reporter: pv | Owner: wnbell
Type: defect | Status: new
Priority: normal | Milestone: Unscheduled
Component: scipy.sparse | Version: 0.10.0
Keywords: |
--------------------------+-------------------------------------------------
This behavior should be improved:
{{{
import numpy as np
import scipy.sparse as sp
A = sp.csc_matrix(np.identity(5))
B = np.asmatrix(np.ones((5,5)))
print np.multiply(A,A)
# <5x5 sparse matrix of type '<class 'numpy.float64'>'
# with 5 stored elements in Compressed Sparse Column format>
print np.multiply(B,A)
# NotImplemented
print np.multiply(A,B).dtype
# object
}}}
I don't actually follow what happens in the last one --- according to pdb,
the execution never reaches `csc_matrix.multiply`. Instead, one gets calls
to `csc_matrix.__mul__`.
Also, these routines should never return NotImplemented.
--
Ticket URL: <http://projects.scipy.org/scipy/ticket/1598>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.
More information about the Scipy-tickets
mailing list