[SciPy-user] dot product of vectors stored as "matrix"?

David Warde-Farley david.warde.farley at utoronto.ca
Fri Mar 2 11:41:54 EST 2007


  This is more a question of elegance than anything else, but, given  
2 column vectors (or row vectors) stored as type "matrix", why  
doesn't dot(x,y) give you their dot product? I get complaints about  
"matrices not aligned".

Of course dot(x.T, y) works (with the annoying caveat that you get a  
matrix and have to dereference its single element), and so does dot 
(x.A.squeeze(), y.A.squeeze()), and so too does sum(multiply(x,y)).

Is there a preferred notation for linear-algebra dot products, one  
that's faster than the others?

David



More information about the SciPy-User mailing list