mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-14 01:35:36 +00:00
Updates to ldop tests
This commit is contained in:
parent
0ad72b38ab
commit
f0d190024a
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,6 +6,7 @@
|
|||||||
*~
|
*~
|
||||||
errs
|
errs
|
||||||
*#
|
*#
|
||||||
|
INSTALL
|
||||||
|
|
||||||
# Precompiled Headers
|
# Precompiled Headers
|
||||||
*.gch
|
*.gch
|
||||||
|
2
INSTALL
2
INSTALL
@ -1 +1 @@
|
|||||||
/usr/share/automake-1.14/INSTALL
|
/opt/local/share/automake-1.15/INSTALL
|
13
configure
vendored
13
configure
vendored
@ -2574,7 +2574,7 @@ test -n "$target_alias" &&
|
|||||||
NONENONEs,x,x, &&
|
NONENONEs,x,x, &&
|
||||||
program_prefix=${target_alias}-
|
program_prefix=${target_alias}-
|
||||||
|
|
||||||
am__api_version='1.14'
|
am__api_version='1.15'
|
||||||
|
|
||||||
# Find a good install program. We prefer a C program (faster),
|
# Find a good install program. We prefer a C program (faster),
|
||||||
# so one script is as good as another. But avoid the broken or
|
# so one script is as good as another. But avoid the broken or
|
||||||
@ -2746,8 +2746,8 @@ test "$program_suffix" != NONE &&
|
|||||||
ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
|
ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
|
||||||
program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
|
program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
|
||||||
|
|
||||||
# expand $ac_aux_dir to an absolute path
|
# Expand $ac_aux_dir to an absolute path.
|
||||||
am_aux_dir=`cd $ac_aux_dir && pwd`
|
am_aux_dir=`cd "$ac_aux_dir" && pwd`
|
||||||
|
|
||||||
if test x"${MISSING+set}" != xset; then
|
if test x"${MISSING+set}" != xset; then
|
||||||
case $am_aux_dir in
|
case $am_aux_dir in
|
||||||
@ -2766,7 +2766,7 @@ else
|
|||||||
$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
|
$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test x"${install_sh}" != xset; then
|
if test x"${install_sh+set}" != xset; then
|
||||||
case $am_aux_dir in
|
case $am_aux_dir in
|
||||||
*\ * | *\ *)
|
*\ * | *\ *)
|
||||||
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
|
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
|
||||||
@ -3094,8 +3094,8 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
|
|||||||
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
|
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
|
||||||
mkdir_p='$(MKDIR_P)'
|
mkdir_p='$(MKDIR_P)'
|
||||||
|
|
||||||
# We need awk for the "check" target. The system "awk" is bad on
|
# We need awk for the "check" target (and possibly the TAP driver). The
|
||||||
# some platforms.
|
# system "awk" is bad on some platforms.
|
||||||
# Always define AMTAR for backward compatibility. Yes, it's still used
|
# Always define AMTAR for backward compatibility. Yes, it's still used
|
||||||
# in the wild :-( We should find a proper way to deprecate it ...
|
# in the wild :-( We should find a proper way to deprecate it ...
|
||||||
AMTAR='$${TAR-tar}'
|
AMTAR='$${TAR-tar}'
|
||||||
@ -3154,6 +3154,7 @@ END
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ac_config_headers="$ac_config_headers lib/GridConfig.h"
|
ac_config_headers="$ac_config_headers lib/GridConfig.h"
|
||||||
|
|
||||||
# Check whether --enable-silent-rules was given.
|
# Check whether --enable-silent-rules was given.
|
||||||
|
@ -64,21 +64,10 @@ int main (int argc, char ** argv)
|
|||||||
|
|
||||||
//random(RNG4,Umu);
|
//random(RNG4,Umu);
|
||||||
NerscField header;
|
NerscField header;
|
||||||
std::string file("./ckpoint_lat.400");
|
std::string file("./ckpoint_lat.4000");
|
||||||
readNerscConfiguration(Umu,header,file);
|
readNerscConfiguration(Umu,header,file);
|
||||||
|
|
||||||
#if 0
|
RealD mass=0.01;
|
||||||
LatticeColourMatrix U(UGrid);
|
|
||||||
Complex cone(1.0,0.0);
|
|
||||||
for(int nn=0;nn<Nd;nn++){
|
|
||||||
if (nn==3) {
|
|
||||||
U=zero; std::cout << "zeroing gauge field in dir "<<nn<<std::endl;
|
|
||||||
// else { U[nn]= cone;std::cout << "unit gauge field in dir "<<nn<<std::endl; }
|
|
||||||
pokeIndex<LorentzIndex>(Umu,U,nn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
RealD mass=0.5;
|
|
||||||
RealD M5=1.8;
|
RealD M5=1.8;
|
||||||
|
|
||||||
DomainWallFermion Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5);
|
DomainWallFermion Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5);
|
||||||
@ -100,7 +89,7 @@ int main (int argc, char ** argv)
|
|||||||
// filter(HermIndefOp,noise,subspace[b]);
|
// filter(HermIndefOp,noise,subspace[b]);
|
||||||
// inverse iteration
|
// inverse iteration
|
||||||
MdagMLinearOperator<DomainWallFermion,LatticeFermion> HermDefOp(Ddwf);
|
MdagMLinearOperator<DomainWallFermion,LatticeFermion> HermDefOp(Ddwf);
|
||||||
ConjugateGradient<LatticeFermion> CG(1.0e-5,10000);
|
ConjugateGradient<LatticeFermion> CG(1.0e-4,10000);
|
||||||
|
|
||||||
for(int i=0;i<4;i++){
|
for(int i=0;i<4;i++){
|
||||||
|
|
||||||
|
124
tests/Test_cayley_ldop_cr_chebyshev.cc
Normal file
124
tests/Test_cayley_ldop_cr_chebyshev.cc
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
#include <Grid.h>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace Grid;
|
||||||
|
using namespace Grid::QCD;
|
||||||
|
|
||||||
|
|
||||||
|
template<class d>
|
||||||
|
struct scal {
|
||||||
|
d internal;
|
||||||
|
};
|
||||||
|
|
||||||
|
Gamma::GammaMatrix Gmu [] = {
|
||||||
|
Gamma::GammaX,
|
||||||
|
Gamma::GammaY,
|
||||||
|
Gamma::GammaZ,
|
||||||
|
Gamma::GammaT
|
||||||
|
};
|
||||||
|
|
||||||
|
double lowpass(double x)
|
||||||
|
{
|
||||||
|
return pow(x*x,-2);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main (int argc, char ** argv)
|
||||||
|
{
|
||||||
|
Grid_init(&argc,&argv);
|
||||||
|
|
||||||
|
Chebyshev<LatticeFermion> filter(-120.0, 120.0,256, lowpass);
|
||||||
|
ofstream csv(std::string("filter.dat"),std::ios::out|std::ios::trunc);
|
||||||
|
filter.csv(csv);
|
||||||
|
csv.close();
|
||||||
|
|
||||||
|
const int Ls=8;
|
||||||
|
|
||||||
|
GridCartesian * UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplexF::Nsimd()),GridDefaultMpi());
|
||||||
|
GridRedBlackCartesian * UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid);
|
||||||
|
|
||||||
|
GridCartesian * FGrid = SpaceTimeGrid::makeFiveDimGrid(Ls,UGrid);
|
||||||
|
GridRedBlackCartesian * FrbGrid = SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls,UGrid);
|
||||||
|
|
||||||
|
// Construct a coarsened grid
|
||||||
|
std::vector<int> clatt = GridDefaultLatt();
|
||||||
|
for(int d=0;d<clatt.size();d++){
|
||||||
|
clatt[d] = clatt[d]/2;
|
||||||
|
}
|
||||||
|
GridCartesian *Coarse4d = SpaceTimeGrid::makeFourDimGrid(clatt, GridDefaultSimd(Nd,vComplexF::Nsimd()),GridDefaultMpi());;
|
||||||
|
GridCartesian *Coarse5d = SpaceTimeGrid::makeFiveDimGrid(1,Coarse4d);
|
||||||
|
|
||||||
|
std::vector<int> seeds4({1,2,3,4});
|
||||||
|
std::vector<int> seeds5({5,6,7,8});
|
||||||
|
std::vector<int> cseeds({5,6,7,8});
|
||||||
|
GridParallelRNG RNG5(FGrid); RNG5.SeedFixedIntegers(seeds5);
|
||||||
|
GridParallelRNG RNG4(UGrid); RNG4.SeedFixedIntegers(seeds4);
|
||||||
|
GridParallelRNG CRNG(Coarse5d);CRNG.SeedFixedIntegers(cseeds);
|
||||||
|
|
||||||
|
LatticeFermion src(FGrid); gaussian(RNG5,src);
|
||||||
|
LatticeFermion result(FGrid); result=zero;
|
||||||
|
LatticeFermion ref(FGrid); ref=zero;
|
||||||
|
LatticeFermion tmp(FGrid);
|
||||||
|
LatticeFermion err(FGrid);
|
||||||
|
LatticeGaugeField Umu(UGrid); gaussian(RNG4,Umu);
|
||||||
|
|
||||||
|
|
||||||
|
//random(RNG4,Umu);
|
||||||
|
NerscField header;
|
||||||
|
std::string file("./ckpoint_lat.400");
|
||||||
|
readNerscConfiguration(Umu,header,file);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
LatticeColourMatrix U(UGrid);
|
||||||
|
Complex cone(1.0,0.0);
|
||||||
|
for(int nn=0;nn<Nd;nn++){
|
||||||
|
if (nn==3) {
|
||||||
|
U=zero; std::cout << "zeroing gauge field in dir "<<nn<<std::endl;
|
||||||
|
// else { U[nn]= cone;std::cout << "unit gauge field in dir "<<nn<<std::endl; }
|
||||||
|
pokeIndex<LorentzIndex>(Umu,U,nn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
RealD mass=0.5;
|
||||||
|
RealD M5=1.8;
|
||||||
|
|
||||||
|
DomainWallFermion Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5);
|
||||||
|
Gamma5R5HermitianLinearOperator<DomainWallFermion,LatticeFermion> HermIndefOp(Ddwf);
|
||||||
|
|
||||||
|
const int nbasis = 8;
|
||||||
|
std::vector<LatticeFermion> subspace(nbasis,FGrid);
|
||||||
|
LatticeFermion noise(FGrid);
|
||||||
|
LatticeFermion ms(FGrid);
|
||||||
|
for(int b=0;b<nbasis;b++){
|
||||||
|
Gamma g5(Gamma::Gamma5);
|
||||||
|
gaussian(RNG5,noise);
|
||||||
|
RealD scale = pow(norm2(noise),-0.5);
|
||||||
|
noise=noise*scale;
|
||||||
|
|
||||||
|
HermIndefOp.HermOp(noise,ms); std::cout << "Noise "<<b<<" Ms "<<norm2(ms)<< " "<< norm2(noise)<<std::endl;
|
||||||
|
|
||||||
|
filter(HermIndefOp,noise,subspace[b]);
|
||||||
|
scale = pow(norm2(subspace[b]),-0.5);
|
||||||
|
subspace[b]=subspace[b]*scale;
|
||||||
|
HermIndefOp.HermOp(subspace[b],ms); std::cout << "Filtered "<<b<<" Ms "<<norm2(ms)<< " "<<norm2(subspace[b]) <<std::endl;
|
||||||
|
}
|
||||||
|
std::cout << "Computed randoms"<< std::endl;
|
||||||
|
|
||||||
|
typedef CoarsenedMatrix<vSpinColourVector,vTComplex,nbasis> LittleDiracOperator;
|
||||||
|
typedef LittleDiracOperator::CoarseVector CoarseVector;
|
||||||
|
|
||||||
|
LittleDiracOperator LittleDiracOp(*Coarse5d);
|
||||||
|
LittleDiracOp.CoarsenOperator(FGrid,HermIndefOp,subspace);
|
||||||
|
|
||||||
|
CoarseVector c_src (Coarse5d);
|
||||||
|
CoarseVector c_res (Coarse5d);
|
||||||
|
gaussian(CRNG,c_src);
|
||||||
|
c_res=zero;
|
||||||
|
|
||||||
|
std::cout << "Solving MCR on coarse space "<< std::endl;
|
||||||
|
HermitianLinearOperator<LittleDiracOperator,CoarseVector> HermIndefLdop(LittleDiracOp);
|
||||||
|
ConjugateResidual<CoarseVector> MCR(1.0e-8,10000);
|
||||||
|
MCR(HermIndefLdop,c_src,c_res);
|
||||||
|
|
||||||
|
std::cout << "Done "<< std::endl;
|
||||||
|
Grid_finalize();
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user