diff --git a/lib/algorithms/iterative/SchurRedBlack.h b/lib/algorithms/iterative/SchurRedBlack.h index 5b43281a..205cb3b0 100644 --- a/lib/algorithms/iterative/SchurRedBlack.h +++ b/lib/algorithms/iterative/SchurRedBlack.h @@ -175,11 +175,8 @@ namespace Grid { ///////////////////////////////////////////////////// // Wrap the usual normal equations Schur trick ///////////////////////////////////////////////////// - SchurRedBlackStagSolve(OperatorFunction &HermitianRBSolver) : - _HermitianRBSolver(HermitianRBSolver) - { - CBfactorise=0; - }; + SchurRedBlackStagSolve(OperatorFunction &HermitianRBSolver, int cb) : + _HermitianRBSolver(HermitianRBSolver), CBfactorise(cb) {} template void operator() (Matrix & _Matrix,const Field &in, Field &out){ @@ -190,6 +187,8 @@ namespace Grid { GridBase *fgrid= _Matrix.Grid(); SchurStagOperator _HermOpEO(_Matrix); + int Schur = CBfactorise; + int Other = 1 - CBfactorise; Field src_e(grid); Field src_o(grid); @@ -199,39 +198,39 @@ namespace Grid { Field Mtmp(grid); Field resid(fgrid); - pickCheckerboard(Even,src_e,in); - pickCheckerboard(Odd ,src_o,in); - pickCheckerboard(Even,sol_e,out); - pickCheckerboard(Odd ,sol_o,out); + pickCheckerboard(Other,src_e,in); + pickCheckerboard(Schur ,src_o,in); + pickCheckerboard(Other,sol_e,out); + pickCheckerboard(Schur ,sol_o,out); ///////////////////////////////////////////////////// // src_o = Mdag * (source_o - Moe MeeInv source_e) ///////////////////////////////////////////////////// - _Matrix.MooeeInv(src_e,tmp); assert( tmp.checkerboard ==Even); - _Matrix.Meooe (tmp,Mtmp); assert( Mtmp.checkerboard ==Odd); - tmp=src_o-Mtmp; assert( tmp.checkerboard ==Odd); + _Matrix.MooeeInv(src_e,tmp); assert( tmp.checkerboard ==Other); + _Matrix.Meooe (tmp,Mtmp); assert( Mtmp.checkerboard ==Schur); + tmp=src_o-Mtmp; assert( tmp.checkerboard ==Schur); #if 0 // get the right MpcDag -// _HermOpEO.MpcDag(tmp,src_o); assert(src_o.checkerboard ==Odd); +// _HermOpEO.MpcDag(tmp,src_o); assert(src_o.checkerboard ==Schur); #else - _Matrix.Mooee(tmp,src_o); assert(src_o.checkerboard ==Odd); + _Matrix.Mooee(tmp,src_o); assert(src_o.checkerboard ==Schur); #endif ////////////////////////////////////////////////////////////// // Call the red-black solver ////////////////////////////////////////////////////////////// std::cout< &HermitianRBSolver) : - _HermitianRBSolver(HermitianRBSolver) - { - CBfactorise=0; - }; + SchurRedBlackStagMixed(LinearFunction &HermitianRBSolver, int cb) : + _HermitianRBSolver(HermitianRBSolver), CBfactorise(cb) {} template void operator() (Matrix & _Matrix,const Field &in, Field &out){ @@ -504,6 +500,8 @@ namespace Grid { GridBase *fgrid= _Matrix.Grid(); SchurStagOperator _HermOpEO(_Matrix); + int Schur = CBfactorise; + int Other = 1 - CBfactorise; Field src_e(grid); Field src_o(grid); @@ -513,35 +511,35 @@ namespace Grid { Field Mtmp(grid); Field resid(fgrid); - pickCheckerboard(Even,src_e,in); - pickCheckerboard(Odd ,src_o,in); - pickCheckerboard(Even,sol_e,out); - pickCheckerboard(Odd ,sol_o,out); + pickCheckerboard(Other,src_e,in); + pickCheckerboard(Schur ,src_o,in); + pickCheckerboard(Other,sol_e,out); + pickCheckerboard(Schur ,sol_o,out); ///////////////////////////////////////////////////// // src_o = Mdag * (source_o - Moe MeeInv source_e) ///////////////////////////////////////////////////// - _Matrix.MooeeInv(src_e,tmp); assert( tmp.checkerboard ==Even); - _Matrix.Meooe (tmp,Mtmp); assert( Mtmp.checkerboard ==Odd); - tmp=src_o-Mtmp; assert( tmp.checkerboard ==Odd); + _Matrix.MooeeInv(src_e,tmp); assert( tmp.checkerboard ==Other); + _Matrix.Meooe (tmp,Mtmp); assert( Mtmp.checkerboard ==Schur); + tmp=src_o-Mtmp; assert( tmp.checkerboard ==Schur); - _Matrix.Mooee(tmp,src_o); assert(src_o.checkerboard ==Odd); + _Matrix.Mooee(tmp,src_o); assert(src_o.checkerboard ==Schur); ////////////////////////////////////////////////////////////// // Call the red-black solver ////////////////////////////////////////////////////////////// std::cout<