a1 = [array] #shape = (m,)
a2 = [array] #shape = (n,)
a = func(a1,a2) # func returns an array of shape = (n, m)
# a is an array of shape = (n, m)
a_sol = [] # empty list
for i in a1:
f = lambda x: float(func(np.array(i), np.array(x)))
res = scipy.optimize.minimize_scalar(f)
a_sol.append(res)
Is there a way to do this without for loop? Instead of passing each element of a1
one at a time, is there a way to find the minima for all the values of a1 at once, without using the for loop?