mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-13 01:05:36 +00:00
big commit fixing nocompiles in defective C++11 compilers (gcc, icpc). stared getting to
near the bleeding edge I guess
This commit is contained in:
parent
c20fdd45a5
commit
cd2fb68905
@ -53,7 +53,7 @@ int main (int argc, char ** argv)
|
|||||||
readNerscConfiguration(Umu,header,file);
|
readNerscConfiguration(Umu,header,file);
|
||||||
|
|
||||||
for(int mu=0;mu<Nd;mu++){
|
for(int mu=0;mu<Nd;mu++){
|
||||||
U[mu] = peekIndex<3>(Umu,mu);
|
U[mu] = PeekIndex<LorentzIndex>(Umu,mu);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Painful ; fix syntactical niceness : to check reader
|
// Painful ; fix syntactical niceness : to check reader
|
||||||
|
@ -41,7 +41,7 @@ int main (int argc, char ** argv)
|
|||||||
|
|
||||||
std::vector<LatticeColourMatrix> U(4,UGrid);
|
std::vector<LatticeColourMatrix> U(4,UGrid);
|
||||||
for(int mu=0;mu<Nd;mu++){
|
for(int mu=0;mu<Nd;mu++){
|
||||||
U[mu] = peekIndex<LorentzIndex>(Umu,mu);
|
U[mu] = PeekIndex<LorentzIndex>(Umu,mu);
|
||||||
}
|
}
|
||||||
|
|
||||||
RealD mass=0.1;
|
RealD mass=0.1;
|
||||||
|
@ -38,7 +38,7 @@ int main (int argc, char ** argv)
|
|||||||
|
|
||||||
std::vector<LatticeColourMatrix> U(4,UGrid);
|
std::vector<LatticeColourMatrix> U(4,UGrid);
|
||||||
for(int mu=0;mu<Nd;mu++){
|
for(int mu=0;mu<Nd;mu++){
|
||||||
U[mu] = peekIndex<LorentzIndex>(Umu,mu);
|
U[mu] = PeekIndex<LorentzIndex>(Umu,mu);
|
||||||
}
|
}
|
||||||
|
|
||||||
RealD mass=0.1;
|
RealD mass=0.1;
|
||||||
|
@ -38,7 +38,7 @@ int main (int argc, char ** argv)
|
|||||||
|
|
||||||
std::vector<LatticeColourMatrix> U(4,UGrid);
|
std::vector<LatticeColourMatrix> U(4,UGrid);
|
||||||
for(int mu=0;mu<Nd;mu++){
|
for(int mu=0;mu<Nd;mu++){
|
||||||
U[mu] = peekIndex<LorentzIndex>(Umu,mu);
|
U[mu] = PeekIndex<LorentzIndex>(Umu,mu);
|
||||||
}
|
}
|
||||||
|
|
||||||
RealD mass=0.1;
|
RealD mass=0.1;
|
||||||
|
@ -38,7 +38,7 @@ int main (int argc, char ** argv)
|
|||||||
|
|
||||||
std::vector<LatticeColourMatrix> U(4,UGrid);
|
std::vector<LatticeColourMatrix> U(4,UGrid);
|
||||||
for(int mu=0;mu<Nd;mu++){
|
for(int mu=0;mu<Nd;mu++){
|
||||||
U[mu] = peekIndex<LorentzIndex>(Umu,mu);
|
U[mu] = PeekIndex<LorentzIndex>(Umu,mu);
|
||||||
}
|
}
|
||||||
|
|
||||||
RealD mass=0.1;
|
RealD mass=0.1;
|
||||||
|
@ -38,7 +38,7 @@ int main (int argc, char ** argv)
|
|||||||
|
|
||||||
std::vector<LatticeColourMatrix> U(4,UGrid);
|
std::vector<LatticeColourMatrix> U(4,UGrid);
|
||||||
for(int mu=0;mu<Nd;mu++){
|
for(int mu=0;mu<Nd;mu++){
|
||||||
U[mu] = peekIndex<LorentzIndex>(Umu,mu);
|
U[mu] = PeekIndex<LorentzIndex>(Umu,mu);
|
||||||
}
|
}
|
||||||
|
|
||||||
RealD mass=0.1;
|
RealD mass=0.1;
|
||||||
|
@ -43,7 +43,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<LatticeColourMatrix> U(4,UGrid);
|
std::vector<LatticeColourMatrix> U(4,UGrid);
|
||||||
|
|
||||||
for(int mu=0;mu<Nd;mu++){
|
for(int mu=0;mu<Nd;mu++){
|
||||||
U[mu] = peekIndex<LorentzIndex>(Umu,mu);
|
U[mu] = PeekIndex<LorentzIndex>(Umu,mu);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConjugateResidual<LatticeFermion> MCR(1.0e-8,10000);
|
ConjugateResidual<LatticeFermion> MCR(1.0e-8,10000);
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
#include <Grid.h>
|
#include <Grid.h>
|
||||||
#include <algorithms/iterative/PrecGeneralisedConjugateResidual.h>
|
#include <algorithms/iterative/PrecGeneralisedConjugateResidual.h>
|
||||||
|
#include <algorithms/iterative/PrecConjugateResidual.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace Grid;
|
using namespace Grid;
|
||||||
using namespace Grid::QCD;
|
using namespace Grid::QCD;
|
||||||
|
|
||||||
template<class Fobj,class CComplex,int nbasis>
|
template<class Fobj,class CComplex,int nbasis, class Matrix>
|
||||||
class MultiGridPreconditioner : public LinearFunction< Lattice<Fobj> > {
|
class MultiGridPreconditioner : public LinearFunction< Lattice<Fobj> > {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -21,19 +22,22 @@ public:
|
|||||||
|
|
||||||
Aggregates & _Aggregates;
|
Aggregates & _Aggregates;
|
||||||
CoarseOperator & _CoarseOperator;
|
CoarseOperator & _CoarseOperator;
|
||||||
|
Matrix & _Matrix;
|
||||||
FineOperator & _FineOperator;
|
FineOperator & _FineOperator;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
MultiGridPreconditioner(Aggregates &Agg, CoarseOperator &Coarse, FineOperator &Fine)
|
MultiGridPreconditioner(Aggregates &Agg, CoarseOperator &Coarse, FineOperator &Fine,Matrix &FineMatrix)
|
||||||
: _Aggregates(Agg),
|
: _Aggregates(Agg),
|
||||||
_CoarseOperator(Coarse),
|
_CoarseOperator(Coarse),
|
||||||
_FineOperator(Fine)
|
_FineOperator(Fine),
|
||||||
|
_Matrix(FineMatrix)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
void operator()(const FineField &in, FineField & out) {
|
void operator()(const FineField &in, FineField & out) {
|
||||||
|
|
||||||
FineField Min(in._grid);
|
FineField Min(in._grid);
|
||||||
|
FineField tmp(in._grid);
|
||||||
|
|
||||||
CoarseVector Csrc(_CoarseOperator.Grid());
|
CoarseVector Csrc(_CoarseOperator.Grid());
|
||||||
CoarseVector Ctmp(_CoarseOperator.Grid());
|
CoarseVector Ctmp(_CoarseOperator.Grid());
|
||||||
@ -44,17 +48,40 @@ public:
|
|||||||
_Aggregates.PromoteFromSubspace(Csrc,out);
|
_Aggregates.PromoteFromSubspace(Csrc,out);
|
||||||
std::cout<<"Completeness: "<<std::sqrt(norm2(out)/norm2(in))<<std::endl;
|
std::cout<<"Completeness: "<<std::sqrt(norm2(out)/norm2(in))<<std::endl;
|
||||||
|
|
||||||
ConjugateResidual<FineField> MCR(1.0e-2,1000);
|
// Build some solvers
|
||||||
ConjugateGradient<CoarseVector> CG(1.0e-2,10000);
|
ConjugateGradient<FineField> fCG(1.0e-1,1000);
|
||||||
|
ConjugateGradient<CoarseVector> CG(1.0e-8,100000);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
// ADEF2: [PTM+Q] in = [1 - Q A] M in + Q in = Min + Q [ in -A Min]
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// [PTM+Q] in = [1 - Q A] M in + Q in = Min + Q [ in -A Min]
|
|
||||||
// Smoothing step, followed by coarse grid correction
|
// Smoothing step, followed by coarse grid correction
|
||||||
|
MdagMLinearOperator<Matrix,FineField> MdagMOp(_Matrix);
|
||||||
|
|
||||||
MCR(_FineOperator,in,Min);
|
Min=in;
|
||||||
_FineOperator.Op(Min,out);
|
std::cout<< " Preconditioner in " << norm2(in)<<std::endl;
|
||||||
out = in -out; // out = in - A Min
|
_FineOperator.AdjOp(Min,tmp);
|
||||||
|
std::cout<< " Preconditioner tmp " << norm2(in)<<std::endl;
|
||||||
|
|
||||||
MdagMLinearOperator<CoarseOperator,CoarseVector> MdagMOp(_CoarseOperator);
|
fCG(MdagMOp,tmp,out);
|
||||||
|
|
||||||
|
_FineOperator.Op(out,tmp);
|
||||||
|
|
||||||
|
std::cout<< " Preconditioner in " << norm2(in)<<std::endl;
|
||||||
|
std::cout<< " Preconditioner out " << norm2(out)<<std::endl;
|
||||||
|
std::cout<< " Preconditioner Aout" << norm2(tmp)<<std::endl;
|
||||||
|
|
||||||
|
tmp = tmp - in;
|
||||||
|
|
||||||
|
std::cout<<"preconditioner thinks residual is "<<std::sqrt(norm2(tmp)/norm2(in))<<std::endl;
|
||||||
|
|
||||||
|
/*
|
||||||
|
// _FineOperator.Op(Min,out);
|
||||||
|
// out = in -out; // out = in - A Min
|
||||||
|
out = in;
|
||||||
|
|
||||||
|
MdagMLinearOperator<CoarseOperator,CoarseVector> MdagMOp(_CoarseOperator);
|
||||||
HermitianLinearOperator<CoarseOperator,CoarseVector> HermOp(_CoarseOperator);
|
HermitianLinearOperator<CoarseOperator,CoarseVector> HermOp(_CoarseOperator);
|
||||||
Csol=zero;
|
Csol=zero;
|
||||||
_Aggregates.ProjectToSubspace (Csrc,out);
|
_Aggregates.ProjectToSubspace (Csrc,out);
|
||||||
@ -63,6 +90,121 @@ public:
|
|||||||
_Aggregates.PromoteFromSubspace(Csol,out);
|
_Aggregates.PromoteFromSubspace(Csol,out);
|
||||||
|
|
||||||
out = Min + out;;
|
out = Min + out;;
|
||||||
|
*/
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
// ADEF2: [PTM+Q] in = [1 - Q A] M in + Q in = Min + Q [ in -A Min]
|
||||||
|
// ADEF1: [MP+Q ] in =M [1 - A Q] in + Q in
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
#if 0
|
||||||
|
void operator()(const FineField &in, FineField & out) {
|
||||||
|
|
||||||
|
CoarseVector Csrc(_CoarseOperator.Grid());
|
||||||
|
CoarseVector Ctmp(_CoarseOperator.Grid());
|
||||||
|
CoarseVector Csol(_CoarseOperator.Grid());
|
||||||
|
|
||||||
|
ConjugateGradient<CoarseVector> CG(1.0e-10,100000);
|
||||||
|
ConjugateGradient<FineField> fCG(3.0e-2,1000);
|
||||||
|
|
||||||
|
HermitianLinearOperator<CoarseOperator,CoarseVector> HermOp(_CoarseOperator);
|
||||||
|
MdagMLinearOperator<CoarseOperator,CoarseVector> MdagMOp(_CoarseOperator);
|
||||||
|
MdagMLinearOperator<Matrix,FineField> fMdagMOp(_Matrix);
|
||||||
|
|
||||||
|
FineField tmp(in._grid);
|
||||||
|
FineField res(in._grid);
|
||||||
|
FineField Min(in._grid);
|
||||||
|
|
||||||
|
// Monitor completeness of low mode space
|
||||||
|
_Aggregates.ProjectToSubspace (Csrc,in);
|
||||||
|
_Aggregates.PromoteFromSubspace(Csrc,out);
|
||||||
|
std::cout<<"Coarse Grid Preconditioner\nCompleteness in: "<<std::sqrt(norm2(out)/norm2(in))<<std::endl;
|
||||||
|
|
||||||
|
// [PTM+Q] in = [1 - Q A] M in + Q in = Min + Q [ in -A Min]
|
||||||
|
_FineOperator.Op(in,tmp);// this is the G5 herm bit
|
||||||
|
fCG(fMdagMOp,tmp,Min); // solves MdagM = g5 M g5M
|
||||||
|
|
||||||
|
// Monitor completeness of low mode space
|
||||||
|
_Aggregates.ProjectToSubspace (Csrc,Min);
|
||||||
|
_Aggregates.PromoteFromSubspace(Csrc,out);
|
||||||
|
std::cout<<"Completeness Min: "<<std::sqrt(norm2(out)/norm2(Min))<<std::endl;
|
||||||
|
|
||||||
|
_FineOperator.Op(Min,tmp);
|
||||||
|
tmp = in - tmp; // in - A Min
|
||||||
|
|
||||||
|
Csol=zero;
|
||||||
|
_Aggregates.ProjectToSubspace (Csrc,tmp);
|
||||||
|
HermOp.AdjOp(Csrc,Ctmp);// Normal equations
|
||||||
|
CG(MdagMOp,Ctmp,Csol);
|
||||||
|
|
||||||
|
HermOp.Op(Csol,Ctmp);
|
||||||
|
Ctmp=Ctmp-Csrc;
|
||||||
|
std::cout<<"coarse space true residual "<<std::sqrt(norm2(Ctmp)/norm2(Csrc))<<std::endl;
|
||||||
|
_Aggregates.PromoteFromSubspace(Csol,out);
|
||||||
|
|
||||||
|
_FineOperator.Op(out,res);
|
||||||
|
res=res-tmp;
|
||||||
|
std::cout<<"promoted sol residual "<<std::sqrt(norm2(res)/norm2(tmp))<<std::endl;
|
||||||
|
_Aggregates.ProjectToSubspace (Csrc,res);
|
||||||
|
std::cout<<"coarse space proj of residual "<<norm2(Csrc)<<std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
out = out+Min; // additive coarse space correction
|
||||||
|
// out = Min; // no additive coarse space correction
|
||||||
|
|
||||||
|
_FineOperator.Op(out,tmp);
|
||||||
|
tmp=tmp-in; // tmp is new residual
|
||||||
|
|
||||||
|
std::cout<< " Preconditioner in " << norm2(in)<<std::endl;
|
||||||
|
std::cout<< " Preconditioner out " << norm2(out)<<std::endl;
|
||||||
|
std::cout<<"preconditioner thinks residual is "<<std::sqrt(norm2(tmp)/norm2(in))<<std::endl;
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
// ADEF1: [MP+Q ] in =M [1 - A Q] in + Q in
|
||||||
|
void operator()(const FineField &in, FineField & out) {
|
||||||
|
|
||||||
|
CoarseVector Csrc(_CoarseOperator.Grid());
|
||||||
|
CoarseVector Ctmp(_CoarseOperator.Grid());
|
||||||
|
CoarseVector Csol(_CoarseOperator.Grid()); Csol=zero;
|
||||||
|
|
||||||
|
ConjugateGradient<CoarseVector> CG(1.0e-10,100000);
|
||||||
|
ConjugateGradient<FineField> fCG(1.0e-3,1000);
|
||||||
|
|
||||||
|
HermitianLinearOperator<CoarseOperator,CoarseVector> HermOp(_CoarseOperator);
|
||||||
|
MdagMLinearOperator<CoarseOperator,CoarseVector> MdagMOp(_CoarseOperator);
|
||||||
|
MdagMLinearOperator<Matrix,FineField> fMdagMOp(_Matrix);
|
||||||
|
|
||||||
|
FineField tmp(in._grid);
|
||||||
|
FineField res(in._grid);
|
||||||
|
FineField Qin(in._grid);
|
||||||
|
|
||||||
|
// Monitor completeness of low mode space
|
||||||
|
// _Aggregates.ProjectToSubspace (Csrc,in);
|
||||||
|
// _Aggregates.PromoteFromSubspace(Csrc,out);
|
||||||
|
// std::cout<<"Coarse Grid Preconditioner\nCompleteness in: "<<std::sqrt(norm2(out)/norm2(in))<<std::endl;
|
||||||
|
|
||||||
|
_Aggregates.ProjectToSubspace (Csrc,in);
|
||||||
|
HermOp.AdjOp(Csrc,Ctmp);// Normal equations
|
||||||
|
CG(MdagMOp,Ctmp,Csol);
|
||||||
|
_Aggregates.PromoteFromSubspace(Csol,Qin);
|
||||||
|
|
||||||
|
|
||||||
|
_FineOperator.Op(Qin,tmp);// A Q in
|
||||||
|
tmp = in - tmp; // in - A Q in
|
||||||
|
|
||||||
|
_FineOperator.Op(tmp,res);// this is the G5 herm bit
|
||||||
|
fCG(fMdagMOp,res,out); // solves MdagM = g5 M g5M
|
||||||
|
|
||||||
|
out = out + Qin;
|
||||||
|
|
||||||
|
_FineOperator.Op(out,tmp);
|
||||||
|
tmp=tmp-in; // tmp is new residual
|
||||||
|
|
||||||
|
std::cout<<"preconditioner thinks residual is "<<std::sqrt(norm2(tmp)/norm2(in))<<std::endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -73,7 +215,7 @@ int main (int argc, char ** argv)
|
|||||||
|
|
||||||
const int Ls=8;
|
const int Ls=8;
|
||||||
|
|
||||||
GridCartesian * UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplexF::Nsimd()),GridDefaultMpi());
|
GridCartesian * UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi());
|
||||||
GridRedBlackCartesian * UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid);
|
GridRedBlackCartesian * UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid);
|
||||||
|
|
||||||
GridCartesian * FGrid = SpaceTimeGrid::makeFiveDimGrid(Ls,UGrid);
|
GridCartesian * FGrid = SpaceTimeGrid::makeFiveDimGrid(Ls,UGrid);
|
||||||
@ -82,11 +224,12 @@ int main (int argc, char ** argv)
|
|||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
// Construct a coarsened grid; utility for this?
|
// Construct a coarsened grid; utility for this?
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
|
const int block=4;
|
||||||
std::vector<int> clatt = GridDefaultLatt();
|
std::vector<int> clatt = GridDefaultLatt();
|
||||||
for(int d=0;d<clatt.size();d++){
|
for(int d=0;d<clatt.size();d++){
|
||||||
clatt[d] = clatt[d]/4;
|
clatt[d] = clatt[d]/block;
|
||||||
}
|
}
|
||||||
GridCartesian *Coarse4d = SpaceTimeGrid::makeFourDimGrid(clatt, GridDefaultSimd(Nd,vComplexF::Nsimd()),GridDefaultMpi());;
|
GridCartesian *Coarse4d = SpaceTimeGrid::makeFourDimGrid(clatt, GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi());;
|
||||||
GridCartesian *Coarse5d = SpaceTimeGrid::makeFiveDimGrid(1,Coarse4d);
|
GridCartesian *Coarse5d = SpaceTimeGrid::makeFiveDimGrid(1,Coarse4d);
|
||||||
|
|
||||||
std::vector<int> seeds4({1,2,3,4});
|
std::vector<int> seeds4({1,2,3,4});
|
||||||
@ -96,7 +239,9 @@ int main (int argc, char ** argv)
|
|||||||
GridParallelRNG RNG4(UGrid); RNG4.SeedFixedIntegers(seeds4);
|
GridParallelRNG RNG4(UGrid); RNG4.SeedFixedIntegers(seeds4);
|
||||||
GridParallelRNG CRNG(Coarse5d);CRNG.SeedFixedIntegers(cseeds);
|
GridParallelRNG CRNG(Coarse5d);CRNG.SeedFixedIntegers(cseeds);
|
||||||
|
|
||||||
LatticeFermion src(FGrid); gaussian(RNG5,src);
|
Gamma g5(Gamma::Gamma5);
|
||||||
|
|
||||||
|
LatticeFermion src(FGrid); gaussian(RNG5,src);// src=src+g5*src;
|
||||||
LatticeFermion result(FGrid); result=zero;
|
LatticeFermion result(FGrid); result=zero;
|
||||||
LatticeFermion ref(FGrid); ref=zero;
|
LatticeFermion ref(FGrid); ref=zero;
|
||||||
LatticeFermion tmp(FGrid);
|
LatticeFermion tmp(FGrid);
|
||||||
@ -112,7 +257,7 @@ int main (int argc, char ** argv)
|
|||||||
// SU3::HotConfiguration(RNG4,Umu);
|
// SU3::HotConfiguration(RNG4,Umu);
|
||||||
// Umu=zero;
|
// Umu=zero;
|
||||||
|
|
||||||
RealD mass=0.04;
|
RealD mass=0.01;
|
||||||
RealD M5=1.8;
|
RealD M5=1.8;
|
||||||
|
|
||||||
std::cout << "**************************************************"<< std::endl;
|
std::cout << "**************************************************"<< std::endl;
|
||||||
@ -120,7 +265,7 @@ int main (int argc, char ** argv)
|
|||||||
std::cout << "**************************************************"<< std::endl;
|
std::cout << "**************************************************"<< std::endl;
|
||||||
DomainWallFermion Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5);
|
DomainWallFermion Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5);
|
||||||
|
|
||||||
const int nbasis = 4;
|
const int nbasis = 6;
|
||||||
|
|
||||||
typedef Aggregation<vSpinColourVector,vTComplex,nbasis> Subspace;
|
typedef Aggregation<vSpinColourVector,vTComplex,nbasis> Subspace;
|
||||||
typedef CoarsenedMatrix<vSpinColourVector,vTComplex,nbasis> CoarseOperator;
|
typedef CoarsenedMatrix<vSpinColourVector,vTComplex,nbasis> CoarseOperator;
|
||||||
@ -132,7 +277,12 @@ int main (int argc, char ** argv)
|
|||||||
MdagMLinearOperator<DomainWallFermion,LatticeFermion> HermDefOp(Ddwf);
|
MdagMLinearOperator<DomainWallFermion,LatticeFermion> HermDefOp(Ddwf);
|
||||||
Subspace Aggregates(Coarse5d,FGrid);
|
Subspace Aggregates(Coarse5d,FGrid);
|
||||||
Aggregates.CreateSubspace(RNG5,HermDefOp);
|
Aggregates.CreateSubspace(RNG5,HermDefOp);
|
||||||
|
// for(int i=0;i<nbasis;i++){
|
||||||
|
// result = Aggregates.subspace[i];
|
||||||
|
// Aggregates.subspace[i]=result+g5*result;
|
||||||
|
// }
|
||||||
|
result=zero;
|
||||||
|
|
||||||
std::cout << "**************************************************"<< std::endl;
|
std::cout << "**************************************************"<< std::endl;
|
||||||
std::cout << "Building coarse representation of Indef operator" <<std::endl;
|
std::cout << "Building coarse representation of Indef operator" <<std::endl;
|
||||||
std::cout << "**************************************************"<< std::endl;
|
std::cout << "**************************************************"<< std::endl;
|
||||||
@ -152,33 +302,41 @@ int main (int argc, char ** argv)
|
|||||||
std::cout << "Solving posdef-CG on coarse space "<< std::endl;
|
std::cout << "Solving posdef-CG on coarse space "<< std::endl;
|
||||||
std::cout << "**************************************************"<< std::endl;
|
std::cout << "**************************************************"<< std::endl;
|
||||||
MdagMLinearOperator<CoarseOperator,CoarseVector> PosdefLdop(LDOp);
|
MdagMLinearOperator<CoarseOperator,CoarseVector> PosdefLdop(LDOp);
|
||||||
ConjugateGradient<CoarseVector> CG(1.0e-6,10000);
|
ConjugateGradient<CoarseVector> CG(1.0e-6,100000);
|
||||||
CG(PosdefLdop,c_src,c_res);
|
CG(PosdefLdop,c_src,c_res);
|
||||||
|
|
||||||
std::cout << "**************************************************"<< std::endl;
|
// std::cout << "**************************************************"<< std::endl;
|
||||||
std::cout << "Solving indef-MCR on coarse space "<< std::endl;
|
// std::cout << "Solving indef-MCR on coarse space "<< std::endl;
|
||||||
std::cout << "**************************************************"<< std::endl;
|
// std::cout << "**************************************************"<< std::endl;
|
||||||
HermitianLinearOperator<CoarseOperator,CoarseVector> HermIndefLdop(LDOp);
|
// HermitianLinearOperator<CoarseOperator,CoarseVector> HermIndefLdop(LDOp);
|
||||||
ConjugateResidual<CoarseVector> MCR(1.0e-6,10000);
|
// ConjugateResidual<CoarseVector> MCR(1.0e-6,100000);
|
||||||
//MCR(HermIndefLdop,c_src,c_res);
|
//MCR(HermIndefLdop,c_src,c_res);
|
||||||
|
|
||||||
std::cout << "**************************************************"<< std::endl;
|
std::cout << "**************************************************"<< std::endl;
|
||||||
std::cout << "Building deflation preconditioner "<< std::endl;
|
std::cout << "Building deflation preconditioner "<< std::endl;
|
||||||
std::cout << "**************************************************"<< std::endl;
|
std::cout << "**************************************************"<< std::endl;
|
||||||
|
|
||||||
MultiGridPreconditioner <vSpinColourVector,vTComplex,nbasis> Precon(Aggregates, LDOp,HermIndefOp);
|
MultiGridPreconditioner <vSpinColourVector,vTComplex,nbasis,DomainWallFermion> Precon(Aggregates, LDOp,HermIndefOp,Ddwf);
|
||||||
|
TrivialPrecon<LatticeFermion> simple;
|
||||||
|
|
||||||
std::cout << "**************************************************"<< std::endl;
|
std::cout << "**************************************************"<< std::endl;
|
||||||
std::cout << "Building a one level PGCR "<< std::endl;
|
std::cout << "Unprec CG "<< std::endl;
|
||||||
std::cout << "**************************************************"<< std::endl;
|
std::cout << "**************************************************"<< std::endl;
|
||||||
TrivialPrecon<LatticeFermion> simple;
|
// TrivialPrecon<LatticeFermion> simple;
|
||||||
PrecGeneralisedConjugateResidual<LatticeFermion> GCR(1.0e-6,10000,simple,8,64);
|
ConjugateGradient<LatticeFermion> fCG(1.0e-8,100000);
|
||||||
GCR(HermIndefOp,src,result);
|
fCG(HermDefOp,src,result);
|
||||||
|
|
||||||
|
std::cout << "**************************************************"<< std::endl;
|
||||||
|
std::cout << "Testing GCR on indef matrix "<< std::endl;
|
||||||
|
std::cout << "**************************************************"<< std::endl;
|
||||||
|
// PrecGeneralisedConjugateResidual<LatticeFermion> UPGCR(1.0e-8,100000,simple,8,128);
|
||||||
|
// UPGCR(HermIndefOp,src,result);
|
||||||
|
|
||||||
std::cout << "**************************************************"<< std::endl;
|
std::cout << "**************************************************"<< std::endl;
|
||||||
std::cout << "Building a two level PGCR "<< std::endl;
|
std::cout << "Building a two level PGCR "<< std::endl;
|
||||||
std::cout << "**************************************************"<< std::endl;
|
std::cout << "**************************************************"<< std::endl;
|
||||||
PrecGeneralisedConjugateResidual<LatticeFermion> PGCR(1.0e-6,10000,Precon,8,64);
|
PrecGeneralisedConjugateResidual<LatticeFermion> PGCR(1.0e-8,100000,Precon,8,128);
|
||||||
|
std::cout<<"checking norm src "<<norm2(src)<<std::endl;
|
||||||
PGCR(HermIndefOp,src,result);
|
PGCR(HermIndefOp,src,result);
|
||||||
|
|
||||||
std::cout << "**************************************************"<< std::endl;
|
std::cout << "**************************************************"<< std::endl;
|
||||||
|
@ -73,13 +73,13 @@ int main (int argc, char ** argv)
|
|||||||
for(int j=0;j<Ns;j++){
|
for(int j=0;j<Ns;j++){
|
||||||
if ( abs(result()(i,j)())==0 ) {
|
if ( abs(result()(i,j)())==0 ) {
|
||||||
std::cout<< " 0";
|
std::cout<< " 0";
|
||||||
} else if ( abs(result()(i,j)() - ComplexF(0,1))==0){
|
} else if ( abs(result()(i,j)() - Complex(0,1))==0){
|
||||||
std::cout<< " i";
|
std::cout<< " i";
|
||||||
} else if ( abs(result()(i,j)() + ComplexF(0,1))==0){
|
} else if ( abs(result()(i,j)() + Complex(0,1))==0){
|
||||||
std::cout<< "-i";
|
std::cout<< "-i";
|
||||||
} else if ( abs(result()(i,j)() - ComplexF(1,0))==0){
|
} else if ( abs(result()(i,j)() - Complex(1,0))==0){
|
||||||
std::cout<< " 1";
|
std::cout<< " 1";
|
||||||
} else if ( abs(result()(i,j)() + ComplexF(1,0))==0){
|
} else if ( abs(result()(i,j)() + Complex(1,0))==0){
|
||||||
std::cout<< "-1";
|
std::cout<< "-1";
|
||||||
}
|
}
|
||||||
std::cout<< ((j==Ns-1) ? ")" : "," );
|
std::cout<< ((j==Ns-1) ? ")" : "," );
|
||||||
|
@ -141,13 +141,13 @@ int main (int argc, char ** argv)
|
|||||||
// rscalar=real(scalar);
|
// rscalar=real(scalar);
|
||||||
// iscalar=imag(scalar);
|
// iscalar=imag(scalar);
|
||||||
// scalar =cmplx(rscalar,iscalar);
|
// scalar =cmplx(rscalar,iscalar);
|
||||||
pokeIndex<1>(cVec,scalar,1);
|
pokeIndex<2>(cVec,scalar,1);
|
||||||
|
|
||||||
|
|
||||||
scalar=transpose(scalar);
|
scalar=transpose(scalar);
|
||||||
scalar=transposeIndex<1>(scalar);
|
scalar=TransposeIndex<ColourIndex>(scalar);
|
||||||
scalar=traceIndex<1>(scalar);
|
scalar=TraceIndex<SpinIndex>(scalar);
|
||||||
scalar=peekIndex<1>(cVec,0);
|
scalar=PeekIndex<ColourIndex>(cVec,0);
|
||||||
|
|
||||||
scalar=trace(scalar);
|
scalar=trace(scalar);
|
||||||
scalar=localInnerProduct(cVec,cVec);
|
scalar=localInnerProduct(cVec,cVec);
|
||||||
@ -230,8 +230,8 @@ int main (int argc, char ** argv)
|
|||||||
cm = ProjectOnGroup(cm);
|
cm = ProjectOnGroup(cm);
|
||||||
std::cout << cm << " " << std::endl;
|
std::cout << cm << " " << std::endl;
|
||||||
|
|
||||||
det = Determinant(cm);
|
// det = Determinant(cm);
|
||||||
std::cout << "determinant: " << det << std::endl;
|
// std::cout << "determinant: " << det << std::endl;
|
||||||
|
|
||||||
|
|
||||||
// Foo = Foo+scalar; // LatticeColourMatrix+Scalar
|
// Foo = Foo+scalar; // LatticeColourMatrix+Scalar
|
||||||
@ -257,16 +257,16 @@ int main (int argc, char ** argv)
|
|||||||
SpinMatrix s_m;
|
SpinMatrix s_m;
|
||||||
SpinColourMatrix sc_m;
|
SpinColourMatrix sc_m;
|
||||||
|
|
||||||
s_m = traceIndex<1>(sc_m); // Map to traceColour
|
s_m = TensorIndexRecursion<ColourIndex>::traceIndex(sc_m); // Map to traceColour
|
||||||
c_m = traceIndex<2>(sc_m); // map to traceSpin
|
c_m = TensorIndexRecursion<SpinIndex>::traceIndex(sc_m); // map to traceSpin
|
||||||
|
|
||||||
c = traceIndex<2>(s_m);
|
c = TensorIndexRecursion<SpinIndex>::traceIndex(s_m);
|
||||||
c = traceIndex<1>(c_m);
|
c = TensorIndexRecursion<ColourIndex>::traceIndex(c_m);
|
||||||
|
|
||||||
s_m = peekIndex<1>(scm,0,0);
|
s_m = TensorIndexRecursion<ColourIndex>::peekIndex(scm,0,0);
|
||||||
c_m = peekIndex<2>(scm,1,2);
|
c_m = TensorIndexRecursion<SpinIndex>::peekIndex(scm,1,2);
|
||||||
// c_m = peekSpin<SpinColourMatrix>(scm,1,2);
|
// c_m = peekSpin<SpinColourMatrix>(scm,1,2);
|
||||||
c_m = peekIdiot<SpinColourMatrix>(scm,1,2);
|
// c_m = peekIdiot<SpinColourMatrix>(scm,1,2);
|
||||||
|
|
||||||
printf("c. Level %d\n",c_m.TensorLevel);
|
printf("c. Level %d\n",c_m.TensorLevel);
|
||||||
printf("c. Level %d\n",c_m().TensorLevel);
|
printf("c. Level %d\n",c_m().TensorLevel);
|
||||||
@ -277,7 +277,7 @@ int main (int argc, char ** argv)
|
|||||||
c = scm()(1,1)(1,2);
|
c = scm()(1,1)(1,2);
|
||||||
scm()(1,1)(2,1) = c;
|
scm()(1,1)(2,1) = c;
|
||||||
|
|
||||||
pokeIndex<1> (c_m,c,0,0);
|
pokeIndex<ColourIndex> (c_m,c,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
FooBar = Bar;
|
FooBar = Bar;
|
||||||
@ -346,7 +346,7 @@ int main (int argc, char ** argv)
|
|||||||
|
|
||||||
LatticeGaugeField U(&Fine);
|
LatticeGaugeField U(&Fine);
|
||||||
// LatticeColourMatrix Uy = peekLorentz(U,1);
|
// LatticeColourMatrix Uy = peekLorentz(U,1);
|
||||||
LatticeColourMatrix Uy = peekDumKopf(U,1);
|
// LatticeColourMatrix Uy = peekDumKopf(U,1);
|
||||||
|
|
||||||
flops = ncall*1.0*volume*(8*Nc*Nc*Nc);
|
flops = ncall*1.0*volume*(8*Nc*Nc*Nc);
|
||||||
bytes = ncall*1.0*volume*Nc*Nc *2*3*sizeof(Grid::Real);
|
bytes = ncall*1.0*volume*Nc*Nc *2*3*sizeof(Grid::Real);
|
||||||
|
@ -10,7 +10,7 @@ int main (int argc, char ** argv)
|
|||||||
Grid_init(&argc,&argv);
|
Grid_init(&argc,&argv);
|
||||||
|
|
||||||
|
|
||||||
std::vector<int> simd_layout = GridDefaultSimd(4,vComplexF::Nsimd());
|
std::vector<int> simd_layout = GridDefaultSimd(4,vComplex::Nsimd());
|
||||||
std::vector<int> mpi_layout = GridDefaultMpi();
|
std::vector<int> mpi_layout = GridDefaultMpi();
|
||||||
std::vector<int> latt_size ({16,16,16,32});
|
std::vector<int> latt_size ({16,16,16,32});
|
||||||
std::vector<int> clatt_size ({4,4,4,8});
|
std::vector<int> clatt_size ({4,4,4,8});
|
||||||
@ -31,7 +31,7 @@ int main (int argc, char ** argv)
|
|||||||
readNerscConfiguration(Umu,header,file);
|
readNerscConfiguration(Umu,header,file);
|
||||||
|
|
||||||
for(int mu=0;mu<Nd;mu++){
|
for(int mu=0;mu<Nd;mu++){
|
||||||
U[mu] = peekIndex<3>(Umu,mu);
|
U[mu] = PeekIndex<LorentzIndex>(Umu,mu);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Painful ; fix syntactical niceness
|
// Painful ; fix syntactical niceness
|
||||||
|
@ -63,7 +63,7 @@ int main (int argc, char ** argv)
|
|||||||
ColourWilsonLoops::Staple(staple,Umu,mu);
|
ColourWilsonLoops::Staple(staple,Umu,mu);
|
||||||
staple = adj(staple);
|
staple = adj(staple);
|
||||||
|
|
||||||
link = peekIndex<LorentzIndex>(Umu,mu);
|
link = PeekIndex<LorentzIndex>(Umu,mu);
|
||||||
|
|
||||||
for( int subgroup=0;subgroup<SU3::su2subgroups();subgroup++ ) {
|
for( int subgroup=0;subgroup<SU3::su2subgroups();subgroup++ ) {
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<LatticeColourMatrix> U(4,&Grid);
|
std::vector<LatticeColourMatrix> U(4,&Grid);
|
||||||
|
|
||||||
for(int mu=0;mu<Nd;mu++){
|
for(int mu=0;mu<Nd;mu++){
|
||||||
U[mu] = peekIndex<LorentzIndex>(Umu,mu);
|
U[mu] = PeekIndex<LorentzIndex>(Umu,mu);
|
||||||
}
|
}
|
||||||
|
|
||||||
RealD mass=0.5;
|
RealD mass=0.5;
|
||||||
|
@ -34,16 +34,10 @@ int main (int argc, char ** argv)
|
|||||||
LatticeFermion result(&Grid); result=zero;
|
LatticeFermion result(&Grid); result=zero;
|
||||||
LatticeGaugeField Umu(&Grid); random(pRNG,Umu);
|
LatticeGaugeField Umu(&Grid); random(pRNG,Umu);
|
||||||
|
|
||||||
std::vector<LatticeColourMatrix> U(4,&Grid);
|
|
||||||
|
|
||||||
double volume=1;
|
double volume=1;
|
||||||
for(int mu=0;mu<Nd;mu++){
|
for(int mu=0;mu<Nd;mu++){
|
||||||
volume=volume*latt_size[mu];
|
volume=volume*latt_size[mu];
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int mu=0;mu<Nd;mu++){
|
|
||||||
U[mu] = peekIndex<LorentzIndex>(Umu,mu);
|
|
||||||
}
|
|
||||||
|
|
||||||
RealD mass=0.5;
|
RealD mass=0.5;
|
||||||
WilsonFermion Dw(Umu,Grid,RBGrid,mass);
|
WilsonFermion Dw(Umu,Grid,RBGrid,mass);
|
||||||
|
@ -42,10 +42,6 @@ int main (int argc, char ** argv)
|
|||||||
volume=volume*latt_size[mu];
|
volume=volume*latt_size[mu];
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int mu=0;mu<Nd;mu++){
|
|
||||||
U[mu] = peekIndex<LorentzIndex>(Umu,mu);
|
|
||||||
}
|
|
||||||
|
|
||||||
RealD mass=0.5;
|
RealD mass=0.5;
|
||||||
WilsonFermion Dw(Umu,Grid,RBGrid,mass);
|
WilsonFermion Dw(Umu,Grid,RBGrid,mass);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user