[Numpy-discussion] Multiplying a matrix by a vector
Simon Palmer
simon.palmer@gmail....
Wed Feb 4 15:18:33 CST 2009
Bit of a newb question I suspect...
I have a matrix and a vector which has the same number of elements as the
matrix has rows. I want to multiply each element in a row in the matrix by
the corresponding element in the vector. I can obviously do this with a
loop, but am guessing there is a more elegant (and faster?) solution.
Just for clarity...
Matrix
[X1, X2, X3]
[Y1, Y2, Y3]
Vector
[A, B]
Desired result
[X1*A, X2*A, X3*A]
[Y1*B, Y2*B, Y3*B]
--
View this message in context: http://www.nabble.com/Multiplying-a-matrix-by-a-vector-tp21839828p21839828.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.
More information about the Numpy-discussion
mailing list