Skip to content
Snippets Groups Projects

Scalable energies2

Merged Reimar H Leike requested to merge scalable_energies2 into NIFTy_6
Files
2
@@ -98,5 +98,18 @@ class ScalingOperator(EndomorphicOperator):
return from_random(random_type="normal", domain=self._domain,
std=self._get_fct(from_inverse), dtype=dtype)
def __call__(self, other):
res = EndomorphicOperator.__call__(self, other)
if np.isreal(self._factor) and self._factor >= 0:
from ..linearization import Linearization
if isinstance(other, Linearization):
if other.metric is not None:
from .sandwich_operator import SandwichOperator
sqrt_fac = np.sqrt(self._factor)
newop = ScalingOperator(other.metric.domain, sqrt_fac)
met = SandwichOperator.make(newop, other.metric)
res = res.add_metric(met)
return res
def __repr__(self):
return "ScalingOperator ({})".format(self._factor)
Loading