1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-13 20:57:06 +01:00

Merge branch 'master' of github.com:paboyle/Grid

Merge done
Conflicts:
	lib/serialisation/XmlIO.h
	tests/Test_stencil.cc
This commit is contained in:
paboyle
2015-11-28 17:03:43 -08:00
23 changed files with 763 additions and 760 deletions

View File

@ -1,5 +1,5 @@
bin_PROGRAMS = Test_GaugeAction Test_cayley_cg Test_cayley_coarsen_support Test_cayley_even_odd Test_cayley_ldop_cr Test_cf_coarsen_support Test_cf_cr_unprec Test_cheby Test_contfrac_cg Test_contfrac_even_odd Test_contfrac_force Test_cshift Test_cshift_red_black Test_dwf_cg_prec Test_dwf_cg_schur Test_dwf_cg_unprec Test_dwf_cr_unprec Test_dwf_even_odd Test_dwf_force Test_dwf_fpgcr Test_dwf_hdcr Test_gamma Test_hmc_EODWFRatio Test_hmc_EOWilsonFermionGauge Test_hmc_EOWilsonRatio Test_hmc_WilsonFermionGauge Test_hmc_WilsonGauge Test_hmc_WilsonRatio Test_lie_generators Test_main Test_multishift_sqrt Test_nersc_io Test_partfrac_force Test_quenched_update Test_remez Test_rhmc_EOWilson1p1 Test_rhmc_EOWilsonRatio Test_rhmc_Wilson1p1 Test_rhmc_WilsonRatio Test_rng Test_rng_fixed Test_serialisation Test_simd Test_stencil Test_wilson_cg_prec Test_wilson_cg_schur Test_wilson_cg_unprec Test_wilson_cr_unprec Test_wilson_even_odd Test_wilson_force Test_wilson_force_phiMdagMphi Test_wilson_force_phiMphi
bin_PROGRAMS = Test_GaugeAction Test_cayley_cg Test_cayley_coarsen_support Test_cayley_even_odd Test_cayley_ldop_cr Test_cf_coarsen_support Test_cf_cr_unprec Test_cheby Test_contfrac_cg Test_contfrac_even_odd Test_contfrac_force Test_cshift Test_cshift_red_black Test_dwf_cg_prec Test_dwf_cg_schur Test_dwf_cg_unprec Test_dwf_cr_unprec Test_dwf_even_odd Test_dwf_force Test_dwf_fpgcr Test_dwf_hdcr Test_gamma Test_hmc_EODWFRatio Test_hmc_EOWilsonFermionGauge Test_hmc_EOWilsonRatio Test_hmc_WilsonFermionGauge Test_hmc_WilsonGauge Test_hmc_WilsonRatio Test_lie_generators Test_main Test_multishift_sqrt Test_nersc_io Test_partfrac_force Test_quenched_update Test_remez Test_rhmc_EOWilson1p1 Test_rhmc_EOWilsonRatio Test_rhmc_Wilson1p1 Test_rhmc_WilsonRatio Test_rng Test_rng_fixed Test_serialisation Test_simd Test_stencil Test_wilson_cg_prec Test_wilson_cg_schur Test_wilson_cg_unprec Test_wilson_cr_unprec Test_wilson_even_odd Test_wilson_force Test_wilson_force_phiMdagMphi Test_wilson_force_phiMphi Test_synthetic_lanczos
Test_GaugeAction_SOURCES=Test_GaugeAction.cc
@ -98,8 +98,8 @@ Test_gparity_SOURCES=Test_gparity.cc
Test_gparity_LDADD=-lGrid
Test_gpwilson_even_odd_SOURCES=Test_gpwilson_even_odd.cc
Test_gpwilson_even_odd_LDADD=-lGrid
#Test_gpwilson_even_odd_SOURCES=Test_gpwilson_even_odd.cc
#Test_gpwilson_even_odd_LDADD=-lGrid
Test_hmc_EODWFRatio_SOURCES=Test_hmc_EODWFRatio.cc

View File

@ -57,5 +57,21 @@ int main (int argc, char ** argv)
ChebyStep.csv(of);
}
lo=-8;
hi=8;
Chebyshev<LatticeFermion> ChebyIndefInv(lo,hi,40,InverseApproximation);
{
std::ofstream of("chebyindefinv");
ChebyIndefInv.csv(of);
}
lo=0;
hi=64;
Chebyshev<LatticeFermion> ChebyNE(lo,hi,40,InverseApproximation);
{
std::ofstream of("chebyNE");
ChebyNE.csv(of);
}
Grid_finalize();
}

View File

