diff --git a/Grid/algorithms/iterative/PrecGeneralisedConjugateResidualNonHermitian.h b/Grid/algorithms/iterative/PrecGeneralisedConjugateResidualNonHermitian.h index 181df320..21ac66b9 100644 --- a/Grid/algorithms/iterative/PrecGeneralisedConjugateResidualNonHermitian.h +++ b/Grid/algorithms/iterative/PrecGeneralisedConjugateResidualNonHermitian.h @@ -74,7 +74,7 @@ public: void operator() (const Field &src, Field &psi){ - psi=Zero(); + // psi=Zero(); RealD cp, ssq,rsq; ssq=norm2(src); rsq=Tolerance*Tolerance*ssq; diff --git a/Grid/algorithms/multigrid/Aggregates.h b/Grid/algorithms/multigrid/Aggregates.h index fb708b16..953e3020 100644 --- a/Grid/algorithms/multigrid/Aggregates.h +++ b/Grid/algorithms/multigrid/Aggregates.h @@ -30,6 +30,8 @@ Author: paboyle /* END LEGAL */ #pragma once +#include + NAMESPACE_BEGIN(Grid); inline RealD AggregatePowerLaw(RealD x) @@ -124,6 +126,53 @@ public: } } + virtual void CreateSubspaceGCR(GridParallelRNG &RNG,LinearOperatorBase &DiracOp,int nn=nbasis) + { + RealD scale; + + TrivialPrecon simple_fine; + PrecGeneralisedConjugateResidualNonHermitian GCR(0.001,30,DiracOp,simple_fine,12,12); + FineField noise(FineGrid); + FineField src(FineGrid); + FineField guess(FineGrid); + FineField Mn(FineGrid); + + for(int b=0;b "< "< Cheb(lo,hi,orderfilter); Cheb(hermop,noise,Mn); // normalise scale = std::pow(norm2(Mn),-0.5); Mn=Mn*scale; subspace[b] = Mn; - hermop.Op(Mn,tmp); - std::cout< "< "< "< "< "< "< PVdagM_t; typedef ShiftedPVdagMLinearOperator ShiftedPVdagM_t; PVdagM_t PVdagM(Ddwf,Dpv); - ShiftedPVdagM_t ShiftedPVdagM(2.0,Ddwf,Dpv); + // ShiftedPVdagM_t ShiftedPVdagM(2.0,Ddwf,Dpv); // 355 + // ShiftedPVdagM_t ShiftedPVdagM(1.0,Ddwf,Dpv); // 246 + // ShiftedPVdagM_t ShiftedPVdagM(0.5,Ddwf,Dpv); // 183 + // ShiftedPVdagM_t ShiftedPVdagM(0.25,Ddwf,Dpv); // 145 + // ShiftedPVdagM_t ShiftedPVdagM(0.1,Ddwf,Dpv); // 134 + // ShiftedPVdagM_t ShiftedPVdagM(0.1,Ddwf,Dpv); // 127 -- NULL space via inverse iteration + // ShiftedPVdagM_t ShiftedPVdagM(0.1,Ddwf,Dpv); // 57 -- NULL space via inverse iteration; 3 iterations + // ShiftedPVdagM_t ShiftedPVdagM(0.25,Ddwf,Dpv); // 57 , tighter inversion + // ShiftedPVdagM_t ShiftedPVdagM(0.25,Ddwf,Dpv); // nbasis 20 -- 49 iters + // ShiftedPVdagM_t ShiftedPVdagM(0.25,Ddwf,Dpv); // nbasis 20 -- 70 iters; asymmetric + // ShiftedPVdagM_t ShiftedPVdagM(0.25,Ddwf,Dpv); // 58; Loosen coarse, tighten fine + // ShiftedPVdagM_t ShiftedPVdagM(0.1,Ddwf,Dpv); // 56 ... + // ShiftedPVdagM_t ShiftedPVdagM(0.1,Ddwf,Dpv); // 51 ... with 24 vecs + // ShiftedPVdagM_t ShiftedPVdagM(0.1,Ddwf,Dpv); // 31 ... with 24 vecs and 2^4 blocking + // ShiftedPVdagM_t ShiftedPVdagM(0.1,Ddwf,Dpv); // 43 ... with 16 vecs and 2^4 blocking, sloppier + // ShiftedPVdagM_t ShiftedPVdagM(0.1,Ddwf,Dpv); // 35 ... with 20 vecs and 2^4 blocking + // ShiftedPVdagM_t ShiftedPVdagM(0.1,Ddwf,Dpv); // 35 ... with 20 vecs and 2^4 blocking, looser coarse + // ShiftedPVdagM_t ShiftedPVdagM(0.1,Ddwf,Dpv); // 64 ... with 20 vecs, Christoph setup, and 2^4 blocking, looser coarse + ShiftedPVdagM_t ShiftedPVdagM(0.01,Ddwf,Dpv); // // Run power method on HOA?? @@ -269,6 +293,7 @@ int main (int argc, char ** argv) // Warning: This routine calls PVdagM.Op, not PVdagM.HermOp typedef Aggregation Subspace; Subspace AggregatesPD(Coarse5d,FGrid,cb); + /* AggregatesPD.CreateSubspaceChebyshev(RNG5, PVdagM, nbasis, @@ -278,6 +303,10 @@ int main (int argc, char ** argv) 200, 200, 0.0); + */ + AggregatesPD.CreateSubspaceGCR(RNG5, + PVdagM, + nbasis); LittleDiracOperator LittleDiracOpPV(geom,FGrid,Coarse5d); LittleDiracOpPV.CoarsenOperator(PVdagM,AggregatesPD); @@ -334,12 +363,13 @@ int main (int argc, char ** argv) /////////////////////////////////////// std::cout< simple; NonHermitianLinearOperator LinOpCoarse(LittleDiracOpPV); - PrecGeneralisedConjugateResidualNonHermitian L2PGCR(1.0e-8, 100, LinOpCoarse,simple,10,10); - L2PGCR.Level(2); + // PrecGeneralisedConjugateResidualNonHermitian L2PGCR(1.0e-4, 100, LinOpCoarse,simple,10,10); + PrecGeneralisedConjugateResidualNonHermitian L2PGCR(3.0e-2, 100, LinOpCoarse,simple,10,10); + L2PGCR.Level(3); c_res=Zero(); L2PGCR(c_src,c_res); @@ -347,11 +377,12 @@ int main (int argc, char ** argv) // Fine grid smoother //////////////////////////////////////// std::cout< simple_fine; // NonHermitianLinearOperator LinOpSmooth(PVdagM); - PrecGeneralisedConjugateResidualNonHermitian SmootherGCR(0.01,10,ShiftedPVdagM,simple_fine,4,4); + PrecGeneralisedConjugateResidualNonHermitian SmootherGCR(0.01,1,ShiftedPVdagM,simple_fine,16,16); + SmootherGCR.Level(2); LatticeFermionD f_src(FGrid); LatticeFermionD f_res(FGrid); @@ -364,12 +395,12 @@ int main (int argc, char ** argv) TwoLevelMG TwoLevelPrecon(AggregatesPD, PVdagM, - SmootherGCR, + simple_fine, SmootherGCR, LinOpCoarse, L2PGCR); - PrecGeneralisedConjugateResidualNonHermitian L1PGCR(1.0e-8,1000,PVdagM,TwoLevelPrecon,8,8); + PrecGeneralisedConjugateResidualNonHermitian L1PGCR(1.0e-8,1000,PVdagM,TwoLevelPrecon,16,16); L1PGCR.Level(1); f_res=Zero();