Commit 5b68568b authored by Martin Reinecke's avatar Martin Reinecke

Merge branch 'master' into python3

parents 2b4b6c07 20edb351
......@@ -24,7 +24,7 @@ from .field import Field
__all__ = ['cos', 'sin', 'cosh', 'sinh', 'tan', 'tanh', 'arccos', 'arcsin',
'arccosh', 'arcsinh', 'arctan', 'arctanh', 'sqrt', 'exp', 'log',
'conjugate', 'clipped_exp', 'limitted_exp']
'conjugate', 'clipped_exp', 'limited_exp']
def _math_helper(x, function):
......@@ -100,13 +100,13 @@ def clipped_exp(x):
return _math_helper(x, lambda z: np.exp(np.minimum(200, z)))
def limitted_exp(x):
def limited_exp(x):
thr = 200
expthr = np.exp(thr)
return _math_helper(x, lambda z: _limitted_exp_helper(z, thr, expthr))
return _math_helper(x, lambda z: _limited_exp_helper(z, thr, expthr))
def _limitted_exp_helper(x, thr, expthr):
def _limited_exp_helper(x, thr, expthr):
mask = (x > thr)
result = np.exp(x)
result[mask] = ((1-thr) + x[mask])*expthr
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment