From 205ea4bbb2d86f33c6fd2e2dc4e193a0d386a951 Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Sat, 4 Jan 2020 03:13:40 -0500 Subject: [PATCH] More verboose Lanczos --- .../iterative/ImplicitlyRestartedLanczos.h | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/Grid/algorithms/iterative/ImplicitlyRestartedLanczos.h b/Grid/algorithms/iterative/ImplicitlyRestartedLanczos.h index e5573c8e..8e059048 100644 --- a/Grid/algorithms/iterative/ImplicitlyRestartedLanczos.h +++ b/Grid/algorithms/iterative/ImplicitlyRestartedLanczos.h @@ -43,6 +43,11 @@ NAMESPACE_BEGIN(Grid); template void basisOrthogonalize(std::vector &basis,Field &w,int k) { + // If assume basis[j] are already orthonormal, + // can take all inner products in parallel saving 2x bandwidth + // Save 3x bandwidth on the second line of loop. + // perhaps 2.5x speed up. + // 2x overall in Multigrid Lanczos for(int j=0; j& lmd, @@ -589,6 +594,7 @@ until convergence std::vector& evec, Field& w,int Nm,int k) { + std::cout<0) w -= lme[k-1] * evec[k-1]; - ComplexD zalph = innerProduct(evec_k,w); // 4. αk:=(wk,vk) + ComplexD zalph = innerProduct(evec_k,w); RealD alph = real(zalph); - w = w - alph * evec_k;// 5. wk:=wk−αkvk + w = w - alph * evec_k; - RealD beta = normalise(w); // 6. βk+1 := ∥wk∥2. If βk+1 = 0 then Stop - // 7. vk+1 := wk/βk+1 + RealD beta = normalise(w); lmd[k] = alph; lme[k] = beta; - if (k>0 && k % orth_period == 0) { + if ( (k>0) && ( (k % orth_period) == 0 )) { + std::cout<& lmd, std::vector& lme,