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

simpler way of building the metric

parent 076151e3
Pipeline #74156 passed with stages
in 29 minutes and 57 seconds
......@@ -299,10 +299,7 @@ class StudentTEnergy(EnergyOperator):
res = (((self._theta+1)/2)*(x**2/self._theta).ptw("log1p")).sum()
if not x.want_metric:
return res
if isinstance(self._theta, Field):
met = makeOp((self._theta+1) / (self._theta+3))
met = ScalingOperator(self.domain, (self._theta+1) / (self._theta+3))
met = makeOp((self._theta+1) / (self._theta+3), self.domain)
return res.add_metric(met)
......@@ -345,7 +345,7 @@ def makeOp(input, dom=None):
if np.isscalar(input):
if not isinstance(dom, (DomainTuple, MultiDomain)):
raise TypeError("need proper `dom` argument")
return SalingOperator(dom, input)
return ScalingOperator(dom, input)
if dom is not None:
if not dom == input.domain:
raise ValueError("domain mismatch")
Supports Markdown
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