[Numpy-discussion] array vector elementwise multiplication

Gideon Simpson simpson at math.toronto.edu
Tue Feb 3 12:19:45 EST 2009


I have an M x N matrix A and two vectors, an M dimensional vector x  
and an N dimensional vector y.  I would like to be able to do two  
things.

1.  Multiply, elementwise, every column of A by x

2.  Multiply, elementwise, every row of A by y.

What's the "quick" way to do this in numpy?

-gideon




More information about the NumPy-Discussion mailing list