Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad behavior of sparse matrices in a binary ufunc (Trac #1598) #2123

Closed
scipy-gitbot opened this issue Apr 25, 2013 · 1 comment
Closed

Bad behavior of sparse matrices in a binary ufunc (Trac #1598) #2123

scipy-gitbot opened this issue Apr 25, 2013 · 1 comment
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected Migrated from Trac scipy.sparse
Milestone

Comments

@scipy-gitbot
Copy link

Original ticket http://projects.scipy.org/scipy/ticket/1598 on 2012-02-17 by @pv, assigned to @wnbell.

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.

@pv
Copy link
Member

pv commented Sep 22, 2013

Fixed in gh-2869

@pv pv closed this as completed Sep 22, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected Migrated from Trac scipy.sparse
Projects
None yet
Development

No branches or pull requests

2 participants