Can we vectorize this for-loop that finally result update in each iterate and using the result in for like below:
x = np.array([[1,2],[2,3],[3,4]])
y = np.array([1,-1,1])
z = np.array([-1,1,-1])
w = 2
out = np.array([10,20])
for xi,yi,zi in zip(x, y, z):
out = out + (w*(yi-zi))*xi
Output:
>>> out
array([ 18, 32])