Let's say one has an array of two-dimensional vectors:
v = np.array([ [1, 1], [1, 1], [1, 1], [1, 1]])
v.shape = (4, 2)
And an array of scalars:
s = np.array( [2, 2, 2, 2] )
s.shape = (4,)
I need the result:
f(v, s) = np.array([ [2, 2], [2, 2], [2, 2], [2, 2]])
Now execution v*sis a mistake. Then, what is the most efficient way to implement it f?
source
share