Commit 7af09d12 authored by Philipp Frank's avatar Philipp Frank

Merge branch 'NIFTy_4' into yango_minimizer

needed hotfix from master
parents 36b815ce 453cb030
Pipeline #27927 passed with stage
in 1 minute and 47 seconds
...@@ -53,6 +53,7 @@ def generate_krylov_samples(D_inv, S, j, N_samps, controller): ...@@ -53,6 +53,7 @@ def generate_krylov_samples(D_inv, S, j, N_samps, controller):
and the second entry are a list of samples from D_inv.inverse and the second entry are a list of samples from D_inv.inverse
""" """
# MR FIXME: this should be synchronized with the "official" Nifty CG # MR FIXME: this should be synchronized with the "official" Nifty CG
# RL FIXME: make consistent with complex numbers
j = S.draw_sample(from_inverse=True) if j is None else j j = S.draw_sample(from_inverse=True) if j is None else j
x = j*0. x = j*0.
energy = QuadraticEnergy(x, D_inv, j) energy = QuadraticEnergy(x, D_inv, j)
...@@ -66,13 +67,13 @@ def generate_krylov_samples(D_inv, S, j, N_samps, controller): ...@@ -66,13 +67,13 @@ def generate_krylov_samples(D_inv, S, j, N_samps, controller):
p = r.copy() p = r.copy()
d = p.vdot(D_inv(p)) d = p.vdot(D_inv(p))
while True: while True:
gamma = r.vdot(r)/d gamma = r.vdot(r) / d
if gamma == 0.: if gamma == 0.:
break break
x = x + gamma*p x = x + gamma*p
Dip = D_inv(p) Dip = D_inv(p)
for samp in y: for samp in y:
samp += (randn() * sqrt(d) - samp.vdot(Dip)) / d * p samp += (np.random.randn() * np.sqrt(d) - samp.vdot(Dip)) / d * p
energy = energy.at(x) energy = energy.at(x)
status = controller.check(energy) status = controller.check(energy)
if status != controller.CONTINUE: if status != controller.CONTINUE:
......
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