Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我刚开始使用numexpr,虽然 github 存储库似乎有一些如何使用它的基本示例,但我无法清楚地理解这些如何应用于一些复杂的案例。假设我有一个功能:
numexpr
def func(x): #x is a numpy array of very large size return 0.5*np.exp(-x**2)*x**(1/3)+np.exp(-x)*(1.5*np.sqrt(x)+0.3/(1.+x))
使用 写这个的等效方法是numexpr什么?
np.sqrt→ sqrt; np.exp→exp
np.sqrt
sqrt
np.exp
exp
import numexpr as ne y = ne.evaluate( '.5 * exp(-x ** 2) * x ** (1 / 3)' '+ exp(-x) * (1.5 * sqrt(x)' '+ .3 / (1. + x))' )