Efficient algorithm for evaluating a 1-d array of functions on a same-length 1d numpy array

后端 未结 3 1956
刺人心
刺人心 2021-01-19 18:18

I have a (large) length-N array of k distinct functions, and a length-N array of abcissa. I want to evaluate the functions at the abcissa to return a length-N array of ordin

3条回答
  •  梦谈多话
    2021-01-19 19:03

    That is a beautiful example of functional programming being somewhat emulated in Python.

    Now, if you want to apply your function to a set of points, I'd recommend numpy's ufunc framework, which will allow you to create blazingly fast vectorized versions of your functions.

提交回复
热议问题