Commit 478a37dd authored by Reimar H Leike's avatar Reimar H Leike
Browse files

summarized computations in krylov sampling

parent adc1eca5
......@@ -65,8 +65,7 @@ def generate_krylov_samples(D_inv, S, j=None, N_samps=1, N_iter=10,
break
x += gamma*p
for i in range(N_samps):
y[i] -= p.vdot(D_inv(y[i])) * p / d
y[i] += randn() / sqrt(d) * p
y[i] += (randn() * sqrt(d) - p.vdot(D_inv(y[i]))) / d * p
r_new = r - gamma * D_inv(p)
beta = r_new.vdot(r_new) / r.vdot(r)
r = r_new
......
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