Re: [Numpy-discussion] Multiplying a matrix by a vector

2009-02-04 Thread Christopher Barker
Simon Palmer wrote: > 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. >>> M = np.arange(6).reshape((2,3)) >>> M array([[0, 1, 2], [3, 4, 5]])

[Numpy-discussion] Multiplying a matrix by a vector

2009-02-04 Thread Simon Palmer
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