I have two arrays x.dim = (N,4) and y.dim = (M, M, 2) and a function f(a, b), which takes K and Ldimensional vectors respectively as arguments. I want to obtain an array res.dim = (N, M, M) such that
for n in range(N):
for i in range(M):
for j in range(M):
res[n, i, j] = f(x[n], y[i, j])
Can't get how to use apply in this case. Thanks in advance for help!
def f(a, b):
return max(0, 1 - np.sum(np.square(np.divide(np.subtract(b, a[0:2]), a[2:4]))))
i, j in range(N)? int object is not iterable? supposing range(N) is list of ints from 0 to N-1