There appears to be some discrepancy between the scipy sparse matrix types and the normal numpy matrix type
import scipy.sparse as sp
A = sp.dia_matrix(tri(3,4))
vec = array([1,2,3,4])
print A * vec #array([ 1., 3., 6.])
print A * (mat(vec).T) #matrix([[ 1.],
# [ 3.],
# [ 6.]])
print A.todense() * vec #ValueError: matrices are not aligned
print A.todense() * (mat(vec).T) #matrix([[ 1.],
# [ 3.],
# [ 6.]])
Why can sparse matrices work out that an array should be interpreted as a column vector when normal matrices cannot?
ndarray. - hpaulj