Commit dafe2922 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

fix and simplify

parent a7325040
Pipeline #47597 passed with stages
in 8 minutes and 14 seconds
......@@ -192,11 +192,10 @@ class PoissonianEnergy(EnergyOperator):
def apply(self, x):
res = x.sum()
tmp = (res.val.local_data if isinstance(res, Linearization)
else res.local_data)
tmp = res.val.local_data if isinstance(res, Linearization) else res
# if we have no infinity here, we can continue with the calculation;
# otherwise we know that the result must also be infinity
if not np.any(np.isinf(tmp)):
if not np.isinf(tmp):
res = res - x.log().vdot(self._d)
if not isinstance(x, Linearization):
return Field.scalar(res)
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