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

Comments

@scipy-gitbot
Copy link

@scipy-gitbot scipy-gitbot commented Apr 25, 2013

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

This comment has been minimized.

Copy link
Member

@pv pv commented Sep 22, 2013

Fixed in gh-2869

@pv pv closed this Sep 22, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.