Commit 537fb1a6 authored by Reimar Heinrich Leike's avatar Reimar Heinrich Leike

fixup

parent 1f598ab5
Pipeline #61339 passed with stages
in 9 minutes and 29 seconds
......@@ -187,8 +187,8 @@ class NewtonCG(DescentMinimizer):
e = QuadraticEnergy(0*energy.position, energy.metric, energy.gradient)
p = None
if self._napprox > 1:
unscmet, sc = energy.unscaled_metric()
p = makeOp(approximation2endo(unscmet, self._napprox)*sc).inverse
met = energy.metric
p = makeOp(approximation2endo(met, self._napprox)).inverse
e, conv = ConjugateGradient(ic, nreset=self._nreset)(e, p)
return -e.position
......
......@@ -23,7 +23,7 @@ from .energy import Energy
from mpi4py import MPI
import numpy as np
from ..probing import approximation2endo
from ..sugar import makeOp
from ..sugar import makeOp, full
from ..field import Field
from ..multi_field import MultiField
......@@ -70,7 +70,7 @@ class KLMetric(EndomorphicOperator):
return self._KL.apply_metric(x)
def draw_sample(self, from_inverse=False, dtype=np.float64):
self._KL.metric_sample(from_inverse, dtype)
return self._KL.metric_sample(from_inverse, dtype)
......@@ -241,9 +241,9 @@ class MetricGaussianKL_MPI(Energy):
if from_inverse:
raise NotImplementedError()
lin = self._lin.with_want_metric()
samp = ift.full(self._hamiltonian.domain, 0.)
for s in self._samples:
samp = samp + self._hamiltonian(lin+v).metric.draw_sample(dtype)
samp = full(self._hamiltonian.domain, 0.)
for v in self._samples:
samp = samp + self._hamiltonian(lin+v).metric.draw_sample(from_inverse=False, dtype=dtype)
return allreduce_sum_field(samp)
def metric_sample(self, from_inverse=False, dtype=np.float64):
......
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