mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-04 05:54:32 +00:00 
			
		
		
		
	Rework the linop support to get different forms of red black schur solver
Moo on diag, or MooInv Moe MeeInv Meo
This commit is contained in:
		@@ -130,7 +130,7 @@ void  TestCGunprec(What & Ddwf,
 | 
			
		||||
  LatticeFermion src   (FGrid); random(*RNG5,src);
 | 
			
		||||
  LatticeFermion result(FGrid); result=zero;
 | 
			
		||||
 | 
			
		||||
  HermitianOperator<What,LatticeFermion> HermOp(Ddwf);
 | 
			
		||||
  MdagMLinearOperator<What,LatticeFermion> HermOp(Ddwf);
 | 
			
		||||
  ConjugateGradient<LatticeFermion> CG(1.0e-8,10000);
 | 
			
		||||
  CG(HermOp,src,result);
 | 
			
		||||
 | 
			
		||||
@@ -149,7 +149,7 @@ void  TestCGprec(What & Ddwf,
 | 
			
		||||
  pickCheckerboard(Odd,src_o,src);
 | 
			
		||||
  result_o=zero;
 | 
			
		||||
 | 
			
		||||
  HermitianCheckerBoardedOperator<What,LatticeFermion> HermOpEO(Ddwf);
 | 
			
		||||
  SchurDiagMooeeOperator<What,LatticeFermion> HermOpEO(Ddwf);
 | 
			
		||||
  ConjugateGradient<LatticeFermion> CG(1.0e-8,10000);
 | 
			
		||||
  CG(HermOpEO,src_o,result_o);
 | 
			
		||||
}
 | 
			
		||||
@@ -167,6 +167,6 @@ void  TestCGschur(What & Ddwf,
 | 
			
		||||
  LatticeFermion result(FGrid); result=zero;
 | 
			
		||||
 | 
			
		||||
  ConjugateGradient<LatticeFermion> CG(1.0e-8,10000);
 | 
			
		||||
  SchurRedBlackSolve<LatticeFermion> SchurSolver(CG);
 | 
			
		||||
  SchurRedBlackDiagMooeeSolve<LatticeFermion> SchurSolver(CG);
 | 
			
		||||
  SchurSolver(Ddwf,src,result);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -214,7 +214,7 @@ void  TestWhat(What & Ddwf,
 | 
			
		||||
  std::cout << "norm diff   "<< norm2(err)<< std::endl;
 | 
			
		||||
 | 
			
		||||
  std::cout<<"=============================================================="<<std::endl;
 | 
			
		||||
  std::cout<<"= Test MpcDagMpc is Hermitian              "<<std::endl;
 | 
			
		||||
  std::cout<<"= Test DiagMoo MpcDagMpc is Hermitian              "<<std::endl;
 | 
			
		||||
  std::cout<<"=============================================================="<<std::endl;
 | 
			
		||||
  
 | 
			
		||||
  random(*RNG5,phi);
 | 
			
		||||
@@ -225,11 +225,12 @@ void  TestWhat(What & Ddwf,
 | 
			
		||||
  pickCheckerboard(Odd ,phi_o,phi);
 | 
			
		||||
  RealD t1,t2;
 | 
			
		||||
 | 
			
		||||
  Ddwf.MpcDagMpc(chi_e,dchi_e,t1,t2);
 | 
			
		||||
  Ddwf.MpcDagMpc(chi_o,dchi_o,t1,t2);
 | 
			
		||||
  SchurDiagMooeeOperator<What,LatticeFermion> HermOpEO(Ddwf);
 | 
			
		||||
  HermOpEO.MpcDagMpc(chi_e,dchi_e,t1,t2);
 | 
			
		||||
  HermOpEO.MpcDagMpc(chi_o,dchi_o,t1,t2);
 | 
			
		||||
 | 
			
		||||
  Ddwf.MpcDagMpc(phi_e,dphi_e,t1,t2);
 | 
			
		||||
  Ddwf.MpcDagMpc(phi_o,dphi_o,t1,t2);
 | 
			
		||||
  HermOpEO.MpcDagMpc(phi_e,dphi_e,t1,t2);
 | 
			
		||||
  HermOpEO.MpcDagMpc(phi_o,dphi_o,t1,t2);
 | 
			
		||||
 | 
			
		||||
  pDce = innerProduct(phi_e,dchi_e);
 | 
			
		||||
  pDco = innerProduct(phi_o,dchi_o);
 | 
			
		||||
 
 | 
			
		||||
@@ -121,7 +121,7 @@ void  TestCGunprec(What & Ddwf,
 | 
			
		||||
  LatticeFermion src   (FGrid); random(*RNG5,src);
 | 
			
		||||
  LatticeFermion result(FGrid); result=zero;
 | 
			
		||||
 | 
			
		||||
  HermitianOperator<What,LatticeFermion> HermOp(Ddwf);
 | 
			
		||||
  MdagMLinearOperator<What,LatticeFermion> HermOp(Ddwf);
 | 
			
		||||
  ConjugateGradient<LatticeFermion> CG(1.0e-8,10000);
 | 
			
		||||
  CG(HermOp,src,result);
 | 
			
		||||
 | 
			
		||||
@@ -140,7 +140,7 @@ void  TestCGprec(What & Ddwf,
 | 
			
		||||
  pickCheckerboard(Odd,src_o,src);
 | 
			
		||||
  result_o=zero;
 | 
			
		||||
 | 
			
		||||
  HermitianCheckerBoardedOperator<What,LatticeFermion> HermOpEO(Ddwf);
 | 
			
		||||
  SchurDiagMooeeOperator<What,LatticeFermion> HermOpEO(Ddwf);
 | 
			
		||||
  ConjugateGradient<LatticeFermion> CG(1.0e-8,10000);
 | 
			
		||||
  CG(HermOpEO,src_o,result_o);
 | 
			
		||||
}
 | 
			
		||||
@@ -158,6 +158,6 @@ void  TestCGschur(What & Ddwf,
 | 
			
		||||
  LatticeFermion result(FGrid); result=zero;
 | 
			
		||||
 | 
			
		||||
  ConjugateGradient<LatticeFermion> CG(1.0e-8,10000);
 | 
			
		||||
  SchurRedBlackSolve<LatticeFermion> SchurSolver(CG);
 | 
			
		||||
  SchurRedBlackDiagMooeeSolve<LatticeFermion> SchurSolver(CG);
 | 
			
		||||
  SchurSolver(Ddwf,src,result);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -211,11 +211,12 @@ void  TestWhat(What & Ddwf,
 | 
			
		||||
  pickCheckerboard(Odd ,phi_o,phi);
 | 
			
		||||
  RealD t1,t2;
 | 
			
		||||
 | 
			
		||||
  Ddwf.MpcDagMpc(chi_e,dchi_e,t1,t2);
 | 
			
		||||
  Ddwf.MpcDagMpc(chi_o,dchi_o,t1,t2);
 | 
			
		||||
 | 
			
		||||
  Ddwf.MpcDagMpc(phi_e,dphi_e,t1,t2);
 | 
			
		||||
  Ddwf.MpcDagMpc(phi_o,dphi_o,t1,t2);
 | 
			
		||||
  SchurDiagMooeeOperator<What,LatticeFermion> HermOpEO(Ddwf);
 | 
			
		||||
  HermOpEO.MpcDagMpc(chi_e,dchi_e,t1,t2);
 | 
			
		||||
  HermOpEO.MpcDagMpc(chi_o,dchi_o,t1,t2);
 | 
			
		||||
  
 | 
			
		||||
  HermOpEO.MpcDagMpc(phi_e,dphi_e,t1,t2);
 | 
			
		||||
  HermOpEO.MpcDagMpc(phi_o,dphi_o,t1,t2);
 | 
			
		||||
 | 
			
		||||
  pDce = innerProduct(phi_e,dchi_e);
 | 
			
		||||
  pDco = innerProduct(phi_o,dchi_o);
 | 
			
		||||
 
 | 
			
		||||
@@ -50,7 +50,7 @@ int main (int argc, char ** argv)
 | 
			
		||||
  pickCheckerboard(Odd,src_o,src);
 | 
			
		||||
  result_o=zero;
 | 
			
		||||
 | 
			
		||||
  HermitianCheckerBoardedOperator<DomainWallFermion,LatticeFermion> HermOpEO(Ddwf);
 | 
			
		||||
  SchurDiagMooeeOperator<DomainWallFermion,LatticeFermion> HermOpEO(Ddwf);
 | 
			
		||||
  ConjugateGradient<LatticeFermion> CG(1.0e-8,10000);
 | 
			
		||||
  CG(HermOpEO,src_o,result_o);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -46,7 +46,7 @@ int main (int argc, char ** argv)
 | 
			
		||||
  DomainWallFermion Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5);
 | 
			
		||||
 | 
			
		||||
  ConjugateGradient<LatticeFermion> CG(1.0e-8,10000);
 | 
			
		||||
  SchurRedBlackSolve<LatticeFermion> SchurSolver(CG);
 | 
			
		||||
  SchurRedBlackDiagMooeeSolve<LatticeFermion> SchurSolver(CG);
 | 
			
		||||
  SchurSolver(Ddwf,src,result);
 | 
			
		||||
 | 
			
		||||
  Grid_finalize();
 | 
			
		||||
 
 | 
			
		||||
@@ -45,7 +45,7 @@ int main (int argc, char ** argv)
 | 
			
		||||
  RealD M5=1.8;
 | 
			
		||||
  DomainWallFermion Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5);
 | 
			
		||||
 | 
			
		||||
  HermitianOperator<DomainWallFermion,LatticeFermion> HermOp(Ddwf);
 | 
			
		||||
  MdagMLinearOperator<DomainWallFermion,LatticeFermion> HermOp(Ddwf);
 | 
			
		||||
  ConjugateGradient<LatticeFermion> CG(1.0e-8,10000);
 | 
			
		||||
  CG(HermOp,src,result);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -186,11 +186,13 @@ int main (int argc, char ** argv)
 | 
			
		||||
  pickCheckerboard(Odd ,phi_o,phi);
 | 
			
		||||
  RealD t1,t2;
 | 
			
		||||
 | 
			
		||||
  Ddwf.MpcDagMpc(chi_e,dchi_e,t1,t2);
 | 
			
		||||
  Ddwf.MpcDagMpc(chi_o,dchi_o,t1,t2);
 | 
			
		||||
 | 
			
		||||
  Ddwf.MpcDagMpc(phi_e,dphi_e,t1,t2);
 | 
			
		||||
  Ddwf.MpcDagMpc(phi_o,dphi_o,t1,t2);
 | 
			
		||||
  SchurDiagMooeeOperator<DomainWallFermion,LatticeFermion> HermOpEO(Ddwf);
 | 
			
		||||
  HermOpEO.MpcDagMpc(chi_e,dchi_e,t1,t2);
 | 
			
		||||
  HermOpEO.MpcDagMpc(chi_o,dchi_o,t1,t2);
 | 
			
		||||
 | 
			
		||||
  HermOpEO.MpcDagMpc(phi_e,dphi_e,t1,t2);
 | 
			
		||||
  HermOpEO.MpcDagMpc(phi_o,dphi_o,t1,t2);
 | 
			
		||||
 | 
			
		||||
  pDce = innerProduct(phi_e,dchi_e);
 | 
			
		||||
  pDco = innerProduct(phi_o,dchi_o);
 | 
			
		||||
 
 | 
			
		||||
@@ -53,7 +53,7 @@ int main (int argc, char ** argv)
 | 
			
		||||
  pickCheckerboard(Odd,src_o,src);
 | 
			
		||||
  result_o=zero;
 | 
			
		||||
 | 
			
		||||
  HermitianCheckerBoardedOperator<WilsonFermion,LatticeFermion> HermOpEO(Dw);
 | 
			
		||||
  SchurDiagMooeeOperator<WilsonFermion,LatticeFermion> HermOpEO(Dw);
 | 
			
		||||
  ConjugateGradient<LatticeFermion> CG(1.0e-8,10000);
 | 
			
		||||
  CG(HermOpEO,src_o,result_o);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -40,7 +40,7 @@ int main (int argc, char ** argv)
 | 
			
		||||
  WilsonFermion Dw(Umu,Grid,RBGrid,mass);
 | 
			
		||||
 | 
			
		||||
  ConjugateGradient<LatticeFermion> CG(1.0e-8,10000);
 | 
			
		||||
  SchurRedBlackSolve<LatticeFermion> SchurSolver(CG);
 | 
			
		||||
  SchurRedBlackDiagMooeeSolve<LatticeFermion> SchurSolver(CG);
 | 
			
		||||
 | 
			
		||||
  SchurSolver(Dw,src,result);
 | 
			
		||||
  
 | 
			
		||||
 
 | 
			
		||||
@@ -49,7 +49,7 @@ int main (int argc, char ** argv)
 | 
			
		||||
  RealD mass=0.5;
 | 
			
		||||
  WilsonFermion Dw(Umu,Grid,RBGrid,mass);
 | 
			
		||||
 | 
			
		||||
  HermitianOperator<WilsonFermion,LatticeFermion> HermOp(Dw);
 | 
			
		||||
  MdagMLinearOperator<WilsonFermion,LatticeFermion> HermOp(Dw);
 | 
			
		||||
  ConjugateGradient<LatticeFermion> CG(1.0e-8,10000);
 | 
			
		||||
  CG(HermOp,src,result);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -177,11 +177,12 @@ int main (int argc, char ** argv)
 | 
			
		||||
  pickCheckerboard(Odd ,phi_o,phi);
 | 
			
		||||
  RealD t1,t2;
 | 
			
		||||
 | 
			
		||||
  Dw.MpcDagMpc(chi_e,dchi_e,t1,t2);
 | 
			
		||||
  Dw.MpcDagMpc(chi_o,dchi_o,t1,t2);
 | 
			
		||||
  SchurDiagMooeeOperator<WilsonFermion,LatticeFermion> HermOpEO(Dw);
 | 
			
		||||
  HermOpEO.MpcDagMpc(chi_e,dchi_e,t1,t2);
 | 
			
		||||
  HermOpEO.MpcDagMpc(chi_o,dchi_o,t1,t2);
 | 
			
		||||
 | 
			
		||||
  Dw.MpcDagMpc(phi_e,dphi_e,t1,t2);
 | 
			
		||||
  Dw.MpcDagMpc(phi_o,dphi_o,t1,t2);
 | 
			
		||||
  HermOpEO.MpcDagMpc(phi_e,dphi_e,t1,t2);
 | 
			
		||||
  HermOpEO.MpcDagMpc(phi_o,dphi_o,t1,t2);
 | 
			
		||||
 | 
			
		||||
  pDce = innerProduct(phi_e,dchi_e);
 | 
			
		||||
  pDco = innerProduct(phi_o,dchi_o);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user