diff --git a/Grid/algorithms/multigrid/Aggregates.h b/Grid/algorithms/multigrid/Aggregates.h index 609903e0..cd6962dd 100644 --- a/Grid/algorithms/multigrid/Aggregates.h +++ b/Grid/algorithms/multigrid/Aggregates.h @@ -32,6 +32,13 @@ Author: paboyle NAMESPACE_BEGIN(Grid); +inline RealD AggregatePowerLaw(RealD x) +{ + // return std::pow(x,-4); + // return std::pow(x,-3); + return std::pow(x,-5); +} + template class Aggregation { public: @@ -246,9 +253,54 @@ public: // Initial matrix element hermop.Op(noise,Mn); if(b==0) std::cout< "< Cheb(lo,hi,orderfilter); Cheb(hermop,noise,Mn); + scale = std::pow(norm2(Mn),-0.5); Mn=Mn*scale; + + // Refine + Chebyshev PowerLaw(lo,hi,1000,AggregatePowerLaw); + noise = Mn; + PowerLaw(hermop,noise,Mn); + scale = std::pow(norm2(Mn),-0.5); Mn=Mn*scale; + + // normalise + subspace[b] = Mn; + hermop.Op(Mn,tmp); + std::cout< "< &hermop, + int nn, + double hi, + int orderfilter + ) { + + RealD scale; + + FineField noise(FineGrid); + FineField Mn(FineGrid); + FineField tmp(FineGrid); + + // New normalised noise + std::cout << GridLogMessage<<" Chebyshev subspace pure noise : ord "< "< Cheb(0.0,hi,orderfilter,AggregatePowerLaw); + Cheb(hermop,noise,Mn); // normalise scale = std::pow(norm2(Mn),-0.5); Mn=Mn*scale; subspace[b] = Mn; @@ -258,5 +310,72 @@ public: } + virtual void CreateSubspaceMultishift(GridParallelRNG &RNG,LinearOperatorBase &hermop, + double Lo,double tol,int maxit) + { + + RealD scale; + + FineField noise(FineGrid); + FineField Mn(FineGrid); + FineField tmp(FineGrid); + + // New normalised noise + std::cout << GridLogMessage<<" Multishift subspace : Lo "< alpha({1.0/6.0,-1.0/2.0,1.0/2.0,-1.0/6.0}); + std::vector shifts({Lo,Lo+epsilon,Lo+2*epsilon,Lo+3*epsilon}); + std::vector tols({tol,tol,tol,tol}); + std::cout << "sizes "< MSCG(maxit,msf); + + for(int b =0;b "< "< &hermop, + double Lo,double tol,int maxit) + { + FineField tmp(FineGrid); + for(int b =0;b CGsloppy(tol,maxit,false); + ShiftedHermOpLinearOperator ShiftedFineHermOp(hermop,MirsShift); + CGsloppy(hermop,subspace[b],tmp); + subspace[b]=tmp; + } + } + + + }; NAMESPACE_END(Grid);