@ -1,36 +1,35 @@
#include <Grid.h>
namespace Grid {
class myclass {
public:
GRID_DECL_CLASS_MEMBERS(myclass,
int, x,
double, y,
bool , b,
std::string, name,
std::vector<double>, array,
std::vector<std::vector<double> >, twodimarray,
);
myclass(){}
myclass(int i) : array(4,5.1), twodimarray(3,std::vector<double>(2,1.23456)) {
x=i;
y=2*i;
b=true;
name="bother said pooh";
}
};
class myclass: Serializable {
public:
GRID_DECL_CLASS_MEMBERS(myclass,
int, x,
double, y,
bool , b,
std::string, name,
std::vector<double>, array,
std::vector<std::vector<double>>, twodimarray,
);
myclass() {}
myclass(int i)
: array(4,5.1), twodimarray(3,std::vector<double>(2,1.23456))
{
x=i;
y=2*i;
b=true;
name="bother said pooh";
}
};
}
int16_t i16 = 1;
int16_t i16 = 1;
uint16_t u16 = 2;
int32_t i32 = 3;
int32_t i32 = 3;
uint32_t u32 = 4;
int64_t i64 = 5;
int64_t i64 = 5;
uint64_t u64 = 6;
float f = M_PI;
double d = 2*M_PI;
@ -41,8 +40,9 @@ using namespace Grid;
int main(int argc,char **argv)
{
{
XMLWriter WR("bother.xml");
XmlWriter WR("bother.xml");
// test basic type writing
push(WR,"BasicTypes");
write(WR,std::string("i16"),i16);
write(WR,"u16",u16);
@ -54,40 +54,54 @@ int main(int argc,char **argv)
write(WR,"d",d);
write(WR,"b",b);
pop(WR);
// test serializable class writing
myclass obj(1234); // non-trivial constructor
write(WR,"obj",obj);
WR.write("obj2", obj);
std::vector<myclass> vec;
vec.push_back(myclass(1234));
vec.push_back(myclass(5678));
vec.push_back(myclass(3838));
write(WR, "objvec", vec);
};
XMLReader RD("bother.xml");
myclass copy1;
myclass copy2;
myclass copy3;
read(RD,"obj",copy1);
std::cout << "Loaded " << copy1<<std::endl;
// read tests
myclass copy1, copy2, copy3;
std::vector<myclass> veccopy1, veccopy2, veccopy3;
//// XML
{
XmlReader RD("bother.xml");
read(RD,"obj",copy1);
read(RD,"objvec", veccopy1);
std::cout << "Loaded (XML) -----------------" << std::endl;
std::cout << copy1 << std::endl << veccopy1 << std::endl;
}
//// binary
{
BinaryWriter BWR("bother.bin");
write(BWR,"discard",copy1 );
write(BWR,"discard",veccopy1 );
}
{
{
BinaryReader BRD("bother.bin");
read (BRD,"discard",copy2 );
std::cout<<copy2<<std::endl;
read (BRD,"discard",veccopy2 );
std::cout << "Loaded (bin) -----------------" << std::endl;
std::cout << copy2 << std::endl << veccopy2 << std::endl;
}
//// text
{
TextWriter TWR("bother.txt");
write(TWR,"discard",copy1 );
write(TWR,"discard",veccopy1 );
}
{
{
TextReader TRD("bother.txt");
read (TRD,"discard",copy3 );
std::cout<<copy3<<std::endl;
read (TRD,"discard",veccopy3 );
std::cout << "Loaded (txt) -----------------" << std::endl;
std::cout << copy3 << std::endl << veccopy3 << std::endl;
}
}

View File

@ -52,6 +52,7 @@ int main (int argc, char ** argv)
}
*/
typedef CartesianStencil<vobj,vobj,SimpleCompressor<vobj> > Stencil;
for(int dir=0;dir<4;dir++){
for(int disp=0;disp<Fine._fdimensions[dir];disp++){
@ -61,7 +62,11 @@ int main (int argc, char ** argv)
std::vector<int> directions(npoint,dir);
std::vector<int> displacements(npoint,disp);
<<<<<<< HEAD
CartesianStencil<vobj,vobj,SimpleCompressor<vobj> > myStencil(&Fine,npoint,0,directions,displacements);
=======
Stencil myStencil(&Fine,npoint,0,directions,displacements);
>>>>>>> bc4b2528835e646fab1b186506b4740d97b02243
std::vector<int> ocoor(4);
for(int o=0;o<Fine.oSites();o++){
@ -142,8 +147,8 @@ int main (int argc, char ** argv)
std::vector<int> directions(npoint,dir);
std::vector<int> displacements(npoint,disp);
CartesianStencil<vobj,vobj,SimpleCompressor<vobj> > EStencil(&rbFine,npoint,Even,directions,displacements);
CartesianStencil<vobj,vobj,SimpleCompressor<vobj> > OStencil(&rbFine,npoint,Odd,directions,displacements);
Stencil EStencil(&rbFine,npoint,Even,directions,displacements);
Stencil OStencil(&rbFine,npoint,Odd,directions,displacements);
std::vector<int> ocoor(4);
for(int o=0;o<Fine.oSites();o++){

View File

@ -35,7 +35,7 @@ public:
random(pRNG,scale);
scale = exp(-real(scale)*6.0);
scale = exp(-real(scale)*3.0);
std::cout << " True matrix \n"<< scale <<std::endl;
}
@ -88,8 +88,7 @@ int main (int argc, char ** argv)
RealD mu = 0.0;
int order = 11;
ChebyshevLanczos<LatticeComplex> Cheby(alpha,beta,mu,order);
std::ofstream file("pooh.dat");
std::ofstream file("cheby.dat");
Cheby.csv(file);
HermOpOperatorFunction<LatticeComplex> X;
@ -114,9 +113,9 @@ int main (int argc, char ** argv)
}
{
std::vector<RealD> eval(Nm);
std::vector<LatticeComplex> evec(Nm,grid);
ChebyIRL.calc(eval,evec,src, Nconv);
// std::vector<RealD> eval(Nm);
// std::vector<LatticeComplex> evec(Nm,grid);
// ChebyIRL.calc(eval,evec,src, Nconv);
}
Grid_finalize();