I've been looking for ways to avoid long "for" loops as I'll be dealing with mesh operations and was wondering if there was a way to make an array of functions. Something like the following would be nice.
x=np.array([1,2,3,4,5])
funcs=np.array([func1,func2,func3,func4],dtype=function)
output=funcs(x)
numpycontext really means 'do the loops in compiled code'. There's a lot you can do with numeric dtype arrays. But yourfuncsis object dtype (look at it!). Most math on object arrays uses python level iteration (explicit or hidden). In any case, there's nonumpyfunctionality that will do[func1(1), func2(2), ....]