I want to perform
array_0 = np.array([ [1,2,3], [1,2,3], [1,2,3] ]) array_1 = np.array([ [1,2,3], [1,2,3], [1,2,3] ]) weights = np.array([ 1, 5 ]) result = array_0 * weights + array_1 * weights
Is there a
numpy function that does just that?
Obviously, I could use
1==sum(weights), and then multiply the result to compensate, but my question is: is there a function that does the sum-product without tricks?
Also, my question may be invalid: I assume that
w1*A1+w2*A2+w3*A3+... results in as many for loops as there are operation, not just a single elementwise for loop.
There is a similar question, which does not work in my case: