{"action":"created","issue":{"url":"https://api.github.com/repos/scipy/scipy/issues/5056","repository_url":"https://api.github.com/repos/scipy/scipy","labels_url":"https://api.github.com/repos/scipy/scipy/issues/5056/labels{/name}","comments_url":"https://api.github.com/repos/scipy/scipy/issues/5056/comments","events_url":"https://api.github.com/repos/scipy/scipy/issues/5056/events","html_url":"https://github.com/scipy/scipy/issues/5056","id":95325364,"number":5056,"title":"sparse matrix element-wise multiplying dense matrix returns dense matrix","user":{"login":"dawenl","id":1088672,"avatar_url":"https://avatars.githubusercontent.com/u/1088672?v=3","gravatar_id":"","url":"https://api.github.com/users/dawenl","html_url":"https://github.com/dawenl","followers_url":"https://api.github.com/users/dawenl/followers","following_url":"https://api.github.com/users/dawenl/following{/other_user}","gists_url":"https://api.github.com/users/dawenl/gists{/gist_id}","starred_url":"https://api.github.com/users/dawenl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dawenl/subscriptions","organizations_url":"https://api.github.com/users/dawenl/orgs","repos_url":"https://api.github.com/users/dawenl/repos","events_url":"https://api.github.com/users/dawenl/events{/privacy}","received_events_url":"https://api.github.com/users/dawenl/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2015-07-16T01:18:49Z","updated_at":"2016-10-30T12:31:43Z","closed_at":"2015-09-17T16:49:37Z","body":"When a scipy sparse matrix element-wise multiples a dense ndarray, the returned matrix is of type matrix, which seems very inefficient, given that it is obviously a sparse matrix.\n\n```\nIn [90]: A = scipy.sparse.csr_matrix((5, 5))\n\nIn [93]: B = np.random.randn(5, 5)\n\nIn [96]: C = A.multiply(B)\n\nIn [98]: type(C)\nOut[98]: numpy.matrixlib.defmatrix.matrix\n\nIn [100]: C\nOut[100]: \nmatrix([[-0., -0.,  0.,  0.,  0.],\n        [ 0.,  0., -0., -0., -0.],\n        [ 0., -0.,  0.,  0., -0.],\n        [-0., -0.,  0.,  0.,  0.],\n        [ 0.,  0.,  0., -0., -0.]])\n```\n\nIs there any reason behind this that I am missing? \n"},"comment":{"url":"https://api.github.com/repos/scipy/scipy/issues/comments/257148393","html_url":"https://github.com/scipy/scipy/issues/5056#issuecomment-257148393","issue_url":"https://api.github.com/repos/scipy/scipy/issues/5056","id":257148393,"user":{"login":"jluttine","id":2195834,"avatar_url":"https://avatars.githubusercontent.com/u/2195834?v=3","gravatar_id":"","url":"https://api.github.com/users/jluttine","html_url":"https://github.com/jluttine","followers_url":"https://api.github.com/users/jluttine/followers","following_url":"https://api.github.com/users/jluttine/following{/other_user}","gists_url":"https://api.github.com/users/jluttine/gists{/gist_id}","starred_url":"https://api.github.com/users/jluttine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jluttine/subscriptions","organizations_url":"https://api.github.com/users/jluttine/orgs","repos_url":"https://api.github.com/users/jluttine/repos","events_url":"https://api.github.com/users/jluttine/events{/privacy}","received_events_url":"https://api.github.com/users/jluttine/received_events","type":"User","site_admin":false},"created_at":"2016-10-30T12:31:43Z","updated_at":"2016-10-30T12:31:43Z","body":"I don't think this issue has been fixed when broadcasting occurs. I'm running SciPy 0.18.1 and I get the following outputs:\r\n\r\n```\r\n>>> from scipy import sparse\r\n\r\n>>> sparse.eye(4,3).multiply(np.ones((4,3)))\r\n<4x3 sparse matrix of type '<class 'numpy.float64'>'\r\n\twith 3 stored elements in COOrdinate format>\r\n\r\n>>> sparse.eye(4,1).multiply(np.ones((4,3)))\r\nmatrix([[ 1.,  1.,  1.],\r\n        [ 0.,  0.,  0.],\r\n        [ 0.,  0.,  0.],\r\n        [ 0.,  0.,  0.]])\r\n\r\nsparse.eye(4,1).multiply(np.ones((1,3)))\r\nmatrix([[ 1.,  1.,  1.],\r\n        [ 0.,  0.,  0.],\r\n        [ 0.,  0.,  0.],\r\n        [ 0.,  0.,  0.]])\r\n```\r\n\r\nI think all these should return sparse matrix results."}}
{"actor":{"display_login":"jluttine"}}