I have the following numpy arrays:
arr_1 = [[1,2],[3,4],[5,6]]
arr_2 = [[0.5,0.6],[0.7,0.8],[0.9,1.0],[1.1,1.2],[1.3,1.4]]
arr_1is explicitly an array 3 X 2, whereas it arr_2is an array 5 X 2.
Now, without a loop, I want to incrementally multiply arr_1 and arr_2 in order to apply the sliding window method (window size 3) to arr_2.
Example:
Multiplication 1: np.multiply(arr_1,arr_2[:3,:])
Multiplication 2: np.multiply(arr_1,arr_2[1:4,:])
Multiplication 3: np.multiply(arr_1,arr_2[2:5,:])
I want to do this in the form of a matrix multiplication form, to make it faster than my current solution having the form:
for i in (2):
np.multiply(arr_1,arr_2[i:i+3,:])
So, if the number of lines in arr_2 is large (of the order of tens of thousands), this solution does not really scale very well.
Any help would be greatly appreciated.