Commit e1bad1d8 authored by Gordian Edenhofer's avatar Gordian Edenhofer
Browse files

Streamline log1p definition in linearization.py

parent cb24121f
Pipeline #63859 passed with stages
in 8 minutes and 11 seconds
...@@ -336,10 +336,9 @@ class Linearization(object): ...@@ -336,10 +336,9 @@ class Linearization(object):
return self.new(tmp, makeOp(tmp2)(self._jac)) return self.new(tmp, makeOp(tmp2)(self._jac))
def log1p(self): def log1p(self):
xval = self.val tmp = self._val.log1p()
res = xval.log1p() tmp2 = 1. / (1. + self._val)
jac = makeOp(1. / (1. + xval)) return self.new(tmp, makeOp(tmp2)(self.jac))
return self.new(res, jac @ self.jac)
def expm1(self): def expm1(self):
tmp = self._val.expm1() tmp = self._val.expm1()
......
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