[Numpy-discussion] array multiplication

Ernest Adrogué eadrogue@gmx....
Wed Sep 16 16:36:42 CDT 2009


Hi,

I have two 1-d arrays (a and b), and I want to create a
third 2-d array, whose rows are of the form a[i]*b:

c = np.zeros((len(a),b))

c[0] = a[0]*b
c[1] = a[1]*b
.
.
.

Is there an easy way to do this (e.g, without a loop)?
Thanks!

-- 
Ernest


More information about the NumPy-Discussion mailing list