Commit 3b24e3c7 authored by Philipp Frank's avatar Philipp Frank
Browse files

workaround for complex lh sampling

parent 6fa98577
Pipeline #67471 passed with stages
in 25 minutes and 18 seconds
......@@ -14,6 +14,7 @@
# Copyright(C) 2013-2019 Max-Planck-Society
#
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
import numpy as np
from .. import utilities
from ..linearization import Linearization
......@@ -78,7 +79,7 @@ class MetricGaussianKL(Energy):
def __init__(self, mean, hamiltonian, n_samples, constants=[],
point_estimates=[], mirror_samples=False,
napprox=0, _samples=None):
napprox=0, _samples=None, lh_sampling_dtype = np.float):
super(MetricGaussianKL, self).__init__(mean)
if not isinstance(hamiltonian, StandardHamiltonian):
......@@ -99,7 +100,8 @@ class MetricGaussianKL(Energy):
mean, point_estimates, True)).metric
if napprox > 1:
met._approximation = makeOp(approximation2endo(met, napprox))
_samples = tuple(met.draw_sample(from_inverse=True)
_samples = tuple(met.draw_sample(from_inverse=True,
dtype = lh_sampling_dtype)
for _ in range(n_samples))
if mirror_samples:
_samples += tuple(-s for s in _samples)
......
......@@ -71,7 +71,7 @@ class SamplingEnabler(EndomorphicOperator):
else:
s = self._prior.draw_sample(from_inverse=True)
sp = self._prior(s)
nj = self._likelihood.draw_sample()
nj = self._likelihood.draw_sample(dtype = dtype)
energy = QuadraticEnergy(s, self._op, sp + nj,
_grad=self._likelihood(s) - nj)
inverter = ConjugateGradient(self._ic)
......
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