Commit 128309f6 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

Merge branch 'mightier_operators' into 'NIFTy_6'

Mightier operators

See merge request !414
parents 76568d69 698bc932
Pipeline #70416 passed with stages
in 26 minutes and 5 seconds
......@@ -134,10 +134,8 @@ class VariableCovarianceGaussianEnergy(EnergyOperator):
lin = isinstance(x, Linearization)
r = FieldAdapter(self._domain[self._r], self._r)
icov = FieldAdapter(self._domain[self._icov], self._icov)
res0 = r.conjugate()*r*icov
sum_it = ContractionOperator(, None)
res0 = sum_it(res0).real
res1 = sum_it(icov.log())
res0 = r.vdot(r*icov).real
res1 = icov.log().sum()
res = 0.5*(res0-res1)
res = res(x)
if not lin:
......@@ -66,6 +66,13 @@ class Operator(metaclass=NiftyMeta):
from .simple_linear_operators import ConjugationOperator
return ConjugationOperator(
def sum(self, spaces=None):
from .contraction_operator import ContractionOperator
return ContractionOperator(, spaces)(self)
def vdot(self, other):
return (self.conjugate()*other).sum()
def real(self):
from .simple_linear_operators import Realizer
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