I'm trying to achieve something of this sort:
f1 = lambda x: x**2
f2 = lambda x: x**3
fn = np.array([f1, f2])
print(fn(3))
So that it returns an array with the outputs in place. Of course, I could do it like this:
result = np.array([f(x) for f in fn])
But this seems like an inefficient way to do it... especially if there are a lot of such functions.
Is there an alternative to this? Something more efficient; maybe like numpy ufuncs? I do not know how to do the implementation.