Alexander Michael wrote:
> Is there a clever way to multiply each column of a matrix by a vector
> *element-wise*? That is, the equivalent of (from some 1D v and 2D m):
>
> r = numpy.empty_like(m)
> for i in range(m.shape[-1]):
> r[...,i] = v*m[...,i]
numpy.multiply(m, v[:,numpy.newaxis])
Is there a clever way to multiply each column of a matrix by a vector
*element-wise*? That is, the equivalent of (from some 1D v and 2D m):
r = numpy.empty_like(m)
for i in range(m.shape[-1]):
r[...,i] = v*m[...,i]
Thanks,
Alex
___
Numpy-discussion