[Scipy-tickets] [SciPy] #1603: Sparse matrices do not broadcast properly

SciPy Trac scipy-tickets@scipy....
Tue Feb 21 12:41:19 CST 2012

#1603: Sparse matrices do not broadcast properly
 Reporter:  jluttine      |       Owner:  wnbell     
     Type:  defect        |      Status:  new        
 Priority:  normal        |   Milestone:  Unscheduled
Component:  scipy.sparse  |     Version:  devel      
 Keywords:                |  
 Sparse matrices do not seem to broadcast properly (or at all?). Consider
 the following piece of code:
 import numpy as np
 import scipy.sparse as sp
 A = np.ones((3,4))
 np.multiply(A, A[0]) # arrays are ok
 B = np.asmatrix(A)
 np.multiply(B, B[0]) # matrices are ok
 C = sp.csc_matrix(A)
 np.multiply(C, C[0]) # sparse matrix fails
 C.multiply(C[0])     # sparse matrix fails
 The last two lines give errors:
 ValueError: dimension mismatch
 ValueError: inconsistent shapes

Ticket URL: <http://projects.scipy.org/scipy/ticket/1603>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.

More information about the Scipy-tickets mailing list