mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-09 23:45:36 +00:00
Merge remote-tracking branch 'LupoA/develop' into LupoA-develop
This commit is contained in:
commit
c5f1420dea
@ -66,6 +66,10 @@ if BUILD_FERMION_REPS
|
|||||||
extra_sources+=$(ADJ_FERMION_FILES)
|
extra_sources+=$(ADJ_FERMION_FILES)
|
||||||
extra_sources+=$(TWOIND_FERMION_FILES)
|
extra_sources+=$(TWOIND_FERMION_FILES)
|
||||||
endif
|
endif
|
||||||
|
if BUILD_SP
|
||||||
|
extra_sources+=$(SP_FERMION_FILES)
|
||||||
|
extra_sources+=$(SP_TWOIND_FERMION_FILES)
|
||||||
|
endif
|
||||||
|
|
||||||
lib_LIBRARIES = libGrid.a
|
lib_LIBRARIES = libGrid.a
|
||||||
|
|
||||||
|
@ -345,7 +345,9 @@ GridUnopClass(UnaryNot, Not(a));
|
|||||||
GridUnopClass(UnaryTrace, trace(a));
|
GridUnopClass(UnaryTrace, trace(a));
|
||||||
GridUnopClass(UnaryTranspose, transpose(a));
|
GridUnopClass(UnaryTranspose, transpose(a));
|
||||||
GridUnopClass(UnaryTa, Ta(a));
|
GridUnopClass(UnaryTa, Ta(a));
|
||||||
|
GridUnopClass(UnarySpTa, SpTa(a));
|
||||||
GridUnopClass(UnaryProjectOnGroup, ProjectOnGroup(a));
|
GridUnopClass(UnaryProjectOnGroup, ProjectOnGroup(a));
|
||||||
|
GridUnopClass(UnaryProjectOnSpGroup, ProjectOnSpGroup(a));
|
||||||
GridUnopClass(UnaryTimesI, timesI(a));
|
GridUnopClass(UnaryTimesI, timesI(a));
|
||||||
GridUnopClass(UnaryTimesMinusI, timesMinusI(a));
|
GridUnopClass(UnaryTimesMinusI, timesMinusI(a));
|
||||||
GridUnopClass(UnaryAbs, abs(a));
|
GridUnopClass(UnaryAbs, abs(a));
|
||||||
@ -456,7 +458,9 @@ GRID_DEF_UNOP(operator!, UnaryNot);
|
|||||||
GRID_DEF_UNOP(trace, UnaryTrace);
|
GRID_DEF_UNOP(trace, UnaryTrace);
|
||||||
GRID_DEF_UNOP(transpose, UnaryTranspose);
|
GRID_DEF_UNOP(transpose, UnaryTranspose);
|
||||||
GRID_DEF_UNOP(Ta, UnaryTa);
|
GRID_DEF_UNOP(Ta, UnaryTa);
|
||||||
|
GRID_DEF_UNOP(SpTa, UnarySpTa);
|
||||||
GRID_DEF_UNOP(ProjectOnGroup, UnaryProjectOnGroup);
|
GRID_DEF_UNOP(ProjectOnGroup, UnaryProjectOnGroup);
|
||||||
|
GRID_DEF_UNOP(ProjectOnSpGroup, UnaryProjectOnSpGroup);
|
||||||
GRID_DEF_UNOP(timesI, UnaryTimesI);
|
GRID_DEF_UNOP(timesI, UnaryTimesI);
|
||||||
GRID_DEF_UNOP(timesMinusI, UnaryTimesMinusI);
|
GRID_DEF_UNOP(timesMinusI, UnaryTimesMinusI);
|
||||||
GRID_DEF_UNOP(abs, UnaryAbs); // abs overloaded in cmath C++98; DON'T do the
|
GRID_DEF_UNOP(abs, UnaryAbs); // abs overloaded in cmath C++98; DON'T do the
|
||||||
|
@ -66,6 +66,65 @@ inline auto TraceIndex(const Lattice<vobj> &lhs) -> Lattice<decltype(traceIndex<
|
|||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<int N, class Vec>
|
||||||
|
Lattice<iScalar<iScalar<iScalar<Vec> > > > Determinant(const Lattice<iScalar<iScalar<iMatrix<Vec, N> > > > &Umu)
|
||||||
|
{
|
||||||
|
GridBase *grid=Umu.Grid();
|
||||||
|
auto lvol = grid->lSites();
|
||||||
|
Lattice<iScalar<iScalar<iScalar<Vec> > > > ret(grid);
|
||||||
|
typedef typename Vec::scalar_type scalar;
|
||||||
|
autoView(Umu_v,Umu,CpuRead);
|
||||||
|
autoView(ret_v,ret,CpuWrite);
|
||||||
|
thread_for(site,lvol,{
|
||||||
|
Eigen::MatrixXcd EigenU = Eigen::MatrixXcd::Zero(N,N);
|
||||||
|
Coordinate lcoor;
|
||||||
|
grid->LocalIndexToLocalCoor(site, lcoor);
|
||||||
|
iScalar<iScalar<iMatrix<scalar, N> > > Us;
|
||||||
|
peekLocalSite(Us, Umu_v, lcoor);
|
||||||
|
for(int i=0;i<N;i++){
|
||||||
|
for(int j=0;j<N;j++){
|
||||||
|
scalar tmp= Us()()(i,j);
|
||||||
|
ComplexD ztmp(real(tmp),imag(tmp));
|
||||||
|
EigenU(i,j)=ztmp;
|
||||||
|
}}
|
||||||
|
ComplexD detD = EigenU.determinant();
|
||||||
|
typename Vec::scalar_type det(detD.real(),detD.imag());
|
||||||
|
pokeLocalSite(det,ret_v,lcoor);
|
||||||
|
});
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int N>
|
||||||
|
Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > Inverse(const Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > &Umu)
|
||||||
|
{
|
||||||
|
GridBase *grid=Umu.Grid();
|
||||||
|
auto lvol = grid->lSites();
|
||||||
|
Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > ret(grid);
|
||||||
|
|
||||||
|
autoView(Umu_v,Umu,CpuRead);
|
||||||
|
autoView(ret_v,ret,CpuWrite);
|
||||||
|
thread_for(site,lvol,{
|
||||||
|
Eigen::MatrixXcd EigenU = Eigen::MatrixXcd::Zero(N,N);
|
||||||
|
Coordinate lcoor;
|
||||||
|
grid->LocalIndexToLocalCoor(site, lcoor);
|
||||||
|
iScalar<iScalar<iMatrix<ComplexD, N> > > Us;
|
||||||
|
iScalar<iScalar<iMatrix<ComplexD, N> > > Ui;
|
||||||
|
peekLocalSite(Us, Umu_v, lcoor);
|
||||||
|
for(int i=0;i<N;i++){
|
||||||
|
for(int j=0;j<N;j++){
|
||||||
|
EigenU(i,j) = Us()()(i,j);
|
||||||
|
}}
|
||||||
|
Eigen::MatrixXcd EigenUinv = EigenU.inverse();
|
||||||
|
for(int i=0;i<N;i++){
|
||||||
|
for(int j=0;j<N;j++){
|
||||||
|
Ui()()(i,j) = EigenUinv(i,j);
|
||||||
|
}}
|
||||||
|
pokeLocalSite(Ui,ret_v,lcoor);
|
||||||
|
});
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
NAMESPACE_END(Grid);
|
NAMESPACE_END(Grid);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -126,6 +126,16 @@ typedef WilsonFermion<WilsonTwoIndexSymmetricImplD> WilsonTwoIndexSymmetricFermi
|
|||||||
typedef WilsonFermion<WilsonTwoIndexAntiSymmetricImplF> WilsonTwoIndexAntiSymmetricFermionF;
|
typedef WilsonFermion<WilsonTwoIndexAntiSymmetricImplF> WilsonTwoIndexAntiSymmetricFermionF;
|
||||||
typedef WilsonFermion<WilsonTwoIndexAntiSymmetricImplD> WilsonTwoIndexAntiSymmetricFermionD;
|
typedef WilsonFermion<WilsonTwoIndexAntiSymmetricImplD> WilsonTwoIndexAntiSymmetricFermionD;
|
||||||
|
|
||||||
|
// Sp(2n)
|
||||||
|
typedef WilsonFermion<SpWilsonImplF> SpWilsonFermionF;
|
||||||
|
typedef WilsonFermion<SpWilsonImplD> SpWilsonFermionD;
|
||||||
|
|
||||||
|
typedef WilsonFermion<SpWilsonTwoIndexAntiSymmetricImplF> SpWilsonTwoIndexAntiSymmetricFermionF;
|
||||||
|
typedef WilsonFermion<SpWilsonTwoIndexAntiSymmetricImplD> SpWilsonTwoIndexAntiSymmetricFermionD;
|
||||||
|
|
||||||
|
typedef WilsonFermion<SpWilsonTwoIndexSymmetricImplF> SpWilsonTwoIndexSymmetricFermionF;
|
||||||
|
typedef WilsonFermion<SpWilsonTwoIndexSymmetricImplD> SpWilsonTwoIndexSymmetricFermionD;
|
||||||
|
|
||||||
// Twisted mass fermion
|
// Twisted mass fermion
|
||||||
typedef WilsonTMFermion<WilsonImplD2> WilsonTMFermionD2;
|
typedef WilsonTMFermion<WilsonImplD2> WilsonTMFermionD2;
|
||||||
typedef WilsonTMFermion<WilsonImplF> WilsonTMFermionF;
|
typedef WilsonTMFermion<WilsonImplF> WilsonTMFermionF;
|
||||||
|
@ -261,6 +261,22 @@ typedef WilsonImpl<vComplex, TwoIndexAntiSymmetricRepresentation, CoeffReal > W
|
|||||||
typedef WilsonImpl<vComplexF, TwoIndexAntiSymmetricRepresentation, CoeffReal > WilsonTwoIndexAntiSymmetricImplF; // Float
|
typedef WilsonImpl<vComplexF, TwoIndexAntiSymmetricRepresentation, CoeffReal > WilsonTwoIndexAntiSymmetricImplF; // Float
|
||||||
typedef WilsonImpl<vComplexD, TwoIndexAntiSymmetricRepresentation, CoeffReal > WilsonTwoIndexAntiSymmetricImplD; // Double
|
typedef WilsonImpl<vComplexD, TwoIndexAntiSymmetricRepresentation, CoeffReal > WilsonTwoIndexAntiSymmetricImplD; // Double
|
||||||
|
|
||||||
|
//sp 2n
|
||||||
|
|
||||||
|
typedef WilsonImpl<vComplex, SpFundamentalRepresentation, CoeffReal > SpWilsonImplR; // Real.. whichever prec
|
||||||
|
typedef WilsonImpl<vComplexF, SpFundamentalRepresentation, CoeffReal > SpWilsonImplF; // Float
|
||||||
|
typedef WilsonImpl<vComplexD, SpFundamentalRepresentation, CoeffReal > SpWilsonImplD; // Double
|
||||||
|
|
||||||
|
typedef WilsonImpl<vComplex, SpTwoIndexAntiSymmetricRepresentation, CoeffReal > SpWilsonTwoIndexAntiSymmetricImplR; // Real.. whichever prec
|
||||||
|
typedef WilsonImpl<vComplexF, SpTwoIndexAntiSymmetricRepresentation, CoeffReal > SpWilsonTwoIndexAntiSymmetricImplF; // Float
|
||||||
|
typedef WilsonImpl<vComplexD, SpTwoIndexAntiSymmetricRepresentation, CoeffReal > SpWilsonTwoIndexAntiSymmetricImplD; // Double
|
||||||
|
|
||||||
|
typedef WilsonImpl<vComplex, SpTwoIndexSymmetricRepresentation, CoeffReal > SpWilsonTwoIndexSymmetricImplR; // Real.. whichever prec
|
||||||
|
typedef WilsonImpl<vComplexF, SpTwoIndexSymmetricRepresentation, CoeffReal > SpWilsonTwoIndexSymmetricImplF; // Float
|
||||||
|
typedef WilsonImpl<vComplexD, SpTwoIndexSymmetricRepresentation, CoeffReal > SpWilsonTwoIndexSymmetricImplD; // Double
|
||||||
|
|
||||||
|
typedef WilsonImpl<vComplex, SpTwoIndexSymmetricRepresentation, CoeffReal > SpWilsonAdjImplR; // Real.. whichever prec // adj = 2indx symmetric for Sp(2N)
|
||||||
|
typedef WilsonImpl<vComplexF, SpTwoIndexSymmetricRepresentation, CoeffReal > SpWilsonAdjImplF; // Float // adj = 2indx symmetric for Sp(2N)
|
||||||
|
typedef WilsonImpl<vComplexD, SpTwoIndexSymmetricRepresentation, CoeffReal > SpWilsonAdjImplD; // Double // adj = 2indx symmetric for Sp(2N)
|
||||||
|
|
||||||
NAMESPACE_END(Grid);
|
NAMESPACE_END(Grid);
|
||||||
|
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
../WilsonCloverFermionInstantiation.cc.master
|
@ -0,0 +1 @@
|
|||||||
|
../WilsonFermionInstantiation.cc.master
|
@ -0,0 +1 @@
|
|||||||
|
../WilsonKernelsInstantiation.cc.master
|
@ -0,0 +1 @@
|
|||||||
|
../WilsonTMFermionInstantiation.cc.master
|
@ -0,0 +1 @@
|
|||||||
|
#define IMPLEMENTATION SpWilsonImplD
|
@ -0,0 +1 @@
|
|||||||
|
../WilsonCloverFermionInstantiation.cc.master
|
@ -0,0 +1 @@
|
|||||||
|
../WilsonFermionInstantiation.cc.master
|
@ -0,0 +1 @@
|
|||||||
|
../WilsonKernelsInstantiation.cc.master
|
@ -0,0 +1 @@
|
|||||||
|
../WilsonTMFermionInstantiation.cc.master
|
@ -0,0 +1 @@
|
|||||||
|
#define IMPLEMENTATION SpWilsonImplF
|
@ -0,0 +1 @@
|
|||||||
|
../WilsonCloverFermionInstantiation.cc.master
|
@ -0,0 +1 @@
|
|||||||
|
../WilsonFermionInstantiation.cc.master
|
@ -0,0 +1 @@
|
|||||||
|
../WilsonKernelsInstantiation.cc.master
|
@ -0,0 +1 @@
|
|||||||
|
../WilsonTMFermionInstantiation.cc.master
|
@ -0,0 +1 @@
|
|||||||
|
#define IMPLEMENTATION SpWilsonTwoIndexAntiSymmetricImplD
|
@ -0,0 +1 @@
|
|||||||
|
../WilsonCloverFermionInstantiation.cc.master
|
@ -0,0 +1 @@
|
|||||||
|
../WilsonFermionInstantiation.cc.master
|
@ -0,0 +1 @@
|
|||||||
|
../WilsonKernelsInstantiation.cc.master
|
@ -0,0 +1 @@
|
|||||||
|
../WilsonTMFermionInstantiation.cc.master
|
@ -0,0 +1 @@
|
|||||||
|
#define IMPLEMENTATION SpWilsonTwoIndexAntiSymmetricImplF
|
@ -0,0 +1 @@
|
|||||||
|
../WilsonCloverFermionInstantiation.cc.master
|
@ -0,0 +1 @@
|
|||||||
|
../WilsonFermionInstantiation.cc.master
|
@ -0,0 +1 @@
|
|||||||
|
../WilsonKernelsInstantiation.cc.master
|
@ -0,0 +1 @@
|
|||||||
|
../WilsonTMFermionInstantiation.cc.master
|
@ -0,0 +1 @@
|
|||||||
|
#define IMPLEMENTATION SpWilsonTwoIndexSymmetricImplD
|
@ -0,0 +1 @@
|
|||||||
|
../WilsonCloverFermionInstantiation.cc.master
|
@ -0,0 +1 @@
|
|||||||
|
../WilsonFermionInstantiation.cc.master
|
@ -0,0 +1 @@
|
|||||||
|
../WilsonKernelsInstantiation.cc.master
|
@ -0,0 +1 @@
|
|||||||
|
../WilsonTMFermionInstantiation.cc.master
|
@ -0,0 +1 @@
|
|||||||
|
#define IMPLEMENTATION SpWilsonTwoIndexSymmetricImplF
|
@ -10,12 +10,18 @@ WILSON_IMPL_LIST=" \
|
|||||||
WilsonImplF \
|
WilsonImplF \
|
||||||
WilsonImplD \
|
WilsonImplD \
|
||||||
WilsonImplD2 \
|
WilsonImplD2 \
|
||||||
|
SpWilsonImplF \
|
||||||
|
SpWilsonImplD \
|
||||||
WilsonAdjImplF \
|
WilsonAdjImplF \
|
||||||
WilsonAdjImplD \
|
WilsonAdjImplD \
|
||||||
WilsonTwoIndexSymmetricImplF \
|
WilsonTwoIndexSymmetricImplF \
|
||||||
WilsonTwoIndexSymmetricImplD \
|
WilsonTwoIndexSymmetricImplD \
|
||||||
WilsonTwoIndexAntiSymmetricImplF \
|
WilsonTwoIndexAntiSymmetricImplF \
|
||||||
WilsonTwoIndexAntiSymmetricImplD \
|
WilsonTwoIndexAntiSymmetricImplD \
|
||||||
|
SpWilsonTwoIndexAntiSymmetricImplF \
|
||||||
|
SpWilsonTwoIndexAntiSymmetricImplD \
|
||||||
|
SpWilsonTwoIndexSymmetricImplF \
|
||||||
|
SpWilsonTwoIndexSymmetricImplD \
|
||||||
GparityWilsonImplF \
|
GparityWilsonImplF \
|
||||||
GparityWilsonImplD "
|
GparityWilsonImplD "
|
||||||
|
|
||||||
|
@ -39,6 +39,9 @@ NAMESPACE_BEGIN(Grid);
|
|||||||
typedef WilsonGaugeAction<PeriodicGimplR> WilsonGaugeActionR;
|
typedef WilsonGaugeAction<PeriodicGimplR> WilsonGaugeActionR;
|
||||||
typedef WilsonGaugeAction<PeriodicGimplF> WilsonGaugeActionF;
|
typedef WilsonGaugeAction<PeriodicGimplF> WilsonGaugeActionF;
|
||||||
typedef WilsonGaugeAction<PeriodicGimplD> WilsonGaugeActionD;
|
typedef WilsonGaugeAction<PeriodicGimplD> WilsonGaugeActionD;
|
||||||
|
typedef WilsonGaugeAction<SpPeriodicGimplR> SpWilsonGaugeActionR;
|
||||||
|
typedef WilsonGaugeAction<SpPeriodicGimplF> SpWilsonGaugeActionF;
|
||||||
|
typedef WilsonGaugeAction<SpPeriodicGimplD> SpWilsonGaugeActionD;
|
||||||
typedef PlaqPlusRectangleAction<PeriodicGimplR> PlaqPlusRectangleActionR;
|
typedef PlaqPlusRectangleAction<PeriodicGimplR> PlaqPlusRectangleActionR;
|
||||||
typedef PlaqPlusRectangleAction<PeriodicGimplF> PlaqPlusRectangleActionF;
|
typedef PlaqPlusRectangleAction<PeriodicGimplF> PlaqPlusRectangleActionF;
|
||||||
typedef PlaqPlusRectangleAction<PeriodicGimplD> PlaqPlusRectangleActionD;
|
typedef PlaqPlusRectangleAction<PeriodicGimplD> PlaqPlusRectangleActionD;
|
||||||
|
@ -61,7 +61,7 @@ NAMESPACE_BEGIN(Grid);
|
|||||||
typedef typename Impl::Field Field;
|
typedef typename Impl::Field Field;
|
||||||
|
|
||||||
// hardcodes the exponential approximation in the template
|
// hardcodes the exponential approximation in the template
|
||||||
template <class S, int Nrepresentation = Nc, int Nexp = 12 > class GaugeImplTypes {
|
template <class S, int Nrepresentation = Nc, int Nexp = 12, class Group = SU<Nc> > class GaugeImplTypes {
|
||||||
public:
|
public:
|
||||||
typedef S Simd;
|
typedef S Simd;
|
||||||
typedef typename Simd::scalar_type scalar_type;
|
typedef typename Simd::scalar_type scalar_type;
|
||||||
@ -78,8 +78,6 @@ public:
|
|||||||
typedef Lattice<SiteLink> LinkField;
|
typedef Lattice<SiteLink> LinkField;
|
||||||
typedef Lattice<SiteField> Field;
|
typedef Lattice<SiteField> Field;
|
||||||
|
|
||||||
typedef SU<Nrepresentation> Group;
|
|
||||||
|
|
||||||
// Guido: we can probably separate the types from the HMC functions
|
// Guido: we can probably separate the types from the HMC functions
|
||||||
// this will create 2 kind of implementations
|
// this will create 2 kind of implementations
|
||||||
// probably confusing the users
|
// probably confusing the users
|
||||||
@ -119,6 +117,7 @@ public:
|
|||||||
//
|
//
|
||||||
LinkField Pmu(P.Grid());
|
LinkField Pmu(P.Grid());
|
||||||
Pmu = Zero();
|
Pmu = Zero();
|
||||||
|
|
||||||
for (int mu = 0; mu < Nd; mu++) {
|
for (int mu = 0; mu < Nd; mu++) {
|
||||||
Group::GaussianFundamentalLieAlgebraMatrix(pRNG, Pmu);
|
Group::GaussianFundamentalLieAlgebraMatrix(pRNG, Pmu);
|
||||||
RealD scale = ::sqrt(HMC_MOMENTUM_DENOMINATOR) ;
|
RealD scale = ::sqrt(HMC_MOMENTUM_DENOMINATOR) ;
|
||||||
@ -127,7 +126,11 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline Field projectForce(Field &P) { return Ta(P); }
|
static inline Field projectForce(Field &P) {
|
||||||
|
Field ret(P.Grid());
|
||||||
|
Group::taProj(P, ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static inline void update_field(Field& P, Field& U, double ep){
|
static inline void update_field(Field& P, Field& U, double ep){
|
||||||
//static std::chrono::duration<double> diff;
|
//static std::chrono::duration<double> diff;
|
||||||
@ -137,7 +140,8 @@ public:
|
|||||||
autoView(P_v,P,AcceleratorRead);
|
autoView(P_v,P,AcceleratorRead);
|
||||||
accelerator_for(ss, P.Grid()->oSites(),1,{
|
accelerator_for(ss, P.Grid()->oSites(),1,{
|
||||||
for (int mu = 0; mu < Nd; mu++) {
|
for (int mu = 0; mu < Nd; mu++) {
|
||||||
U_v[ss](mu) = ProjectOnGroup(Exponentiate(P_v[ss](mu), ep, Nexp) * U_v[ss](mu));
|
U_v[ss](mu) = Exponentiate(P_v[ss](mu), ep, Nexp) * U_v[ss](mu);
|
||||||
|
U_v[ss](mu) = Group::ProjectOnGeneralGroup(U_v[ss](mu));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//auto end = std::chrono::high_resolution_clock::now();
|
//auto end = std::chrono::high_resolution_clock::now();
|
||||||
@ -157,7 +161,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline void Project(Field &U) {
|
static inline void Project(Field &U) {
|
||||||
ProjectSUn(U);
|
Group::ProjectOnSpecialGroup(U);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void HotConfiguration(GridParallelRNG &pRNG, Field &U) {
|
static inline void HotConfiguration(GridParallelRNG &pRNG, Field &U) {
|
||||||
@ -171,6 +175,7 @@ public:
|
|||||||
static inline void ColdConfiguration(GridParallelRNG &pRNG, Field &U) {
|
static inline void ColdConfiguration(GridParallelRNG &pRNG, Field &U) {
|
||||||
Group::ColdConfiguration(pRNG, U);
|
Group::ColdConfiguration(pRNG, U);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -178,10 +183,17 @@ typedef GaugeImplTypes<vComplex, Nc> GimplTypesR;
|
|||||||
typedef GaugeImplTypes<vComplexF, Nc> GimplTypesF;
|
typedef GaugeImplTypes<vComplexF, Nc> GimplTypesF;
|
||||||
typedef GaugeImplTypes<vComplexD, Nc> GimplTypesD;
|
typedef GaugeImplTypes<vComplexD, Nc> GimplTypesD;
|
||||||
|
|
||||||
|
typedef GaugeImplTypes<vComplex, Nc, 12, Sp<Nc> > SpGimplTypesR;
|
||||||
|
typedef GaugeImplTypes<vComplexF, Nc, 12, Sp<Nc> > SpGimplTypesF;
|
||||||
|
typedef GaugeImplTypes<vComplexD, Nc, 12, Sp<Nc> > SpGimplTypesD;
|
||||||
|
|
||||||
typedef GaugeImplTypes<vComplex, SU<Nc>::AdjointDimension> GimplAdjointTypesR;
|
typedef GaugeImplTypes<vComplex, SU<Nc>::AdjointDimension> GimplAdjointTypesR;
|
||||||
typedef GaugeImplTypes<vComplexF, SU<Nc>::AdjointDimension> GimplAdjointTypesF;
|
typedef GaugeImplTypes<vComplexF, SU<Nc>::AdjointDimension> GimplAdjointTypesF;
|
||||||
typedef GaugeImplTypes<vComplexD, SU<Nc>::AdjointDimension> GimplAdjointTypesD;
|
typedef GaugeImplTypes<vComplexD, SU<Nc>::AdjointDimension> GimplAdjointTypesD;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
NAMESPACE_END(Grid);
|
NAMESPACE_END(Grid);
|
||||||
|
|
||||||
#endif // GRID_GAUGE_IMPL_TYPES_H
|
#endif // GRID_GAUGE_IMPL_TYPES_H
|
||||||
|
@ -193,6 +193,11 @@ typedef ConjugateGaugeImpl<GimplTypesR> ConjugateGimplR; // Real.. whichever pre
|
|||||||
typedef ConjugateGaugeImpl<GimplTypesF> ConjugateGimplF; // Float
|
typedef ConjugateGaugeImpl<GimplTypesF> ConjugateGimplF; // Float
|
||||||
typedef ConjugateGaugeImpl<GimplTypesD> ConjugateGimplD; // Double
|
typedef ConjugateGaugeImpl<GimplTypesD> ConjugateGimplD; // Double
|
||||||
|
|
||||||
|
typedef PeriodicGaugeImpl<SpGimplTypesR> SpPeriodicGimplR; // Real.. whichever prec
|
||||||
|
typedef PeriodicGaugeImpl<SpGimplTypesF> SpPeriodicGimplF; // Float
|
||||||
|
typedef PeriodicGaugeImpl<SpGimplTypesD> SpPeriodicGimplD; // Double
|
||||||
|
|
||||||
|
|
||||||
NAMESPACE_END(Grid);
|
NAMESPACE_END(Grid);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -225,6 +225,18 @@ template <class RepresentationsPolicy,
|
|||||||
using GenericHMCRunnerHirep =
|
using GenericHMCRunnerHirep =
|
||||||
HMCWrapperTemplate<PeriodicGimplR, Integrator, RepresentationsPolicy>;
|
HMCWrapperTemplate<PeriodicGimplR, Integrator, RepresentationsPolicy>;
|
||||||
|
|
||||||
|
// sp2n
|
||||||
|
|
||||||
|
template <template <typename, typename, typename> class Integrator>
|
||||||
|
using GenericSpHMCRunner = HMCWrapperTemplate<SpPeriodicGimplR, Integrator>;
|
||||||
|
|
||||||
|
template <class RepresentationsPolicy,
|
||||||
|
template <typename, typename, typename> class Integrator>
|
||||||
|
using GenericSpHMCRunnerHirep =
|
||||||
|
HMCWrapperTemplate<SpPeriodicGimplR, Integrator, RepresentationsPolicy>;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <class Implementation, class RepresentationsPolicy,
|
template <class Implementation, class RepresentationsPolicy,
|
||||||
template <typename, typename, typename> class Integrator>
|
template <typename, typename, typename> class Integrator>
|
||||||
using GenericHMCRunnerTemplate = HMCWrapperTemplate<Implementation, Integrator, RepresentationsPolicy>;
|
using GenericHMCRunnerTemplate = HMCWrapperTemplate<Implementation, Integrator, RepresentationsPolicy>;
|
||||||
|
@ -13,7 +13,7 @@ NAMESPACE_BEGIN(Grid);
|
|||||||
* Empty since HMC updates already the fundamental representation
|
* Empty since HMC updates already the fundamental representation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template <int ncolour>
|
template <int ncolour, class group_name>
|
||||||
class FundamentalRep {
|
class FundamentalRep {
|
||||||
public:
|
public:
|
||||||
static const int Dimension = ncolour;
|
static const int Dimension = ncolour;
|
||||||
@ -21,7 +21,7 @@ public:
|
|||||||
|
|
||||||
// typdef to be used by the Representations class in HMC to get the
|
// typdef to be used by the Representations class in HMC to get the
|
||||||
// types for the higher representation fields
|
// types for the higher representation fields
|
||||||
typedef typename SU<ncolour>::LatticeMatrix LatticeMatrix;
|
typedef typename GaugeGroup<ncolour,group_name>::LatticeMatrix LatticeMatrix;
|
||||||
typedef LatticeGaugeField LatticeField;
|
typedef LatticeGaugeField LatticeField;
|
||||||
|
|
||||||
explicit FundamentalRep(GridBase* grid) {} //do nothing
|
explicit FundamentalRep(GridBase* grid) {} //do nothing
|
||||||
@ -45,7 +45,8 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef FundamentalRep<Nc> FundamentalRepresentation;
|
typedef FundamentalRep<Nc,GroupName::SU> FundamentalRepresentation;
|
||||||
|
typedef FundamentalRep<Nc,GroupName::Sp> SpFundamentalRepresentation;
|
||||||
|
|
||||||
NAMESPACE_END(Grid);
|
NAMESPACE_END(Grid);
|
||||||
|
|
||||||
|
@ -20,14 +20,14 @@ NAMESPACE_BEGIN(Grid);
|
|||||||
* in the SUnTwoIndex.h file
|
* in the SUnTwoIndex.h file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template <int ncolour, TwoIndexSymmetry S>
|
template <int ncolour, TwoIndexSymmetry S, class group_name = GroupName::SU>
|
||||||
class TwoIndexRep {
|
class TwoIndexRep {
|
||||||
public:
|
public:
|
||||||
// typdef to be used by the Representations class in HMC to get the
|
// typdef to be used by the Representations class in HMC to get the
|
||||||
// types for the higher representation fields
|
// types for the higher representation fields
|
||||||
typedef typename SU_TwoIndex<ncolour, S>::LatticeTwoIndexMatrix LatticeMatrix;
|
typedef typename GaugeGroupTwoIndex<ncolour, S, group_name>::LatticeTwoIndexMatrix LatticeMatrix;
|
||||||
typedef typename SU_TwoIndex<ncolour, S>::LatticeTwoIndexField LatticeField;
|
typedef typename GaugeGroupTwoIndex<ncolour, S, group_name>::LatticeTwoIndexField LatticeField;
|
||||||
static const int Dimension = ncolour * (ncolour + S) / 2;
|
static const int Dimension = GaugeGroupTwoIndex<ncolour,S,group_name>::Dimension;
|
||||||
static const bool isFundamental = false;
|
static const bool isFundamental = false;
|
||||||
|
|
||||||
LatticeField U;
|
LatticeField U;
|
||||||
@ -43,10 +43,10 @@ public:
|
|||||||
U = Zero();
|
U = Zero();
|
||||||
LatticeColourMatrix tmp(Uin.Grid());
|
LatticeColourMatrix tmp(Uin.Grid());
|
||||||
|
|
||||||
Vector<typename SU<ncolour>::Matrix> eij(Dimension);
|
Vector<typename GaugeGroup<ncolour,group_name>::Matrix> eij(Dimension);
|
||||||
|
|
||||||
for (int a = 0; a < Dimension; a++)
|
for (int a = 0; a < Dimension; a++)
|
||||||
SU_TwoIndex<ncolour, S>::base(a, eij[a]);
|
GaugeGroupTwoIndex<ncolour, S, group_name>::base(a, eij[a]);
|
||||||
|
|
||||||
for (int mu = 0; mu < Nd; mu++) {
|
for (int mu = 0; mu < Nd; mu++) {
|
||||||
auto Uin_mu = peekLorentz(Uin, mu);
|
auto Uin_mu = peekLorentz(Uin, mu);
|
||||||
@ -71,7 +71,7 @@ public:
|
|||||||
|
|
||||||
out_mu = Zero();
|
out_mu = Zero();
|
||||||
|
|
||||||
typename SU<ncolour>::LatticeAlgebraVector h(in.Grid());
|
typename GaugeGroup<ncolour, group_name>::LatticeAlgebraVector h(in.Grid());
|
||||||
projectOnAlgebra(h, in_mu, double(Nc + 2 * S)); // factor T(r)/T(fund)
|
projectOnAlgebra(h, in_mu, double(Nc + 2 * S)); // factor T(r)/T(fund)
|
||||||
FundamentalLieAlgebraMatrix(h, out_mu); // apply scale only once
|
FundamentalLieAlgebraMatrix(h, out_mu); // apply scale only once
|
||||||
pokeLorentz(out, out_mu, mu);
|
pokeLorentz(out, out_mu, mu);
|
||||||
@ -80,20 +80,23 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void projectOnAlgebra(typename SU<ncolour>::LatticeAlgebraVector &h_out,
|
void projectOnAlgebra(typename GaugeGroup<ncolour, group_name>::LatticeAlgebraVector &h_out,
|
||||||
const LatticeMatrix &in, Real scale = 1.0) const {
|
const LatticeMatrix &in, Real scale = 1.0) const {
|
||||||
SU_TwoIndex<ncolour, S>::projectOnAlgebra(h_out, in, scale);
|
GaugeGroupTwoIndex<ncolour, S,group_name>::projectOnAlgebra(h_out, in, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FundamentalLieAlgebraMatrix(
|
void FundamentalLieAlgebraMatrix(
|
||||||
typename SU<ncolour>::LatticeAlgebraVector &h,
|
typename GaugeGroup<ncolour, group_name>::LatticeAlgebraVector &h,
|
||||||
typename SU<ncolour>::LatticeMatrix &out, Real scale = 1.0) const {
|
typename GaugeGroup<ncolour, group_name>::LatticeMatrix &out, Real scale = 1.0) const {
|
||||||
SU<ncolour>::FundamentalLieAlgebraMatrix(h, out, scale);
|
GaugeGroup<ncolour,group_name>::FundamentalLieAlgebraMatrix(h, out, scale);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef TwoIndexRep<Nc, Symmetric> TwoIndexSymmetricRepresentation;
|
typedef TwoIndexRep<Nc, Symmetric, GroupName::SU> TwoIndexSymmetricRepresentation;
|
||||||
typedef TwoIndexRep<Nc, AntiSymmetric> TwoIndexAntiSymmetricRepresentation;
|
typedef TwoIndexRep<Nc, AntiSymmetric, GroupName::SU> TwoIndexAntiSymmetricRepresentation;
|
||||||
|
|
||||||
|
typedef TwoIndexRep<Nc, Symmetric, GroupName::Sp> SpTwoIndexSymmetricRepresentation;
|
||||||
|
typedef TwoIndexRep<Nc, AntiSymmetric, GroupName::Sp> SpTwoIndexAntiSymmetricRepresentation;
|
||||||
|
|
||||||
NAMESPACE_END(Grid);
|
NAMESPACE_END(Grid);
|
||||||
|
|
||||||
|
470
Grid/qcd/utils/GaugeGroup.h
Normal file
470
Grid/qcd/utils/GaugeGroup.h
Normal file
@ -0,0 +1,470 @@
|
|||||||
|
/*************************************************************************************
|
||||||
|
|
||||||
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
|
Source file: ./lib/qcd/utils/GaugeGroup.h
|
||||||
|
|
||||||
|
Copyright (C) 2015
|
||||||
|
|
||||||
|
Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk>
|
||||||
|
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
||||||
|
Author: neo <cossu@post.kek.jp>
|
||||||
|
Author: paboyle <paboyle@ph.ed.ac.uk>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
See the full license in the file "LICENSE" in the top level distribution
|
||||||
|
directory
|
||||||
|
*************************************************************************************/
|
||||||
|
/* END LEGAL */
|
||||||
|
#ifndef QCD_UTIL_GAUGEGROUP_H
|
||||||
|
#define QCD_UTIL_GAUGEGROUP_H
|
||||||
|
|
||||||
|
// Important detail: nvcc requires all template parameters to have names.
|
||||||
|
// This is the only reason why the second template parameter has a name.
|
||||||
|
#define ONLY_IF_SU \
|
||||||
|
typename dummy_name = group_name, \
|
||||||
|
typename named_dummy = std::enable_if_t < \
|
||||||
|
std::is_same<dummy_name, group_name>::value && \
|
||||||
|
is_su<dummy_name>::value >
|
||||||
|
|
||||||
|
#define ONLY_IF_Sp \
|
||||||
|
typename dummy_name = group_name, \
|
||||||
|
typename named_dummy = std::enable_if_t < \
|
||||||
|
std::is_same<dummy_name, group_name>::value && \
|
||||||
|
is_sp<dummy_name>::value >
|
||||||
|
|
||||||
|
NAMESPACE_BEGIN(Grid);
|
||||||
|
namespace GroupName {
|
||||||
|
class SU {};
|
||||||
|
class Sp {};
|
||||||
|
} // namespace GroupName
|
||||||
|
|
||||||
|
template <typename group_name>
|
||||||
|
struct is_su {
|
||||||
|
static const bool value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct is_su<GroupName::SU> {
|
||||||
|
static const bool value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename group_name>
|
||||||
|
struct is_sp {
|
||||||
|
static const bool value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct is_sp<GroupName::Sp> {
|
||||||
|
static const bool value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename group_name>
|
||||||
|
constexpr int compute_adjoint_dimension(int ncolour);
|
||||||
|
|
||||||
|
template <>
|
||||||
|
constexpr int compute_adjoint_dimension<GroupName::SU>(int ncolour) {
|
||||||
|
return ncolour * ncolour - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
constexpr int compute_adjoint_dimension<GroupName::Sp>(int ncolour) {
|
||||||
|
return ncolour / 2 * (ncolour + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <int ncolour, class group_name>
|
||||||
|
class GaugeGroup {
|
||||||
|
public:
|
||||||
|
static const int Dimension = ncolour;
|
||||||
|
static const int AdjointDimension =
|
||||||
|
compute_adjoint_dimension<group_name>(ncolour);
|
||||||
|
static const int AlgebraDimension =
|
||||||
|
compute_adjoint_dimension<group_name>(ncolour);
|
||||||
|
|
||||||
|
template <typename vtype>
|
||||||
|
using iSU2Matrix = iScalar<iScalar<iMatrix<vtype, 2> > >;
|
||||||
|
template <typename vtype>
|
||||||
|
using iGroupMatrix = iScalar<iScalar<iMatrix<vtype, ncolour> > >;
|
||||||
|
template <typename vtype>
|
||||||
|
using iAlgebraVector = iScalar<iScalar<iVector<vtype, AdjointDimension> > >;
|
||||||
|
static int su2subgroups(void) { return su2subgroups(group_name()); }
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Types can be accessed as SU<2>::Matrix , SU<2>::vSUnMatrix,
|
||||||
|
// SU<2>::LatticeMatrix etc...
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
typedef iGroupMatrix<Complex> Matrix;
|
||||||
|
typedef iGroupMatrix<ComplexF> MatrixF;
|
||||||
|
typedef iGroupMatrix<ComplexD> MatrixD;
|
||||||
|
|
||||||
|
typedef iGroupMatrix<vComplex> vMatrix;
|
||||||
|
typedef iGroupMatrix<vComplexF> vMatrixF;
|
||||||
|
typedef iGroupMatrix<vComplexD> vMatrixD;
|
||||||
|
|
||||||
|
// For the projectors to the algebra
|
||||||
|
// these should be real...
|
||||||
|
// keeping complex for consistency with the SIMD vector types
|
||||||
|
typedef iAlgebraVector<Complex> AlgebraVector;
|
||||||
|
typedef iAlgebraVector<ComplexF> AlgebraVectorF;
|
||||||
|
typedef iAlgebraVector<ComplexD> AlgebraVectorD;
|
||||||
|
|
||||||
|
typedef iAlgebraVector<vComplex> vAlgebraVector;
|
||||||
|
typedef iAlgebraVector<vComplexF> vAlgebraVectorF;
|
||||||
|
typedef iAlgebraVector<vComplexD> vAlgebraVectorD;
|
||||||
|
|
||||||
|
typedef Lattice<vMatrix> LatticeMatrix;
|
||||||
|
typedef Lattice<vMatrixF> LatticeMatrixF;
|
||||||
|
typedef Lattice<vMatrixD> LatticeMatrixD;
|
||||||
|
|
||||||
|
typedef Lattice<vAlgebraVector> LatticeAlgebraVector;
|
||||||
|
typedef Lattice<vAlgebraVectorF> LatticeAlgebraVectorF;
|
||||||
|
typedef Lattice<vAlgebraVectorD> LatticeAlgebraVectorD;
|
||||||
|
|
||||||
|
typedef iSU2Matrix<Complex> SU2Matrix;
|
||||||
|
typedef iSU2Matrix<ComplexF> SU2MatrixF;
|
||||||
|
typedef iSU2Matrix<ComplexD> SU2MatrixD;
|
||||||
|
|
||||||
|
typedef iSU2Matrix<vComplex> vSU2Matrix;
|
||||||
|
typedef iSU2Matrix<vComplexF> vSU2MatrixF;
|
||||||
|
typedef iSU2Matrix<vComplexD> vSU2MatrixD;
|
||||||
|
|
||||||
|
typedef Lattice<vSU2Matrix> LatticeSU2Matrix;
|
||||||
|
typedef Lattice<vSU2MatrixF> LatticeSU2MatrixF;
|
||||||
|
typedef Lattice<vSU2MatrixD> LatticeSU2MatrixD;
|
||||||
|
|
||||||
|
// Private implementation details are specified in the following files:
|
||||||
|
// Grid/qcd/utils/SUn.impl
|
||||||
|
// Grid/qcd/utils/SUn.impl
|
||||||
|
// The public part of the interface follows below and refers to these
|
||||||
|
// private member functions.
|
||||||
|
|
||||||
|
#include "Grid/qcd/utils/SUn.impl"
|
||||||
|
#include "Grid/qcd/utils/Sp2n.impl"
|
||||||
|
|
||||||
|
public:
|
||||||
|
template <class cplx>
|
||||||
|
static void generator(int lieIndex, iGroupMatrix<cplx> &ta) {
|
||||||
|
return generator(lieIndex, ta, group_name());
|
||||||
|
}
|
||||||
|
|
||||||
|
static void su2SubGroupIndex(int &i1, int &i2, int su2_index) {
|
||||||
|
return su2SubGroupIndex(i1, i2, su2_index, group_name());
|
||||||
|
}
|
||||||
|
|
||||||
|
static void testGenerators(void) { testGenerators(group_name()); }
|
||||||
|
|
||||||
|
static void printGenerators(void) {
|
||||||
|
for (int gen = 0; gen < AlgebraDimension; gen++) {
|
||||||
|
Matrix ta;
|
||||||
|
generator(gen, ta);
|
||||||
|
std::cout << GridLogMessage << "Nc = " << ncolour << " t_" << gen
|
||||||
|
<< std::endl;
|
||||||
|
std::cout << GridLogMessage << ta << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename LatticeMatrixType>
|
||||||
|
static void LieRandomize(GridParallelRNG &pRNG, LatticeMatrixType &out,
|
||||||
|
double scale = 1.0) {
|
||||||
|
GridBase *grid = out.Grid();
|
||||||
|
|
||||||
|
typedef typename LatticeMatrixType::vector_type vector_type;
|
||||||
|
|
||||||
|
typedef iSinglet<vector_type> vTComplexType;
|
||||||
|
|
||||||
|
typedef Lattice<vTComplexType> LatticeComplexType;
|
||||||
|
typedef typename GridTypeMapper<
|
||||||
|
typename LatticeMatrixType::vector_object>::scalar_object MatrixType;
|
||||||
|
|
||||||
|
LatticeComplexType ca(grid);
|
||||||
|
LatticeMatrixType lie(grid);
|
||||||
|
LatticeMatrixType la(grid);
|
||||||
|
ComplexD ci(0.0, scale);
|
||||||
|
MatrixType ta;
|
||||||
|
|
||||||
|
lie = Zero();
|
||||||
|
|
||||||
|
for (int a = 0; a < AlgebraDimension; a++) {
|
||||||
|
random(pRNG, ca);
|
||||||
|
|
||||||
|
ca = (ca + conjugate(ca)) * 0.5;
|
||||||
|
ca = ca - 0.5;
|
||||||
|
|
||||||
|
generator(a, ta);
|
||||||
|
|
||||||
|
la = ci * ca * ta;
|
||||||
|
|
||||||
|
lie = lie + la; // e^{i la ta}
|
||||||
|
}
|
||||||
|
taExp(lie, out);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GaussianFundamentalLieAlgebraMatrix(GridParallelRNG &pRNG,
|
||||||
|
LatticeMatrix &out,
|
||||||
|
Real scale = 1.0) {
|
||||||
|
GridBase *grid = out.Grid();
|
||||||
|
LatticeReal ca(grid);
|
||||||
|
LatticeMatrix la(grid);
|
||||||
|
Complex ci(0.0, scale);
|
||||||
|
Matrix ta;
|
||||||
|
|
||||||
|
out = Zero();
|
||||||
|
for (int a = 0; a < AlgebraDimension; a++) {
|
||||||
|
gaussian(pRNG, ca);
|
||||||
|
generator(a, ta);
|
||||||
|
la = toComplex(ca) * ta;
|
||||||
|
out += la;
|
||||||
|
}
|
||||||
|
out *= ci;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FundamentalLieAlgebraMatrix(const LatticeAlgebraVector &h,
|
||||||
|
LatticeMatrix &out,
|
||||||
|
Real scale = 1.0) {
|
||||||
|
conformable(h, out);
|
||||||
|
GridBase *grid = out.Grid();
|
||||||
|
LatticeMatrix la(grid);
|
||||||
|
Matrix ta;
|
||||||
|
|
||||||
|
out = Zero();
|
||||||
|
for (int a = 0; a < AlgebraDimension; a++) {
|
||||||
|
generator(a, ta);
|
||||||
|
la = peekColour(h, a) * timesI(ta) * scale;
|
||||||
|
out += la;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Projects the algebra components a lattice matrix (of dimension ncol*ncol -1
|
||||||
|
// ) inverse operation: FundamentalLieAlgebraMatrix
|
||||||
|
static void projectOnAlgebra(LatticeAlgebraVector &h_out,
|
||||||
|
const LatticeMatrix &in, Real scale = 1.0) {
|
||||||
|
conformable(h_out, in);
|
||||||
|
h_out = Zero();
|
||||||
|
Matrix Ta;
|
||||||
|
|
||||||
|
for (int a = 0; a < AlgebraDimension; a++) {
|
||||||
|
generator(a, Ta);
|
||||||
|
pokeColour(h_out, -2.0 * (trace(timesI(Ta) * in)) * scale, a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class vtype>
|
||||||
|
accelerator_inline static iScalar<vtype> ProjectOnGeneralGroup(const iScalar<vtype> &r) {
|
||||||
|
return ProjectOnGeneralGroup(r, group_name());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class vtype, int N>
|
||||||
|
accelerator_inline static iVector<vtype,N> ProjectOnGeneralGroup(const iVector<vtype,N> &r) {
|
||||||
|
return ProjectOnGeneralGroup(r, group_name());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class vtype,int N, typename std::enable_if< GridTypeMapper<vtype>::TensorLevel == 0 >::type * =nullptr>
|
||||||
|
accelerator_inline static iMatrix<vtype,N> ProjectOnGeneralGroup(const iMatrix<vtype,N> &arg) {
|
||||||
|
return ProjectOnGeneralGroup(arg, group_name());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <int N,class vComplex_t> // Projects on the general groups U(N), Sp(2N)xZ2 i.e. determinant is allowed a complex phase.
|
||||||
|
static void ProjectOnGeneralGroup(Lattice<iVector<iScalar<iMatrix<vComplex_t, N> >, Nd> > &U) {
|
||||||
|
for (int mu = 0; mu < Nd; mu++) {
|
||||||
|
auto Umu = PeekIndex<LorentzIndex>(U, mu);
|
||||||
|
Umu = ProjectOnGeneralGroup(Umu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template <int N,class vComplex_t>
|
||||||
|
static Lattice<iScalar<iScalar<iMatrix<vComplex_t, N> > > > ProjectOnGeneralGroup(const Lattice<iScalar<iScalar<iMatrix<vComplex_t, N> > > > &Umu) {
|
||||||
|
return ProjectOnGeneralGroup(Umu, group_name());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <int N,class vComplex_t> // Projects on SU(N), Sp(2N), with unit determinant, by first projecting on general group and then enforcing unit determinant
|
||||||
|
static void ProjectOnSpecialGroup(Lattice<iScalar<iScalar<iMatrix<vComplex_t, N> > > > &Umu) {
|
||||||
|
Umu = ProjectOnGeneralGroup(Umu);
|
||||||
|
auto det = Determinant(Umu);
|
||||||
|
|
||||||
|
det = conjugate(det);
|
||||||
|
|
||||||
|
for (int i = 0; i < N; i++) {
|
||||||
|
auto element = PeekIndex<ColourIndex>(Umu, N - 1, i);
|
||||||
|
element = element * det;
|
||||||
|
PokeIndex<ColourIndex>(Umu, element, Nc - 1, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <int N,class vComplex_t> // reunitarise, resimplectify... previously ProjectSUn
|
||||||
|
static void ProjectOnSpecialGroup(Lattice<iVector<iScalar<iMatrix<vComplex_t, N> >, Nd> > &U) {
|
||||||
|
// Reunitarise
|
||||||
|
for (int mu = 0; mu < Nd; mu++) {
|
||||||
|
auto Umu = PeekIndex<LorentzIndex>(U, mu);
|
||||||
|
ProjectOnSpecialGroup(Umu);
|
||||||
|
PokeIndex<LorentzIndex>(U, Umu, mu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename GaugeField>
|
||||||
|
static void HotConfiguration(GridParallelRNG &pRNG, GaugeField &out) {
|
||||||
|
typedef typename GaugeField::vector_type vector_type;
|
||||||
|
typedef iGroupMatrix<vector_type> vMatrixType;
|
||||||
|
typedef Lattice<vMatrixType> LatticeMatrixType;
|
||||||
|
|
||||||
|
LatticeMatrixType Umu(out.Grid());
|
||||||
|
LatticeMatrixType tmp(out.Grid());
|
||||||
|
for (int mu = 0; mu < Nd; mu++) {
|
||||||
|
// LieRandomize(pRNG, Umu, 1.0);
|
||||||
|
// PokeIndex<LorentzIndex>(out, Umu, mu);
|
||||||
|
gaussian(pRNG,Umu);
|
||||||
|
tmp = Ta(Umu);
|
||||||
|
taExp(tmp,Umu);
|
||||||
|
ProjectOnSpecialGroup(Umu);
|
||||||
|
// ProjectSUn(Umu);
|
||||||
|
PokeIndex<LorentzIndex>(out, Umu, mu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
template <typename GaugeField>
|
||||||
|
static void TepidConfiguration(GridParallelRNG &pRNG, GaugeField &out) {
|
||||||
|
typedef typename GaugeField::vector_type vector_type;
|
||||||
|
typedef iGroupMatrix<vector_type> vMatrixType;
|
||||||
|
typedef Lattice<vMatrixType> LatticeMatrixType;
|
||||||
|
|
||||||
|
LatticeMatrixType Umu(out.Grid());
|
||||||
|
for (int mu = 0; mu < Nd; mu++) {
|
||||||
|
LieRandomize(pRNG, Umu, 0.01);
|
||||||
|
PokeIndex<LorentzIndex>(out, Umu, mu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename GaugeField>
|
||||||
|
static void ColdConfiguration(GaugeField &out) {
|
||||||
|
typedef typename GaugeField::vector_type vector_type;
|
||||||
|
typedef iGroupMatrix<vector_type> vMatrixType;
|
||||||
|
typedef Lattice<vMatrixType> LatticeMatrixType;
|
||||||
|
|
||||||
|
LatticeMatrixType Umu(out.Grid());
|
||||||
|
Umu = 1.0;
|
||||||
|
for (int mu = 0; mu < Nd; mu++) {
|
||||||
|
PokeIndex<LorentzIndex>(out, Umu, mu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename GaugeField>
|
||||||
|
static void ColdConfiguration(GridParallelRNG &pRNG, GaugeField &out) {
|
||||||
|
ColdConfiguration(out);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename LatticeMatrixType>
|
||||||
|
static void taProj(const LatticeMatrixType &in, LatticeMatrixType &out) {
|
||||||
|
taProj(in, out, group_name());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename LatticeMatrixType>
|
||||||
|
static void taExp(const LatticeMatrixType &x, LatticeMatrixType &ex) {
|
||||||
|
typedef typename LatticeMatrixType::scalar_type ComplexType;
|
||||||
|
|
||||||
|
LatticeMatrixType xn(x.Grid());
|
||||||
|
RealD nfac = 1.0;
|
||||||
|
|
||||||
|
xn = x;
|
||||||
|
ex = xn + ComplexType(1.0); // 1+x
|
||||||
|
|
||||||
|
// Do a 12th order exponentiation
|
||||||
|
for (int i = 2; i <= 12; ++i) {
|
||||||
|
nfac = nfac / RealD(i); // 1/2, 1/2.3 ...
|
||||||
|
xn = xn * x; // x2, x3,x4....
|
||||||
|
ex = ex + xn * nfac; // x2/2!, x3/3!....
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
template <int ncolour>
|
||||||
|
using SU = GaugeGroup<ncolour, GroupName::SU>;
|
||||||
|
|
||||||
|
template <int ncolour>
|
||||||
|
using Sp = GaugeGroup<ncolour, GroupName::Sp>;
|
||||||
|
|
||||||
|
typedef SU<2> SU2;
|
||||||
|
typedef SU<3> SU3;
|
||||||
|
typedef SU<4> SU4;
|
||||||
|
typedef SU<5> SU5;
|
||||||
|
|
||||||
|
typedef SU<Nc> FundamentalMatrices;
|
||||||
|
|
||||||
|
typedef Sp<2> Sp2;
|
||||||
|
typedef Sp<4> Sp4;
|
||||||
|
typedef Sp<6> Sp6;
|
||||||
|
typedef Sp<8> Sp8;
|
||||||
|
|
||||||
|
template <int N,class vComplex_t>
|
||||||
|
static void ProjectSUn(Lattice<iScalar<iScalar<iMatrix<vComplex_t, N> > > > &Umu)
|
||||||
|
{
|
||||||
|
GaugeGroup<N,GroupName::SU>::ProjectOnSpecialGroup(Umu);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <int N,class vComplex_t>
|
||||||
|
static void ProjectSUn(Lattice<iVector<iScalar<iMatrix<vComplex_t, N> >,Nd> > &U)
|
||||||
|
{
|
||||||
|
GaugeGroup<N,GroupName::SU>::ProjectOnSpecialGroup(U);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <int N,class vComplex_t>
|
||||||
|
static void ProjectSpn(Lattice<iScalar<iScalar<iMatrix<vComplex_t, N> > > > &Umu)
|
||||||
|
{
|
||||||
|
GaugeGroup<N,GroupName::Sp>::ProjectOnSpecialGroup(Umu);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <int N,class vComplex_t>
|
||||||
|
static void ProjectSpn(Lattice<iVector<iScalar<iMatrix<vComplex_t, N> >,Nd> > &U)
|
||||||
|
{
|
||||||
|
GaugeGroup<N,GroupName::Sp>::ProjectOnSpecialGroup(U);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Explicit specialisation for SU(3).
|
||||||
|
static void ProjectSU3(Lattice<iScalar<iScalar<iMatrix<vComplexD, 3> > > > &Umu)
|
||||||
|
{
|
||||||
|
GridBase *grid = Umu.Grid();
|
||||||
|
const int x = 0;
|
||||||
|
const int y = 1;
|
||||||
|
const int z = 2;
|
||||||
|
// Reunitarise
|
||||||
|
Umu = ProjectOnGroup(Umu);
|
||||||
|
autoView(Umu_v, Umu, CpuWrite);
|
||||||
|
thread_for(ss, grid->oSites(), {
|
||||||
|
auto cm = Umu_v[ss];
|
||||||
|
cm()()(2, x) = adj(cm()()(0, y) * cm()()(1, z) -
|
||||||
|
cm()()(0, z) * cm()()(1, y)); // x= yz-zy
|
||||||
|
cm()()(2, y) = adj(cm()()(0, z) * cm()()(1, x) -
|
||||||
|
cm()()(0, x) * cm()()(1, z)); // y= zx-xz
|
||||||
|
cm()()(2, z) = adj(cm()()(0, x) * cm()()(1, y) -
|
||||||
|
cm()()(0, y) * cm()()(1, x)); // z= xy-yx
|
||||||
|
Umu_v[ss] = cm;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
static void ProjectSU3(Lattice<iVector<iScalar<iMatrix<vComplexD, 3> >, Nd> > &U)
|
||||||
|
{
|
||||||
|
GridBase *grid = U.Grid();
|
||||||
|
// Reunitarise
|
||||||
|
for (int mu = 0; mu < Nd; mu++) {
|
||||||
|
auto Umu = PeekIndex<LorentzIndex>(U, mu);
|
||||||
|
Umu = ProjectOnGroup(Umu);
|
||||||
|
ProjectSU3(Umu);
|
||||||
|
PokeIndex<LorentzIndex>(U, Umu, mu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NAMESPACE_END(Grid);
|
||||||
|
#endif
|
371
Grid/qcd/utils/GaugeGroupTwoIndex.h
Normal file
371
Grid/qcd/utils/GaugeGroupTwoIndex.h
Normal file
@ -0,0 +1,371 @@
|
|||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// * Two index representation generators
|
||||||
|
//
|
||||||
|
// * Normalisation for the fundamental generators:
|
||||||
|
// trace ta tb = 1/2 delta_ab = T_F delta_ab
|
||||||
|
// T_F = 1/2 for SU(N) groups
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// base for NxN two index (anti-symmetric) matrices
|
||||||
|
// normalized to 1 (d_ij is the kroenecker delta)
|
||||||
|
//
|
||||||
|
// (e^(ij)_{kl} = 1 / sqrt(2) (d_ik d_jl +/- d_jk d_il)
|
||||||
|
//
|
||||||
|
// Then the generators are written as
|
||||||
|
//
|
||||||
|
// (iT_a)^(ij)(lk) = i * ( tr[e^(ij)^dag e^(lk) T^trasp_a] +
|
||||||
|
// tr[e^(lk)e^(ij)^dag T_a] ) //
|
||||||
|
//
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// Authors: David Preti, Guido Cossu
|
||||||
|
|
||||||
|
#ifndef QCD_UTIL_GAUGEGROUPTWOINDEX_H
|
||||||
|
#define QCD_UTIL_GAUGEGROUPTWOINDEX_H
|
||||||
|
|
||||||
|
NAMESPACE_BEGIN(Grid);
|
||||||
|
|
||||||
|
enum TwoIndexSymmetry { Symmetric = 1, AntiSymmetric = -1 };
|
||||||
|
|
||||||
|
constexpr inline Real delta(int a, int b) { return (a == b) ? 1.0 : 0.0; }
|
||||||
|
|
||||||
|
namespace detail {
|
||||||
|
|
||||||
|
template <class cplx, int nc, TwoIndexSymmetry S>
|
||||||
|
struct baseOffDiagonalSpHelper;
|
||||||
|
|
||||||
|
template <class cplx, int nc>
|
||||||
|
struct baseOffDiagonalSpHelper<cplx, nc, AntiSymmetric> {
|
||||||
|
static const int ngroup = nc / 2;
|
||||||
|
static void baseOffDiagonalSp(int i, int j, iScalar<iScalar<iMatrix<cplx, nc> > > &eij) {
|
||||||
|
eij = Zero();
|
||||||
|
RealD tmp;
|
||||||
|
|
||||||
|
if ((i == ngroup + j) && (1 <= j) && (j < ngroup)) {
|
||||||
|
for (int k = 0; k < j+1; k++) {
|
||||||
|
if (k < j) {
|
||||||
|
tmp = 1 / sqrt(j * (j + 1));
|
||||||
|
eij()()(k, k + ngroup) = tmp;
|
||||||
|
eij()()(k + ngroup, k) = -tmp;
|
||||||
|
}
|
||||||
|
if (k == j) {
|
||||||
|
tmp = -j / sqrt(j * (j + 1));
|
||||||
|
eij()()(k, k + ngroup) = tmp;
|
||||||
|
eij()()(k + ngroup, k) = -tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (i != ngroup + j) {
|
||||||
|
for (int k = 0; k < nc; k++)
|
||||||
|
for (int l = 0; l < nc; l++) {
|
||||||
|
eij()()(l, k) =
|
||||||
|
delta(i, k) * delta(j, l) - delta(j, k) * delta(i, l);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RealD nrm = 1. / std::sqrt(2.0);
|
||||||
|
eij = eij * nrm;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class cplx, int nc>
|
||||||
|
struct baseOffDiagonalSpHelper<cplx, nc, Symmetric> {
|
||||||
|
static void baseOffDiagonalSp(int i, int j, iScalar<iScalar<iMatrix<cplx, nc> > > &eij) {
|
||||||
|
eij = Zero();
|
||||||
|
for (int k = 0; k < nc; k++)
|
||||||
|
for (int l = 0; l < nc; l++)
|
||||||
|
eij()()(l, k) =
|
||||||
|
delta(i, k) * delta(j, l) + delta(j, k) * delta(i, l);
|
||||||
|
|
||||||
|
RealD nrm = 1. / std::sqrt(2.0);
|
||||||
|
eij = eij * nrm;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // closing detail namespace
|
||||||
|
|
||||||
|
template <int ncolour, TwoIndexSymmetry S, class group_name>
|
||||||
|
class GaugeGroupTwoIndex : public GaugeGroup<ncolour, group_name> {
|
||||||
|
public:
|
||||||
|
// The chosen convention is that we are taking ncolour to be N in SU<N> but 2N
|
||||||
|
// in Sp(2N). ngroup is equal to N for SU but 2N/2 = N for Sp(2N).
|
||||||
|
static_assert(std::is_same<group_name, GroupName::SU>::value or
|
||||||
|
std::is_same<group_name, GroupName::Sp>::value,
|
||||||
|
"ngroup is only implemented for SU and Sp currently.");
|
||||||
|
static const int ngroup =
|
||||||
|
std::is_same<group_name, GroupName::SU>::value ? ncolour : ncolour / 2;
|
||||||
|
static const int Dimension =
|
||||||
|
(ncolour * (ncolour + S) / 2) + (std::is_same<group_name, GroupName::Sp>::value ? (S - 1) / 2 : 0);
|
||||||
|
static const int DimensionAS =
|
||||||
|
(ncolour * (ncolour - 1) / 2) + (std::is_same<group_name, GroupName::Sp>::value ? (- 1) : 0);
|
||||||
|
static const int DimensionS =
|
||||||
|
ncolour * (ncolour + 1) / 2;
|
||||||
|
static const int NumGenerators =
|
||||||
|
GaugeGroup<ncolour, group_name>::AlgebraDimension;
|
||||||
|
|
||||||
|
template <typename vtype>
|
||||||
|
using iGroupTwoIndexMatrix = iScalar<iScalar<iMatrix<vtype, Dimension> > >;
|
||||||
|
|
||||||
|
typedef iGroupTwoIndexMatrix<Complex> TIMatrix;
|
||||||
|
typedef iGroupTwoIndexMatrix<ComplexF> TIMatrixF;
|
||||||
|
typedef iGroupTwoIndexMatrix<ComplexD> TIMatrixD;
|
||||||
|
|
||||||
|
typedef iGroupTwoIndexMatrix<vComplex> vTIMatrix;
|
||||||
|
typedef iGroupTwoIndexMatrix<vComplexF> vTIMatrixF;
|
||||||
|
typedef iGroupTwoIndexMatrix<vComplexD> vTIMatrixD;
|
||||||
|
|
||||||
|
typedef Lattice<vTIMatrix> LatticeTwoIndexMatrix;
|
||||||
|
typedef Lattice<vTIMatrixF> LatticeTwoIndexMatrixF;
|
||||||
|
typedef Lattice<vTIMatrixD> LatticeTwoIndexMatrixD;
|
||||||
|
|
||||||
|
typedef Lattice<iVector<iScalar<iMatrix<vComplex, Dimension> >, Nd> >
|
||||||
|
LatticeTwoIndexField;
|
||||||
|
typedef Lattice<iVector<iScalar<iMatrix<vComplexF, Dimension> >, Nd> >
|
||||||
|
LatticeTwoIndexFieldF;
|
||||||
|
typedef Lattice<iVector<iScalar<iMatrix<vComplexD, Dimension> >, Nd> >
|
||||||
|
LatticeTwoIndexFieldD;
|
||||||
|
|
||||||
|
template <typename vtype>
|
||||||
|
using iGroupMatrix = iScalar<iScalar<iMatrix<vtype, ncolour> > >;
|
||||||
|
|
||||||
|
typedef iGroupMatrix<Complex> Matrix;
|
||||||
|
typedef iGroupMatrix<ComplexF> MatrixF;
|
||||||
|
typedef iGroupMatrix<ComplexD> MatrixD;
|
||||||
|
|
||||||
|
private:
|
||||||
|
template <class cplx>
|
||||||
|
static void baseDiagonal(int Index, iGroupMatrix<cplx> &eij) {
|
||||||
|
eij = Zero();
|
||||||
|
eij()()(Index - ncolour * (ncolour - 1) / 2,
|
||||||
|
Index - ncolour * (ncolour - 1) / 2) = 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class cplx>
|
||||||
|
static void baseOffDiagonal(int i, int j, iGroupMatrix<cplx> &eij, GroupName::SU) {
|
||||||
|
eij = Zero();
|
||||||
|
for (int k = 0; k < ncolour; k++)
|
||||||
|
for (int l = 0; l < ncolour; l++)
|
||||||
|
eij()()(l, k) =
|
||||||
|
delta(i, k) * delta(j, l) + S * delta(j, k) * delta(i, l);
|
||||||
|
|
||||||
|
RealD nrm = 1. / std::sqrt(2.0);
|
||||||
|
eij = eij * nrm;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class cplx>
|
||||||
|
static void baseOffDiagonal(int i, int j, iGroupMatrix<cplx> &eij, GroupName::Sp) {
|
||||||
|
detail::baseOffDiagonalSpHelper<cplx, ncolour, S>::baseOffDiagonalSp(i, j, eij);
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
template <class cplx>
|
||||||
|
static void base(int Index, iGroupMatrix<cplx> &eij) {
|
||||||
|
// returns (e)^(ij)_{kl} necessary for change of base U_F -> U_R
|
||||||
|
assert(Index < Dimension);
|
||||||
|
eij = Zero();
|
||||||
|
// for the linearisation of the 2 indexes
|
||||||
|
static int a[ncolour * (ncolour - 1) / 2][2]; // store the a <-> i,j
|
||||||
|
static bool filled = false;
|
||||||
|
if (!filled) {
|
||||||
|
int counter = 0;
|
||||||
|
for (int i = 1; i < ncolour; i++) {
|
||||||
|
for (int j = 0; j < i; j++) {
|
||||||
|
if (std::is_same<group_name, GroupName::Sp>::value)
|
||||||
|
{
|
||||||
|
if (j==0 && i==ngroup+j && S==-1) {
|
||||||
|
//std::cout << "skipping" << std::endl; // for Sp2n this vanishes identically.
|
||||||
|
j = j+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
a[counter][0] = i;
|
||||||
|
a[counter][1] = j;
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
filled = true;
|
||||||
|
}
|
||||||
|
if (Index < ncolour*ncolour - DimensionS)
|
||||||
|
{
|
||||||
|
baseOffDiagonal(a[Index][0], a[Index][1], eij, group_name());
|
||||||
|
} else {
|
||||||
|
baseDiagonal(Index, eij);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void printBase(void) {
|
||||||
|
for (int gen = 0; gen < Dimension; gen++) {
|
||||||
|
Matrix tmp;
|
||||||
|
base(gen, tmp);
|
||||||
|
std::cout << GridLogMessage << "Nc = " << ncolour << " t_" << gen
|
||||||
|
<< std::endl;
|
||||||
|
std::cout << GridLogMessage << tmp << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class cplx>
|
||||||
|
static void generator(int Index, iGroupTwoIndexMatrix<cplx> &i2indTa) {
|
||||||
|
Vector<iGroupMatrix<cplx> > ta(NumGenerators);
|
||||||
|
Vector<iGroupMatrix<cplx> > eij(Dimension);
|
||||||
|
iGroupMatrix<cplx> tmp;
|
||||||
|
|
||||||
|
for (int a = 0; a < NumGenerators; a++)
|
||||||
|
GaugeGroup<ncolour, group_name>::generator(a, ta[a]);
|
||||||
|
|
||||||
|
for (int a = 0; a < Dimension; a++) base(a, eij[a]);
|
||||||
|
|
||||||
|
for (int a = 0; a < Dimension; a++) {
|
||||||
|
tmp = transpose(eij[a]*ta[Index]) + transpose(eij[a]) * ta[Index];
|
||||||
|
for (int b = 0; b < Dimension; b++) {
|
||||||
|
Complex iTr = TensorRemove(timesI(trace(tmp * eij[b])));
|
||||||
|
i2indTa()()(a, b) = iTr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void printGenerators(void) {
|
||||||
|
for (int gen = 0; gen < NumGenerators; gen++) {
|
||||||
|
TIMatrix i2indTa;
|
||||||
|
generator(gen, i2indTa);
|
||||||
|
std::cout << GridLogMessage << "Nc = " << ncolour << " t_" << gen
|
||||||
|
<< std::endl;
|
||||||
|
std::cout << GridLogMessage << i2indTa << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void testGenerators(void) {
|
||||||
|
TIMatrix i2indTa, i2indTb;
|
||||||
|
std::cout << GridLogMessage << "2IndexRep - Checking if traceless"
|
||||||
|
<< std::endl;
|
||||||
|
for (int a = 0; a < NumGenerators; a++) {
|
||||||
|
generator(a, i2indTa);
|
||||||
|
std::cout << GridLogMessage << a << std::endl;
|
||||||
|
assert(norm2(trace(i2indTa)) < 1.0e-6);
|
||||||
|
}
|
||||||
|
std::cout << GridLogMessage << std::endl;
|
||||||
|
|
||||||
|
std::cout << GridLogMessage << "2IndexRep - Checking if antihermitean"
|
||||||
|
<< std::endl;
|
||||||
|
for (int a = 0; a < NumGenerators; a++) {
|
||||||
|
generator(a, i2indTa);
|
||||||
|
std::cout << GridLogMessage << a << std::endl;
|
||||||
|
assert(norm2(adj(i2indTa) + i2indTa) < 1.0e-6);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << GridLogMessage << std::endl;
|
||||||
|
std::cout << GridLogMessage
|
||||||
|
<< "2IndexRep - Checking Tr[Ta*Tb]=delta(a,b)*(N +- 2)/2"
|
||||||
|
<< std::endl;
|
||||||
|
for (int a = 0; a < NumGenerators; a++) {
|
||||||
|
for (int b = 0; b < NumGenerators; b++) {
|
||||||
|
generator(a, i2indTa);
|
||||||
|
generator(b, i2indTb);
|
||||||
|
|
||||||
|
// generator returns iTa, so we need a minus sign here
|
||||||
|
Complex Tr = -TensorRemove(trace(i2indTa * i2indTb));
|
||||||
|
std::cout << GridLogMessage << "a=" << a << "b=" << b << "Tr=" << Tr
|
||||||
|
<< std::endl;
|
||||||
|
if (a == b) {
|
||||||
|
assert(real(Tr) - ((ncolour + S * 2) * 0.5) < 1e-8);
|
||||||
|
} else {
|
||||||
|
assert(real(Tr) < 1e-8);
|
||||||
|
}
|
||||||
|
assert(imag(Tr) < 1e-8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cout << GridLogMessage << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void TwoIndexLieAlgebraMatrix(
|
||||||
|
const typename GaugeGroup<ncolour, group_name>::LatticeAlgebraVector &h,
|
||||||
|
LatticeTwoIndexMatrix &out, Real scale = 1.0) {
|
||||||
|
conformable(h, out);
|
||||||
|
GridBase *grid = out.Grid();
|
||||||
|
LatticeTwoIndexMatrix la(grid);
|
||||||
|
TIMatrix i2indTa;
|
||||||
|
|
||||||
|
out = Zero();
|
||||||
|
for (int a = 0; a < NumGenerators; a++) {
|
||||||
|
generator(a, i2indTa);
|
||||||
|
la = peekColour(h, a) * i2indTa;
|
||||||
|
out += la;
|
||||||
|
}
|
||||||
|
out *= scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Projects the algebra components
|
||||||
|
// of a lattice matrix ( of dimension ncol*ncol -1 )
|
||||||
|
static void projectOnAlgebra(
|
||||||
|
typename GaugeGroup<ncolour, group_name>::LatticeAlgebraVector &h_out,
|
||||||
|
const LatticeTwoIndexMatrix &in, Real scale = 1.0) {
|
||||||
|
conformable(h_out, in);
|
||||||
|
h_out = Zero();
|
||||||
|
TIMatrix i2indTa;
|
||||||
|
Real coefficient = -2.0 / (ncolour + 2 * S) * scale;
|
||||||
|
// 2/(Nc +/- 2) for the normalization of the trace in the two index rep
|
||||||
|
for (int a = 0; a < NumGenerators; a++) {
|
||||||
|
generator(a, i2indTa);
|
||||||
|
pokeColour(h_out, real(trace(i2indTa * in)) * coefficient, a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// a projector that keeps the generators stored to avoid the overhead of
|
||||||
|
// recomputing them
|
||||||
|
static void projector(
|
||||||
|
typename GaugeGroup<ncolour, group_name>::LatticeAlgebraVector &h_out,
|
||||||
|
const LatticeTwoIndexMatrix &in, Real scale = 1.0) {
|
||||||
|
conformable(h_out, in);
|
||||||
|
// to store the generators
|
||||||
|
static std::vector<TIMatrix> i2indTa(NumGenerators);
|
||||||
|
h_out = Zero();
|
||||||
|
static bool precalculated = false;
|
||||||
|
if (!precalculated) {
|
||||||
|
precalculated = true;
|
||||||
|
for (int a = 0; a < NumGenerators; a++) generator(a, i2indTa[a]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Real coefficient =
|
||||||
|
-2.0 / (ncolour + 2 * S) * scale; // 2/(Nc +/- 2) for the normalization
|
||||||
|
// of the trace in the two index rep
|
||||||
|
|
||||||
|
for (int a = 0; a < NumGenerators; a++) {
|
||||||
|
auto tmp = real(trace(i2indTa[a] * in)) * coefficient;
|
||||||
|
pokeColour(h_out, tmp, a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <int ncolour, TwoIndexSymmetry S>
|
||||||
|
using SU_TwoIndex = GaugeGroupTwoIndex<ncolour, S, GroupName::SU>;
|
||||||
|
|
||||||
|
// Some useful type names
|
||||||
|
typedef SU_TwoIndex<Nc, Symmetric> TwoIndexSymmMatrices;
|
||||||
|
typedef SU_TwoIndex<Nc, AntiSymmetric> TwoIndexAntiSymmMatrices;
|
||||||
|
|
||||||
|
typedef SU_TwoIndex<2, Symmetric> SU2TwoIndexSymm;
|
||||||
|
typedef SU_TwoIndex<3, Symmetric> SU3TwoIndexSymm;
|
||||||
|
typedef SU_TwoIndex<4, Symmetric> SU4TwoIndexSymm;
|
||||||
|
typedef SU_TwoIndex<5, Symmetric> SU5TwoIndexSymm;
|
||||||
|
|
||||||
|
typedef SU_TwoIndex<2, AntiSymmetric> SU2TwoIndexAntiSymm;
|
||||||
|
typedef SU_TwoIndex<3, AntiSymmetric> SU3TwoIndexAntiSymm;
|
||||||
|
typedef SU_TwoIndex<4, AntiSymmetric> SU4TwoIndexAntiSymm;
|
||||||
|
typedef SU_TwoIndex<5, AntiSymmetric> SU5TwoIndexAntiSymm;
|
||||||
|
|
||||||
|
template <int ncolour, TwoIndexSymmetry S>
|
||||||
|
using Sp_TwoIndex = GaugeGroupTwoIndex<ncolour, S, GroupName::Sp>;
|
||||||
|
|
||||||
|
typedef Sp_TwoIndex<Nc, Symmetric> SpTwoIndexSymmMatrices;
|
||||||
|
typedef Sp_TwoIndex<Nc, AntiSymmetric> SpTwoIndexAntiSymmMatrices;
|
||||||
|
|
||||||
|
typedef Sp_TwoIndex<2, Symmetric> Sp2TwoIndexSymm;
|
||||||
|
typedef Sp_TwoIndex<4, Symmetric> Sp4TwoIndexSymm;
|
||||||
|
|
||||||
|
typedef Sp_TwoIndex<4, AntiSymmetric> Sp4TwoIndexAntiSymm;
|
||||||
|
|
||||||
|
NAMESPACE_END(Grid);
|
||||||
|
|
||||||
|
#endif
|
@ -1,932 +0,0 @@
|
|||||||
/*************************************************************************************
|
|
||||||
|
|
||||||
Grid physics library, www.github.com/paboyle/Grid
|
|
||||||
|
|
||||||
Source file: ./lib/qcd/utils/SUn.h
|
|
||||||
|
|
||||||
Copyright (C) 2015
|
|
||||||
|
|
||||||
Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk>
|
|
||||||
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
|
||||||
Author: neo <cossu@post.kek.jp>
|
|
||||||
Author: paboyle <paboyle@ph.ed.ac.uk>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License along
|
|
||||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
|
|
||||||
See the full license in the file "LICENSE" in the top level distribution
|
|
||||||
directory
|
|
||||||
*************************************************************************************/
|
|
||||||
/* END LEGAL */
|
|
||||||
#ifndef QCD_UTIL_SUN_H
|
|
||||||
#define QCD_UTIL_SUN_H
|
|
||||||
|
|
||||||
NAMESPACE_BEGIN(Grid);
|
|
||||||
|
|
||||||
template<int N, class Vec>
|
|
||||||
Lattice<iScalar<iScalar<iScalar<Vec> > > > Determinant(const Lattice<iScalar<iScalar<iMatrix<Vec, N> > > > &Umu)
|
|
||||||
{
|
|
||||||
GridBase *grid=Umu.Grid();
|
|
||||||
auto lvol = grid->lSites();
|
|
||||||
Lattice<iScalar<iScalar<iScalar<Vec> > > > ret(grid);
|
|
||||||
typedef typename Vec::scalar_type scalar;
|
|
||||||
autoView(Umu_v,Umu,CpuRead);
|
|
||||||
autoView(ret_v,ret,CpuWrite);
|
|
||||||
thread_for(site,lvol,{
|
|
||||||
Eigen::MatrixXcd EigenU = Eigen::MatrixXcd::Zero(N,N);
|
|
||||||
Coordinate lcoor;
|
|
||||||
grid->LocalIndexToLocalCoor(site, lcoor);
|
|
||||||
iScalar<iScalar<iMatrix<scalar, N> > > Us;
|
|
||||||
peekLocalSite(Us, Umu_v, lcoor);
|
|
||||||
for(int i=0;i<N;i++){
|
|
||||||
for(int j=0;j<N;j++){
|
|
||||||
scalar tmp= Us()()(i,j);
|
|
||||||
ComplexD ztmp(real(tmp),imag(tmp));
|
|
||||||
EigenU(i,j)=ztmp;
|
|
||||||
}}
|
|
||||||
ComplexD detD = EigenU.determinant();
|
|
||||||
typename Vec::scalar_type det(detD.real(),detD.imag());
|
|
||||||
pokeLocalSite(det,ret_v,lcoor);
|
|
||||||
});
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<int N, class Vec>
|
|
||||||
static void ProjectSUn(Lattice<iScalar<iScalar<iMatrix<Vec, N> > > > &Umu)
|
|
||||||
{
|
|
||||||
Umu = ProjectOnGroup(Umu);
|
|
||||||
auto det = Determinant(Umu);
|
|
||||||
|
|
||||||
det = conjugate(det);
|
|
||||||
|
|
||||||
for(int i=0;i<N;i++){
|
|
||||||
auto element = PeekIndex<ColourIndex>(Umu,N-1,i);
|
|
||||||
element = element * det;
|
|
||||||
PokeIndex<ColourIndex>(Umu,element,Nc-1,i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
template<int N,class Vec>
|
|
||||||
static void ProjectSUn(Lattice<iVector<iScalar<iMatrix<Vec, N> >,Nd> > &U)
|
|
||||||
{
|
|
||||||
GridBase *grid=U.Grid();
|
|
||||||
// Reunitarise
|
|
||||||
for(int mu=0;mu<Nd;mu++){
|
|
||||||
auto Umu = PeekIndex<LorentzIndex>(U,mu);
|
|
||||||
Umu = ProjectOnGroup(Umu);
|
|
||||||
ProjectSUn(Umu);
|
|
||||||
PokeIndex<LorentzIndex>(U,Umu,mu);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <int ncolour>
|
|
||||||
class SU {
|
|
||||||
public:
|
|
||||||
static const int Dimension = ncolour;
|
|
||||||
static const int AdjointDimension = ncolour * ncolour - 1;
|
|
||||||
static int su2subgroups(void) { return (ncolour * (ncolour - 1)) / 2; }
|
|
||||||
|
|
||||||
template <typename vtype>
|
|
||||||
using iSUnMatrix = iScalar<iScalar<iMatrix<vtype, ncolour> > >;
|
|
||||||
template <typename vtype>
|
|
||||||
using iSU2Matrix = iScalar<iScalar<iMatrix<vtype, 2> > >;
|
|
||||||
template <typename vtype>
|
|
||||||
using iSUnAlgebraVector =
|
|
||||||
iScalar<iScalar<iVector<vtype, AdjointDimension> > >;
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Types can be accessed as SU<2>::Matrix , SU<2>::vSUnMatrix,
|
|
||||||
// SU<2>::LatticeMatrix etc...
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
typedef iSUnMatrix<Complex> Matrix;
|
|
||||||
typedef iSUnMatrix<ComplexF> MatrixF;
|
|
||||||
typedef iSUnMatrix<ComplexD> MatrixD;
|
|
||||||
|
|
||||||
typedef iSUnMatrix<vComplex> vMatrix;
|
|
||||||
typedef iSUnMatrix<vComplexF> vMatrixF;
|
|
||||||
typedef iSUnMatrix<vComplexD> vMatrixD;
|
|
||||||
|
|
||||||
// For the projectors to the algebra
|
|
||||||
// these should be real...
|
|
||||||
// keeping complex for consistency with the SIMD vector types
|
|
||||||
typedef iSUnAlgebraVector<Complex> AlgebraVector;
|
|
||||||
typedef iSUnAlgebraVector<ComplexF> AlgebraVectorF;
|
|
||||||
typedef iSUnAlgebraVector<ComplexD> AlgebraVectorD;
|
|
||||||
|
|
||||||
typedef iSUnAlgebraVector<vComplex> vAlgebraVector;
|
|
||||||
typedef iSUnAlgebraVector<vComplexF> vAlgebraVectorF;
|
|
||||||
typedef iSUnAlgebraVector<vComplexD> vAlgebraVectorD;
|
|
||||||
|
|
||||||
typedef Lattice<vMatrix> LatticeMatrix;
|
|
||||||
typedef Lattice<vMatrixF> LatticeMatrixF;
|
|
||||||
typedef Lattice<vMatrixD> LatticeMatrixD;
|
|
||||||
|
|
||||||
typedef Lattice<vAlgebraVector> LatticeAlgebraVector;
|
|
||||||
typedef Lattice<vAlgebraVectorF> LatticeAlgebraVectorF;
|
|
||||||
typedef Lattice<vAlgebraVectorD> LatticeAlgebraVectorD;
|
|
||||||
|
|
||||||
typedef iSU2Matrix<Complex> SU2Matrix;
|
|
||||||
typedef iSU2Matrix<ComplexF> SU2MatrixF;
|
|
||||||
typedef iSU2Matrix<ComplexD> SU2MatrixD;
|
|
||||||
|
|
||||||
typedef iSU2Matrix<vComplex> vSU2Matrix;
|
|
||||||
typedef iSU2Matrix<vComplexF> vSU2MatrixF;
|
|
||||||
typedef iSU2Matrix<vComplexD> vSU2MatrixD;
|
|
||||||
|
|
||||||
typedef Lattice<vSU2Matrix> LatticeSU2Matrix;
|
|
||||||
typedef Lattice<vSU2MatrixF> LatticeSU2MatrixF;
|
|
||||||
typedef Lattice<vSU2MatrixD> LatticeSU2MatrixD;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
// There are N^2-1 generators for SU(N).
|
|
||||||
//
|
|
||||||
// We take a traceless hermitian generator basis as follows
|
|
||||||
//
|
|
||||||
// * Normalisation: trace ta tb = 1/2 delta_ab = T_F delta_ab
|
|
||||||
// T_F = 1/2 for SU(N) groups
|
|
||||||
//
|
|
||||||
// * Off diagonal
|
|
||||||
// - pairs of rows i1,i2 behaving like pauli matrices signma_x, sigma_y
|
|
||||||
//
|
|
||||||
// - there are (Nc-1-i1) slots for i2 on each row [ x 0 x ]
|
|
||||||
// direct count off each row
|
|
||||||
//
|
|
||||||
// - Sum of all pairs is Nc(Nc-1)/2: proof arithmetic series
|
|
||||||
//
|
|
||||||
// (Nc-1) + (Nc-2)+... 1 ==> Nc*(Nc-1)/2
|
|
||||||
// 1+ 2+ + + Nc-1
|
|
||||||
//
|
|
||||||
// - There are 2 x Nc (Nc-1)/ 2 of these = Nc^2 - Nc
|
|
||||||
//
|
|
||||||
// - We enumerate the row-col pairs.
|
|
||||||
// - for each row col pair there is a (sigma_x) and a (sigma_y) like
|
|
||||||
// generator
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// t^a_ij = { in 0.. Nc(Nc-1)/2 -1} => 1/2(delta_{i,i1} delta_{j,i2} +
|
|
||||||
// delta_{i,i1} delta_{j,i2})
|
|
||||||
// t^a_ij = { in Nc(Nc-1)/2 ... Nc(Nc-1) - 1} => i/2( delta_{i,i1}
|
|
||||||
// delta_{j,i2} - i delta_{i,i1} delta_{j,i2})
|
|
||||||
//
|
|
||||||
// * Diagonal; must be traceless and normalised
|
|
||||||
// - Sequence is
|
|
||||||
// N (1,-1,0,0...)
|
|
||||||
// N (1, 1,-2,0...)
|
|
||||||
// N (1, 1, 1,-3,0...)
|
|
||||||
// N (1, 1, 1, 1,-4,0...)
|
|
||||||
//
|
|
||||||
// where 1/2 = N^2 (1+.. m^2)etc.... for the m-th diagonal generator
|
|
||||||
// NB this gives the famous SU3 result for su2 index 8
|
|
||||||
//
|
|
||||||
// N= sqrt(1/2 . 1/6 ) = 1/2 . 1/sqrt(3)
|
|
||||||
//
|
|
||||||
// ( 1 )
|
|
||||||
// ( 1 ) / sqrt(3) /2 = 1/2 lambda_8
|
|
||||||
// ( -2)
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
template <class cplx>
|
|
||||||
static void generator(int lieIndex, iSUnMatrix<cplx> &ta) {
|
|
||||||
// map lie index to which type of generator
|
|
||||||
int diagIndex;
|
|
||||||
int su2Index;
|
|
||||||
int sigxy;
|
|
||||||
int NNm1 = ncolour * (ncolour - 1);
|
|
||||||
if (lieIndex >= NNm1) {
|
|
||||||
diagIndex = lieIndex - NNm1;
|
|
||||||
generatorDiagonal(diagIndex, ta);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
sigxy = lieIndex & 0x1; // even or odd
|
|
||||||
su2Index = lieIndex >> 1;
|
|
||||||
if (sigxy)
|
|
||||||
generatorSigmaY(su2Index, ta);
|
|
||||||
else
|
|
||||||
generatorSigmaX(su2Index, ta);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class cplx>
|
|
||||||
static void generatorSigmaY(int su2Index, iSUnMatrix<cplx> &ta) {
|
|
||||||
ta = Zero();
|
|
||||||
int i1, i2;
|
|
||||||
su2SubGroupIndex(i1, i2, su2Index);
|
|
||||||
ta()()(i1, i2) = 1.0;
|
|
||||||
ta()()(i2, i1) = 1.0;
|
|
||||||
ta = ta * 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class cplx>
|
|
||||||
static void generatorSigmaX(int su2Index, iSUnMatrix<cplx> &ta) {
|
|
||||||
ta = Zero();
|
|
||||||
cplx i(0.0, 1.0);
|
|
||||||
int i1, i2;
|
|
||||||
su2SubGroupIndex(i1, i2, su2Index);
|
|
||||||
ta()()(i1, i2) = i;
|
|
||||||
ta()()(i2, i1) = -i;
|
|
||||||
ta = ta * 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class cplx>
|
|
||||||
static void generatorDiagonal(int diagIndex, iSUnMatrix<cplx> &ta) {
|
|
||||||
// diag ({1, 1, ..., 1}(k-times), -k, 0, 0, ...)
|
|
||||||
ta = Zero();
|
|
||||||
int k = diagIndex + 1; // diagIndex starts from 0
|
|
||||||
for (int i = 0; i <= diagIndex; i++) { // k iterations
|
|
||||||
ta()()(i, i) = 1.0;
|
|
||||||
}
|
|
||||||
ta()()(k, k) = -k; // indexing starts from 0
|
|
||||||
RealD nrm = 1.0 / std::sqrt(2.0 * k * (k + 1));
|
|
||||||
ta = ta * nrm;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
// Map a su2 subgroup number to the pair of rows that are non zero
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
static void su2SubGroupIndex(int &i1, int &i2, int su2_index) {
|
|
||||||
assert((su2_index >= 0) && (su2_index < (ncolour * (ncolour - 1)) / 2));
|
|
||||||
|
|
||||||
int spare = su2_index;
|
|
||||||
for (i1 = 0; spare >= (ncolour - 1 - i1); i1++) {
|
|
||||||
spare = spare - (ncolour - 1 - i1); // remove the Nc-1-i1 terms
|
|
||||||
}
|
|
||||||
i2 = i1 + 1 + spare;
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Pull out a subgroup and project on to real coeffs x pauli basis
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
template <class vcplx>
|
|
||||||
static void su2Extract(Lattice<iSinglet<vcplx> > &Determinant,
|
|
||||||
Lattice<iSU2Matrix<vcplx> > &subgroup,
|
|
||||||
const Lattice<iSUnMatrix<vcplx> > &source,
|
|
||||||
int su2_index) {
|
|
||||||
GridBase *grid(source.Grid());
|
|
||||||
conformable(subgroup, source);
|
|
||||||
conformable(subgroup, Determinant);
|
|
||||||
int i0, i1;
|
|
||||||
su2SubGroupIndex(i0, i1, su2_index);
|
|
||||||
|
|
||||||
autoView( subgroup_v , subgroup,AcceleratorWrite);
|
|
||||||
autoView( source_v , source,AcceleratorRead);
|
|
||||||
autoView( Determinant_v , Determinant,AcceleratorWrite);
|
|
||||||
accelerator_for(ss, grid->oSites(), 1, {
|
|
||||||
|
|
||||||
subgroup_v[ss]()()(0, 0) = source_v[ss]()()(i0, i0);
|
|
||||||
subgroup_v[ss]()()(0, 1) = source_v[ss]()()(i0, i1);
|
|
||||||
subgroup_v[ss]()()(1, 0) = source_v[ss]()()(i1, i0);
|
|
||||||
subgroup_v[ss]()()(1, 1) = source_v[ss]()()(i1, i1);
|
|
||||||
|
|
||||||
iSU2Matrix<vcplx> Sigma = subgroup_v[ss];
|
|
||||||
|
|
||||||
Sigma = Sigma - adj(Sigma) + trace(adj(Sigma));
|
|
||||||
|
|
||||||
subgroup_v[ss] = Sigma;
|
|
||||||
|
|
||||||
// this should be purely real
|
|
||||||
Determinant_v[ss] =
|
|
||||||
Sigma()()(0, 0) * Sigma()()(1, 1) - Sigma()()(0, 1) * Sigma()()(1, 0);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Set matrix to one and insert a pauli subgroup
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
template <class vcplx>
|
|
||||||
static void su2Insert(const Lattice<iSU2Matrix<vcplx> > &subgroup,
|
|
||||||
Lattice<iSUnMatrix<vcplx> > &dest, int su2_index) {
|
|
||||||
GridBase *grid(dest.Grid());
|
|
||||||
conformable(subgroup, dest);
|
|
||||||
int i0, i1;
|
|
||||||
su2SubGroupIndex(i0, i1, su2_index);
|
|
||||||
|
|
||||||
dest = 1.0; // start out with identity
|
|
||||||
autoView( dest_v , dest, AcceleratorWrite);
|
|
||||||
autoView( subgroup_v, subgroup, AcceleratorRead);
|
|
||||||
accelerator_for(ss, grid->oSites(),1,
|
|
||||||
{
|
|
||||||
dest_v[ss]()()(i0, i0) = subgroup_v[ss]()()(0, 0);
|
|
||||||
dest_v[ss]()()(i0, i1) = subgroup_v[ss]()()(0, 1);
|
|
||||||
dest_v[ss]()()(i1, i0) = subgroup_v[ss]()()(1, 0);
|
|
||||||
dest_v[ss]()()(i1, i1) = subgroup_v[ss]()()(1, 1);
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////
|
|
||||||
// Generate e^{ Re Tr Staple Link} dlink
|
|
||||||
//
|
|
||||||
// *** Note Staple should be appropriate linear compbination between all
|
|
||||||
// staples.
|
|
||||||
// *** If already by beta pass coefficient 1.0.
|
|
||||||
// *** This routine applies the additional 1/Nc factor that comes after trace
|
|
||||||
// in action.
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////
|
|
||||||
static void SubGroupHeatBath(GridSerialRNG &sRNG, GridParallelRNG &pRNG,
|
|
||||||
RealD beta, // coeff multiplying staple in action (with no 1/Nc)
|
|
||||||
LatticeMatrix &link,
|
|
||||||
const LatticeMatrix &barestaple, // multiplied by action coeffs so th
|
|
||||||
int su2_subgroup, int nheatbath, LatticeInteger &wheremask)
|
|
||||||
{
|
|
||||||
GridBase *grid = link.Grid();
|
|
||||||
|
|
||||||
const RealD twopi = 2.0 * M_PI;
|
|
||||||
|
|
||||||
LatticeMatrix staple(grid);
|
|
||||||
|
|
||||||
staple = barestaple * (beta / ncolour);
|
|
||||||
|
|
||||||
LatticeMatrix V(grid);
|
|
||||||
V = link * staple;
|
|
||||||
|
|
||||||
// Subgroup manipulation in the lie algebra space
|
|
||||||
LatticeSU2Matrix u(grid); // Kennedy pendleton "u" real projected normalised Sigma
|
|
||||||
LatticeSU2Matrix uinv(grid);
|
|
||||||
LatticeSU2Matrix ua(grid); // a in pauli form
|
|
||||||
LatticeSU2Matrix b(grid); // rotated matrix after hb
|
|
||||||
|
|
||||||
// Some handy constant fields
|
|
||||||
LatticeComplex ones(grid);
|
|
||||||
ones = 1.0;
|
|
||||||
LatticeComplex zeros(grid);
|
|
||||||
zeros = Zero();
|
|
||||||
LatticeReal rones(grid);
|
|
||||||
rones = 1.0;
|
|
||||||
LatticeReal rzeros(grid);
|
|
||||||
rzeros = Zero();
|
|
||||||
LatticeComplex udet(grid); // determinant of real(staple)
|
|
||||||
LatticeInteger mask_true(grid);
|
|
||||||
mask_true = 1;
|
|
||||||
LatticeInteger mask_false(grid);
|
|
||||||
mask_false = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
PLB 156 P393 (1985) (Kennedy and Pendleton)
|
|
||||||
|
|
||||||
Note: absorb "beta" into the def of sigma compared to KP paper; staple
|
|
||||||
passed to this routine has "beta" already multiplied in
|
|
||||||
|
|
||||||
Action linear in links h and of form:
|
|
||||||
|
|
||||||
beta S = beta Sum_p (1 - 1/Nc Re Tr Plaq )
|
|
||||||
|
|
||||||
Writing Sigma = 1/Nc (beta Sigma') where sum over staples is "Sigma' "
|
|
||||||
|
|
||||||
beta S = const - beta/Nc Re Tr h Sigma'
|
|
||||||
= const - Re Tr h Sigma
|
|
||||||
|
|
||||||
Decompose h and Sigma into (1, sigma_j) ; h_i real, h^2=1, Sigma_i complex
|
|
||||||
arbitrary.
|
|
||||||
|
|
||||||
Tr h Sigma = h_i Sigma_j Tr (sigma_i sigma_j) = h_i Sigma_j 2 delta_ij
|
|
||||||
Re Tr h Sigma = 2 h_j Re Sigma_j
|
|
||||||
|
|
||||||
Normalised re Sigma_j = xi u_j
|
|
||||||
|
|
||||||
With u_j a unit vector and U can be in SU(2);
|
|
||||||
|
|
||||||
Re Tr h Sigma = 2 h_j Re Sigma_j = 2 xi (h.u)
|
|
||||||
|
|
||||||
4xi^2 = Det [ Sig - Sig^dag + 1 Tr Sigdag]
|
|
||||||
u = 1/2xi [ Sig - Sig^dag + 1 Tr Sigdag]
|
|
||||||
|
|
||||||
xi = sqrt(Det)/2;
|
|
||||||
|
|
||||||
Write a= u h in SU(2); a has pauli decomp a_j;
|
|
||||||
|
|
||||||
Note: Product b' xi is unvariant because scaling Sigma leaves
|
|
||||||
normalised vector "u" fixed; Can rescale Sigma so b' = 1.
|
|
||||||
*/
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
|
||||||
// Real part of Pauli decomposition
|
|
||||||
// Note a subgroup can project to zero in cold start
|
|
||||||
////////////////////////////////////////////////////////
|
|
||||||
su2Extract(udet, u, V, su2_subgroup);
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////
|
|
||||||
// Normalising this vector if possible; else identity
|
|
||||||
//////////////////////////////////////////////////////
|
|
||||||
LatticeComplex xi(grid);
|
|
||||||
|
|
||||||
LatticeSU2Matrix lident(grid);
|
|
||||||
|
|
||||||
SU2Matrix ident = Complex(1.0);
|
|
||||||
SU2Matrix pauli1;
|
|
||||||
SU<2>::generator(0, pauli1);
|
|
||||||
SU2Matrix pauli2;
|
|
||||||
SU<2>::generator(1, pauli2);
|
|
||||||
SU2Matrix pauli3;
|
|
||||||
SU<2>::generator(2, pauli3);
|
|
||||||
pauli1 = timesI(pauli1) * 2.0;
|
|
||||||
pauli2 = timesI(pauli2) * 2.0;
|
|
||||||
pauli3 = timesI(pauli3) * 2.0;
|
|
||||||
|
|
||||||
LatticeComplex cone(grid);
|
|
||||||
LatticeReal adet(grid);
|
|
||||||
adet = abs(toReal(udet));
|
|
||||||
lident = Complex(1.0);
|
|
||||||
cone = Complex(1.0);
|
|
||||||
Real machine_epsilon = 1.0e-7;
|
|
||||||
u = where(adet > machine_epsilon, u, lident);
|
|
||||||
udet = where(adet > machine_epsilon, udet, cone);
|
|
||||||
|
|
||||||
xi = 0.5 * sqrt(udet); // 4xi^2 = Det [ Sig - Sig^dag + 1 Tr Sigdag]
|
|
||||||
u = 0.5 * u *
|
|
||||||
pow(xi, -1.0); // u = 1/2xi [ Sig - Sig^dag + 1 Tr Sigdag]
|
|
||||||
|
|
||||||
// Debug test for sanity
|
|
||||||
uinv = adj(u);
|
|
||||||
b = u * uinv - 1.0;
|
|
||||||
assert(norm2(b) < 1.0e-4);
|
|
||||||
|
|
||||||
/*
|
|
||||||
Measure: Haar measure dh has d^4a delta(1-|a^2|)
|
|
||||||
In polars:
|
|
||||||
da = da0 r^2 sin theta dr dtheta dphi delta( 1 - r^2 -a0^2)
|
|
||||||
= da0 r^2 sin theta dr dtheta dphi delta( (sqrt(1-a0^) - r)(sqrt(1-a0^) +
|
|
||||||
r) )
|
|
||||||
= da0 r/2 sin theta dr dtheta dphi delta( (sqrt(1-a0^) - r) )
|
|
||||||
|
|
||||||
Action factor Q(h) dh = e^-S[h] dh = e^{ xi Tr uh} dh // beta enters
|
|
||||||
through xi
|
|
||||||
= e^{2 xi (h.u)} dh
|
|
||||||
= e^{2 xi h0u0}.e^{2 xi h1u1}.e^{2 xi
|
|
||||||
h2u2}.e^{2 xi h3u3} dh
|
|
||||||
|
|
||||||
Therefore for each site, take xi for that site
|
|
||||||
i) generate |a0|<1 with dist
|
|
||||||
(1-a0^2)^0.5 e^{2 xi a0 } da0
|
|
||||||
|
|
||||||
Take alpha = 2 xi = 2 xi [ recall 2 beta/Nc unmod staple norm]; hence 2.0/Nc
|
|
||||||
factor in Chroma ]
|
|
||||||
A. Generate two uniformly distributed pseudo-random numbers R and R', R'',
|
|
||||||
R''' in the unit interval;
|
|
||||||
B. Set X = -(ln R)/alpha, X' =-(ln R')/alpha;
|
|
||||||
C. Set C = cos^2(2pi R"), with R" another uniform random number in [0,1] ;
|
|
||||||
D. Set A = XC;
|
|
||||||
E. Let d = X'+A;
|
|
||||||
F. If R'''^2 :> 1 - 0.5 d, go back to A;
|
|
||||||
G. Set a0 = 1 - d;
|
|
||||||
|
|
||||||
Note that in step D setting B ~ X - A and using B in place of A in step E will
|
|
||||||
generate a second independent a 0 value.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////
|
|
||||||
// count the number of sites by picking "1"'s out of hat
|
|
||||||
/////////////////////////////////////////////////////////
|
|
||||||
Integer hit = 0;
|
|
||||||
LatticeReal rtmp(grid);
|
|
||||||
rtmp = where(wheremask, rones, rzeros);
|
|
||||||
RealD numSites = sum(rtmp);
|
|
||||||
RealD numAccepted;
|
|
||||||
LatticeInteger Accepted(grid);
|
|
||||||
Accepted = Zero();
|
|
||||||
LatticeInteger newlyAccepted(grid);
|
|
||||||
|
|
||||||
std::vector<LatticeReal> xr(4, grid);
|
|
||||||
std::vector<LatticeReal> a(4, grid);
|
|
||||||
LatticeReal d(grid);
|
|
||||||
d = Zero();
|
|
||||||
LatticeReal alpha(grid);
|
|
||||||
|
|
||||||
// std::cout<<GridLogMessage<<"xi "<<xi <<std::endl;
|
|
||||||
xi = 2.0 *xi;
|
|
||||||
alpha = toReal(xi);
|
|
||||||
|
|
||||||
do {
|
|
||||||
// A. Generate two uniformly distributed pseudo-random numbers R and R',
|
|
||||||
// R'', R''' in the unit interval;
|
|
||||||
random(pRNG, xr[0]);
|
|
||||||
random(pRNG, xr[1]);
|
|
||||||
random(pRNG, xr[2]);
|
|
||||||
random(pRNG, xr[3]);
|
|
||||||
|
|
||||||
// B. Set X = - ln R/alpha, X' = -ln R'/alpha
|
|
||||||
xr[1] = -log(xr[1]) / alpha;
|
|
||||||
xr[2] = -log(xr[2]) / alpha;
|
|
||||||
|
|
||||||
// C. Set C = cos^2(2piR'')
|
|
||||||
xr[3] = cos(xr[3] * twopi);
|
|
||||||
xr[3] = xr[3] * xr[3];
|
|
||||||
|
|
||||||
LatticeReal xrsq(grid);
|
|
||||||
|
|
||||||
// D. Set A = XC;
|
|
||||||
// E. Let d = X'+A;
|
|
||||||
xrsq = xr[2] + xr[1] * xr[3];
|
|
||||||
|
|
||||||
d = where(Accepted, d, xr[2] + xr[1] * xr[3]);
|
|
||||||
|
|
||||||
// F. If R'''^2 :> 1 - 0.5 d, go back to A;
|
|
||||||
LatticeReal thresh(grid);
|
|
||||||
thresh = 1.0 - d * 0.5;
|
|
||||||
xrsq = xr[0] * xr[0];
|
|
||||||
LatticeInteger ione(grid);
|
|
||||||
ione = 1;
|
|
||||||
LatticeInteger izero(grid);
|
|
||||||
izero = Zero();
|
|
||||||
|
|
||||||
newlyAccepted = where(xrsq < thresh, ione, izero);
|
|
||||||
Accepted = where(newlyAccepted, newlyAccepted, Accepted);
|
|
||||||
Accepted = where(wheremask, Accepted, izero);
|
|
||||||
|
|
||||||
// FIXME need an iSum for integer to avoid overload on return type??
|
|
||||||
rtmp = where(Accepted, rones, rzeros);
|
|
||||||
numAccepted = sum(rtmp);
|
|
||||||
|
|
||||||
hit++;
|
|
||||||
|
|
||||||
} while ((numAccepted < numSites) && (hit < nheatbath));
|
|
||||||
|
|
||||||
// G. Set a0 = 1 - d;
|
|
||||||
a[0] = Zero();
|
|
||||||
a[0] = where(wheremask, 1.0 - d, a[0]);
|
|
||||||
|
|
||||||
//////////////////////////////////////////
|
|
||||||
// ii) generate a_i uniform on two sphere radius (1-a0^2)^0.5
|
|
||||||
//////////////////////////////////////////
|
|
||||||
|
|
||||||
LatticeReal a123mag(grid);
|
|
||||||
a123mag = sqrt(abs(1.0 - a[0] * a[0]));
|
|
||||||
|
|
||||||
LatticeReal cos_theta(grid);
|
|
||||||
LatticeReal sin_theta(grid);
|
|
||||||
LatticeReal phi(grid);
|
|
||||||
|
|
||||||
random(pRNG, phi);
|
|
||||||
phi = phi * twopi; // uniform in [0,2pi]
|
|
||||||
random(pRNG, cos_theta);
|
|
||||||
cos_theta = (cos_theta * 2.0) - 1.0; // uniform in [-1,1]
|
|
||||||
sin_theta = sqrt(abs(1.0 - cos_theta * cos_theta));
|
|
||||||
|
|
||||||
a[1] = a123mag * sin_theta * cos(phi);
|
|
||||||
a[2] = a123mag * sin_theta * sin(phi);
|
|
||||||
a[3] = a123mag * cos_theta;
|
|
||||||
|
|
||||||
ua = toComplex(a[0]) * ident + toComplex(a[1]) * pauli1 +
|
|
||||||
toComplex(a[2]) * pauli2 + toComplex(a[3]) * pauli3;
|
|
||||||
|
|
||||||
b = 1.0;
|
|
||||||
b = where(wheremask, uinv * ua, b);
|
|
||||||
su2Insert(b, V, su2_subgroup);
|
|
||||||
|
|
||||||
// mask the assignment back based on Accptance
|
|
||||||
link = where(Accepted, V * link, link);
|
|
||||||
|
|
||||||
//////////////////////////////
|
|
||||||
// Debug Checks
|
|
||||||
// SU2 check
|
|
||||||
LatticeSU2Matrix check(grid); // rotated matrix after hb
|
|
||||||
u = Zero();
|
|
||||||
check = ua * adj(ua) - 1.0;
|
|
||||||
check = where(Accepted, check, u);
|
|
||||||
assert(norm2(check) < 1.0e-4);
|
|
||||||
|
|
||||||
check = b * adj(b) - 1.0;
|
|
||||||
check = where(Accepted, check, u);
|
|
||||||
assert(norm2(check) < 1.0e-4);
|
|
||||||
|
|
||||||
LatticeMatrix Vcheck(grid);
|
|
||||||
Vcheck = Zero();
|
|
||||||
Vcheck = where(Accepted, V * adj(V) - 1.0, Vcheck);
|
|
||||||
// std::cout<<GridLogMessage << "SU3 check " <<norm2(Vcheck)<<std::endl;
|
|
||||||
assert(norm2(Vcheck) < 1.0e-4);
|
|
||||||
|
|
||||||
// Verify the link stays in SU(3)
|
|
||||||
// std::cout<<GridLogMessage <<"Checking the modified link"<<std::endl;
|
|
||||||
Vcheck = link * adj(link) - 1.0;
|
|
||||||
assert(norm2(Vcheck) < 1.0e-4);
|
|
||||||
/////////////////////////////////
|
|
||||||
}
|
|
||||||
|
|
||||||
static void printGenerators(void) {
|
|
||||||
for (int gen = 0; gen < AdjointDimension; gen++) {
|
|
||||||
Matrix ta;
|
|
||||||
generator(gen, ta);
|
|
||||||
std::cout << GridLogMessage << "Nc = " << ncolour << " t_" << gen
|
|
||||||
<< std::endl;
|
|
||||||
std::cout << GridLogMessage << ta << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void testGenerators(void) {
|
|
||||||
Matrix ta;
|
|
||||||
Matrix tb;
|
|
||||||
std::cout << GridLogMessage
|
|
||||||
<< "Fundamental - Checking trace ta tb is 0.5 delta_ab"
|
|
||||||
<< std::endl;
|
|
||||||
for (int a = 0; a < AdjointDimension; a++) {
|
|
||||||
for (int b = 0; b < AdjointDimension; b++) {
|
|
||||||
generator(a, ta);
|
|
||||||
generator(b, tb);
|
|
||||||
Complex tr = TensorRemove(trace(ta * tb));
|
|
||||||
std::cout << GridLogMessage << "(" << a << "," << b << ") = " << tr
|
|
||||||
<< std::endl;
|
|
||||||
if (a == b) assert(abs(tr - Complex(0.5)) < 1.0e-6);
|
|
||||||
if (a != b) assert(abs(tr) < 1.0e-6);
|
|
||||||
}
|
|
||||||
std::cout << GridLogMessage << std::endl;
|
|
||||||
}
|
|
||||||
std::cout << GridLogMessage << "Fundamental - Checking if hermitian"
|
|
||||||
<< std::endl;
|
|
||||||
for (int a = 0; a < AdjointDimension; a++) {
|
|
||||||
generator(a, ta);
|
|
||||||
std::cout << GridLogMessage << a << std::endl;
|
|
||||||
assert(norm2(ta - adj(ta)) < 1.0e-6);
|
|
||||||
}
|
|
||||||
std::cout << GridLogMessage << std::endl;
|
|
||||||
|
|
||||||
std::cout << GridLogMessage << "Fundamental - Checking if traceless"
|
|
||||||
<< std::endl;
|
|
||||||
for (int a = 0; a < AdjointDimension; a++) {
|
|
||||||
generator(a, ta);
|
|
||||||
Complex tr = TensorRemove(trace(ta));
|
|
||||||
std::cout << GridLogMessage << a << " " << std::endl;
|
|
||||||
assert(abs(tr) < 1.0e-6);
|
|
||||||
}
|
|
||||||
std::cout << GridLogMessage << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// reunitarise??
|
|
||||||
template <typename LatticeMatrixType>
|
|
||||||
static void LieRandomize(GridParallelRNG &pRNG, LatticeMatrixType &out, double scale = 1.0)
|
|
||||||
{
|
|
||||||
GridBase *grid = out.Grid();
|
|
||||||
|
|
||||||
typedef typename LatticeMatrixType::vector_type vector_type;
|
|
||||||
|
|
||||||
typedef iSinglet<vector_type> vTComplexType;
|
|
||||||
|
|
||||||
typedef Lattice<vTComplexType> LatticeComplexType;
|
|
||||||
typedef typename GridTypeMapper<typename LatticeMatrixType::vector_object>::scalar_object MatrixType;
|
|
||||||
|
|
||||||
LatticeComplexType ca(grid);
|
|
||||||
LatticeMatrixType lie(grid);
|
|
||||||
LatticeMatrixType la(grid);
|
|
||||||
ComplexD ci(0.0, scale);
|
|
||||||
// ComplexD cone(1.0, 0.0);
|
|
||||||
MatrixType ta;
|
|
||||||
|
|
||||||
lie = Zero();
|
|
||||||
|
|
||||||
for (int a = 0; a < AdjointDimension; a++) {
|
|
||||||
random(pRNG, ca);
|
|
||||||
|
|
||||||
ca = (ca + conjugate(ca)) * 0.5;
|
|
||||||
ca = ca - 0.5;
|
|
||||||
|
|
||||||
generator(a, ta);
|
|
||||||
|
|
||||||
la = ci * ca * ta;
|
|
||||||
|
|
||||||
lie = lie + la; // e^{i la ta}
|
|
||||||
|
|
||||||
}
|
|
||||||
taExp(lie, out);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void GaussianFundamentalLieAlgebraMatrix(GridParallelRNG &pRNG,
|
|
||||||
LatticeMatrix &out,
|
|
||||||
Real scale = 1.0) {
|
|
||||||
GridBase *grid = out.Grid();
|
|
||||||
LatticeReal ca(grid);
|
|
||||||
LatticeMatrix la(grid);
|
|
||||||
Complex ci(0.0, scale);
|
|
||||||
Matrix ta;
|
|
||||||
|
|
||||||
out = Zero();
|
|
||||||
for (int a = 0; a < AdjointDimension; a++) {
|
|
||||||
gaussian(pRNG, ca);
|
|
||||||
generator(a, ta);
|
|
||||||
la = toComplex(ca) * ta;
|
|
||||||
out += la;
|
|
||||||
}
|
|
||||||
out *= ci;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void FundamentalLieAlgebraMatrix(const LatticeAlgebraVector &h,
|
|
||||||
LatticeMatrix &out,
|
|
||||||
Real scale = 1.0) {
|
|
||||||
conformable(h, out);
|
|
||||||
GridBase *grid = out.Grid();
|
|
||||||
LatticeMatrix la(grid);
|
|
||||||
Matrix ta;
|
|
||||||
|
|
||||||
out = Zero();
|
|
||||||
for (int a = 0; a < AdjointDimension; a++) {
|
|
||||||
generator(a, ta);
|
|
||||||
la = peekColour(h, a) * timesI(ta) * scale;
|
|
||||||
out += la;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Fundamental rep gauge xform
|
|
||||||
*/
|
|
||||||
template<typename Fundamental,typename GaugeMat>
|
|
||||||
static void GaugeTransformFundamental( Fundamental &ferm, GaugeMat &g){
|
|
||||||
GridBase *grid = ferm._grid;
|
|
||||||
conformable(grid,g._grid);
|
|
||||||
ferm = g*ferm;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Adjoint rep gauge xform
|
|
||||||
*/
|
|
||||||
|
|
||||||
template<typename Gimpl>
|
|
||||||
static void GaugeTransform(typename Gimpl::GaugeField &Umu, typename Gimpl::GaugeLinkField &g){
|
|
||||||
GridBase *grid = Umu.Grid();
|
|
||||||
conformable(grid,g.Grid());
|
|
||||||
|
|
||||||
typename Gimpl::GaugeLinkField U(grid);
|
|
||||||
typename Gimpl::GaugeLinkField ag(grid); ag = adj(g);
|
|
||||||
|
|
||||||
for(int mu=0;mu<Nd;mu++){
|
|
||||||
U= PeekIndex<LorentzIndex>(Umu,mu);
|
|
||||||
U = g*U*Gimpl::CshiftLink(ag, mu, 1); //BC-aware
|
|
||||||
PokeIndex<LorentzIndex>(Umu,U,mu);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
template<typename Gimpl>
|
|
||||||
static void GaugeTransform( std::vector<typename Gimpl::GaugeLinkField> &U, typename Gimpl::GaugeLinkField &g){
|
|
||||||
GridBase *grid = g.Grid();
|
|
||||||
typename Gimpl::GaugeLinkField ag(grid); ag = adj(g);
|
|
||||||
for(int mu=0;mu<Nd;mu++){
|
|
||||||
U[mu] = g*U[mu]*Gimpl::CshiftLink(ag, mu, 1); //BC-aware
|
|
||||||
}
|
|
||||||
}
|
|
||||||
template<typename Gimpl>
|
|
||||||
static void RandomGaugeTransform(GridParallelRNG &pRNG, typename Gimpl::GaugeField &Umu, typename Gimpl::GaugeLinkField &g){
|
|
||||||
LieRandomize(pRNG,g,1.0);
|
|
||||||
GaugeTransform<Gimpl>(Umu,g);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Projects the algebra components a lattice matrix (of dimension ncol*ncol -1 )
|
|
||||||
// inverse operation: FundamentalLieAlgebraMatrix
|
|
||||||
static void projectOnAlgebra(LatticeAlgebraVector &h_out, const LatticeMatrix &in, Real scale = 1.0) {
|
|
||||||
conformable(h_out, in);
|
|
||||||
h_out = Zero();
|
|
||||||
Matrix Ta;
|
|
||||||
|
|
||||||
for (int a = 0; a < AdjointDimension; a++) {
|
|
||||||
generator(a, Ta);
|
|
||||||
pokeColour(h_out, - 2.0 * (trace(timesI(Ta) * in)) * scale, a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename GaugeField>
|
|
||||||
static void HotConfiguration(GridParallelRNG &pRNG, GaugeField &out) {
|
|
||||||
typedef typename GaugeField::vector_type vector_type;
|
|
||||||
typedef iSUnMatrix<vector_type> vMatrixType;
|
|
||||||
typedef Lattice<vMatrixType> LatticeMatrixType;
|
|
||||||
|
|
||||||
LatticeMatrixType Umu(out.Grid());
|
|
||||||
LatticeMatrixType tmp(out.Grid());
|
|
||||||
for (int mu = 0; mu < Nd; mu++) {
|
|
||||||
// LieRandomize(pRNG, Umu, 1.0);
|
|
||||||
// PokeIndex<LorentzIndex>(out, Umu, mu);
|
|
||||||
gaussian(pRNG,Umu);
|
|
||||||
tmp = Ta(Umu);
|
|
||||||
taExp(tmp,Umu);
|
|
||||||
ProjectSUn(Umu);
|
|
||||||
PokeIndex<LorentzIndex>(out, Umu, mu);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
template<typename GaugeField>
|
|
||||||
static void TepidConfiguration(GridParallelRNG &pRNG,GaugeField &out){
|
|
||||||
typedef typename GaugeField::vector_type vector_type;
|
|
||||||
typedef iSUnMatrix<vector_type> vMatrixType;
|
|
||||||
typedef Lattice<vMatrixType> LatticeMatrixType;
|
|
||||||
|
|
||||||
LatticeMatrixType Umu(out.Grid());
|
|
||||||
for(int mu=0;mu<Nd;mu++){
|
|
||||||
LieRandomize(pRNG,Umu,0.01);
|
|
||||||
PokeIndex<LorentzIndex>(out,Umu,mu);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
template<typename GaugeField>
|
|
||||||
static void ColdConfiguration(GaugeField &out){
|
|
||||||
typedef typename GaugeField::vector_type vector_type;
|
|
||||||
typedef iSUnMatrix<vector_type> vMatrixType;
|
|
||||||
typedef Lattice<vMatrixType> LatticeMatrixType;
|
|
||||||
|
|
||||||
LatticeMatrixType Umu(out.Grid());
|
|
||||||
Umu=1.0;
|
|
||||||
for(int mu=0;mu<Nd;mu++){
|
|
||||||
PokeIndex<LorentzIndex>(out,Umu,mu);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
template<typename GaugeField>
|
|
||||||
static void ColdConfiguration(GridParallelRNG &pRNG,GaugeField &out){
|
|
||||||
ColdConfiguration(out);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename LatticeMatrixType>
|
|
||||||
static void taProj( const LatticeMatrixType &in, LatticeMatrixType &out){
|
|
||||||
out = Ta(in);
|
|
||||||
}
|
|
||||||
template <typename LatticeMatrixType>
|
|
||||||
static void taExp(const LatticeMatrixType &x, LatticeMatrixType &ex) {
|
|
||||||
typedef typename LatticeMatrixType::scalar_type ComplexType;
|
|
||||||
|
|
||||||
LatticeMatrixType xn(x.Grid());
|
|
||||||
RealD nfac = 1.0;
|
|
||||||
|
|
||||||
xn = x;
|
|
||||||
ex = xn + ComplexType(1.0); // 1+x
|
|
||||||
|
|
||||||
// Do a 12th order exponentiation
|
|
||||||
for (int i = 2; i <= 12; ++i) {
|
|
||||||
nfac = nfac / RealD(i); // 1/2, 1/2.3 ...
|
|
||||||
xn = xn * x; // x2, x3,x4....
|
|
||||||
ex = ex + xn * nfac; // x2/2!, x3/3!....
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<int N>
|
|
||||||
Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > Inverse(const Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > &Umu)
|
|
||||||
{
|
|
||||||
GridBase *grid=Umu.Grid();
|
|
||||||
auto lvol = grid->lSites();
|
|
||||||
Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > ret(grid);
|
|
||||||
|
|
||||||
autoView(Umu_v,Umu,CpuRead);
|
|
||||||
autoView(ret_v,ret,CpuWrite);
|
|
||||||
thread_for(site,lvol,{
|
|
||||||
Eigen::MatrixXcd EigenU = Eigen::MatrixXcd::Zero(N,N);
|
|
||||||
Coordinate lcoor;
|
|
||||||
grid->LocalIndexToLocalCoor(site, lcoor);
|
|
||||||
iScalar<iScalar<iMatrix<ComplexD, N> > > Us;
|
|
||||||
iScalar<iScalar<iMatrix<ComplexD, N> > > Ui;
|
|
||||||
peekLocalSite(Us, Umu_v, lcoor);
|
|
||||||
for(int i=0;i<N;i++){
|
|
||||||
for(int j=0;j<N;j++){
|
|
||||||
EigenU(i,j) = Us()()(i,j);
|
|
||||||
}}
|
|
||||||
Eigen::MatrixXcd EigenUinv = EigenU.inverse();
|
|
||||||
for(int i=0;i<N;i++){
|
|
||||||
for(int j=0;j<N;j++){
|
|
||||||
Ui()()(i,j) = EigenUinv(i,j);
|
|
||||||
}}
|
|
||||||
pokeLocalSite(Ui,ret_v,lcoor);
|
|
||||||
});
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
// Explicit specialisation for SU(3).
|
|
||||||
// Explicit specialisation for SU(3).
|
|
||||||
static void
|
|
||||||
ProjectSU3 (Lattice<iScalar<iScalar<iMatrix<vComplexD, 3> > > > &Umu)
|
|
||||||
{
|
|
||||||
GridBase *grid=Umu.Grid();
|
|
||||||
const int x=0;
|
|
||||||
const int y=1;
|
|
||||||
const int z=2;
|
|
||||||
// Reunitarise
|
|
||||||
Umu = ProjectOnGroup(Umu);
|
|
||||||
autoView(Umu_v,Umu,CpuWrite);
|
|
||||||
thread_for(ss,grid->oSites(),{
|
|
||||||
auto cm = Umu_v[ss];
|
|
||||||
cm()()(2,x) = adj(cm()()(0,y)*cm()()(1,z)-cm()()(0,z)*cm()()(1,y)); //x= yz-zy
|
|
||||||
cm()()(2,y) = adj(cm()()(0,z)*cm()()(1,x)-cm()()(0,x)*cm()()(1,z)); //y= zx-xz
|
|
||||||
cm()()(2,z) = adj(cm()()(0,x)*cm()()(1,y)-cm()()(0,y)*cm()()(1,x)); //z= xy-yx
|
|
||||||
Umu_v[ss]=cm;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
static void ProjectSU3(Lattice<iVector<iScalar<iMatrix<vComplexD, 3> >,Nd> > &U)
|
|
||||||
{
|
|
||||||
GridBase *grid=U.Grid();
|
|
||||||
// Reunitarise
|
|
||||||
for(int mu=0;mu<Nd;mu++){
|
|
||||||
auto Umu = PeekIndex<LorentzIndex>(U,mu);
|
|
||||||
Umu = ProjectOnGroup(Umu);
|
|
||||||
ProjectSU3(Umu);
|
|
||||||
PokeIndex<LorentzIndex>(U,Umu,mu);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef SU<2> SU2;
|
|
||||||
typedef SU<3> SU3;
|
|
||||||
typedef SU<4> SU4;
|
|
||||||
typedef SU<5> SU5;
|
|
||||||
|
|
||||||
|
|
||||||
typedef SU<Nc> FundamentalMatrices;
|
|
||||||
|
|
||||||
NAMESPACE_END(Grid);
|
|
||||||
#endif
|
|
578
Grid/qcd/utils/SUn.impl
Normal file
578
Grid/qcd/utils/SUn.impl
Normal file
@ -0,0 +1,578 @@
|
|||||||
|
// This file is #included into the body of the class template definition of
|
||||||
|
// GaugeGroup. So, image there to be
|
||||||
|
//
|
||||||
|
// template <int ncolour, class group_name>
|
||||||
|
// class GaugeGroup {
|
||||||
|
//
|
||||||
|
// around it.
|
||||||
|
//
|
||||||
|
// Please note that the unconventional file extension makes sure that it
|
||||||
|
// doesn't get found by the scripts/filelist during bootstrapping.
|
||||||
|
|
||||||
|
private:
|
||||||
|
template <ONLY_IF_SU>
|
||||||
|
static int su2subgroups(GroupName::SU) { return (ncolour * (ncolour - 1)) / 2; }
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
// There are N^2-1 generators for SU(N).
|
||||||
|
//
|
||||||
|
// We take a traceless hermitian generator basis as follows
|
||||||
|
//
|
||||||
|
// * Normalisation: trace ta tb = 1/2 delta_ab = T_F delta_ab
|
||||||
|
// T_F = 1/2 for SU(N) groups
|
||||||
|
//
|
||||||
|
// * Off diagonal
|
||||||
|
// - pairs of rows i1,i2 behaving like pauli matrices signma_x, sigma_y
|
||||||
|
//
|
||||||
|
// - there are (Nc-1-i1) slots for i2 on each row [ x 0 x ]
|
||||||
|
// direct count off each row
|
||||||
|
//
|
||||||
|
// - Sum of all pairs is Nc(Nc-1)/2: proof arithmetic series
|
||||||
|
//
|
||||||
|
// (Nc-1) + (Nc-2)+... 1 ==> Nc*(Nc-1)/2
|
||||||
|
// 1+ 2+ + + Nc-1
|
||||||
|
//
|
||||||
|
// - There are 2 x Nc (Nc-1)/ 2 of these = Nc^2 - Nc
|
||||||
|
//
|
||||||
|
// - We enumerate the row-col pairs.
|
||||||
|
// - for each row col pair there is a (sigma_x) and a (sigma_y) like
|
||||||
|
// generator
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// t^a_ij = { in 0.. Nc(Nc-1)/2 -1} => 1/2(delta_{i,i1} delta_{j,i2} +
|
||||||
|
// delta_{i,i1} delta_{j,i2})
|
||||||
|
// t^a_ij = { in Nc(Nc-1)/2 ... Nc(Nc-1) - 1} => i/2( delta_{i,i1}
|
||||||
|
// delta_{j,i2} - i delta_{i,i1} delta_{j,i2})
|
||||||
|
//
|
||||||
|
// * Diagonal; must be traceless and normalised
|
||||||
|
// - Sequence is
|
||||||
|
// N (1,-1,0,0...)
|
||||||
|
// N (1, 1,-2,0...)
|
||||||
|
// N (1, 1, 1,-3,0...)
|
||||||
|
// N (1, 1, 1, 1,-4,0...)
|
||||||
|
//
|
||||||
|
// where 1/2 = N^2 (1+.. m^2)etc.... for the m-th diagonal generator
|
||||||
|
// NB this gives the famous SU3 result for su2 index 8
|
||||||
|
//
|
||||||
|
// N= sqrt(1/2 . 1/6 ) = 1/2 . 1/sqrt(3)
|
||||||
|
//
|
||||||
|
// ( 1 )
|
||||||
|
// ( 1 ) / sqrt(3) /2 = 1/2 lambda_8
|
||||||
|
// ( -2)
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
template <class cplx, ONLY_IF_SU>
|
||||||
|
static void generator(int lieIndex, iGroupMatrix<cplx> &ta, GroupName::SU) {
|
||||||
|
// map lie index to which type of generator
|
||||||
|
int diagIndex;
|
||||||
|
int su2Index;
|
||||||
|
int sigxy;
|
||||||
|
int NNm1 = ncolour * (ncolour - 1);
|
||||||
|
if (lieIndex >= NNm1) {
|
||||||
|
diagIndex = lieIndex - NNm1;
|
||||||
|
generatorDiagonal(diagIndex, ta);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sigxy = lieIndex & 0x1; // even or odd
|
||||||
|
su2Index = lieIndex >> 1;
|
||||||
|
if (sigxy)
|
||||||
|
generatorSigmaY(su2Index, ta);
|
||||||
|
else
|
||||||
|
generatorSigmaX(su2Index, ta);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class cplx, ONLY_IF_SU>
|
||||||
|
static void generatorSigmaY(int su2Index, iGroupMatrix<cplx> &ta) {
|
||||||
|
ta = Zero();
|
||||||
|
int i1, i2;
|
||||||
|
su2SubGroupIndex(i1, i2, su2Index);
|
||||||
|
ta()()(i1, i2) = 1.0;
|
||||||
|
ta()()(i2, i1) = 1.0;
|
||||||
|
ta = ta * 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class cplx, ONLY_IF_SU>
|
||||||
|
static void generatorSigmaX(int su2Index, iGroupMatrix<cplx> &ta) {
|
||||||
|
ta = Zero();
|
||||||
|
cplx i(0.0, 1.0);
|
||||||
|
int i1, i2;
|
||||||
|
su2SubGroupIndex(i1, i2, su2Index);
|
||||||
|
ta()()(i1, i2) = i;
|
||||||
|
ta()()(i2, i1) = -i;
|
||||||
|
ta = ta * 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class cplx, ONLY_IF_SU>
|
||||||
|
static void generatorDiagonal(int diagIndex, iGroupMatrix<cplx> &ta) {
|
||||||
|
// diag ({1, 1, ..., 1}(k-times), -k, 0, 0, ...)
|
||||||
|
ta = Zero();
|
||||||
|
int k = diagIndex + 1; // diagIndex starts from 0
|
||||||
|
for (int i = 0; i <= diagIndex; i++) { // k iterations
|
||||||
|
ta()()(i, i) = 1.0;
|
||||||
|
}
|
||||||
|
ta()()(k, k) = -k; // indexing starts from 0
|
||||||
|
RealD nrm = 1.0 / std::sqrt(2.0 * k * (k + 1));
|
||||||
|
ta = ta * nrm;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
// Map a su2 subgroup number to the pair of rows that are non zero
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
static void su2SubGroupIndex(int &i1, int &i2, int su2_index, GroupName::SU) {
|
||||||
|
assert((su2_index >= 0) && (su2_index < (ncolour * (ncolour - 1)) / 2));
|
||||||
|
|
||||||
|
int spare = su2_index;
|
||||||
|
for (i1 = 0; spare >= (ncolour - 1 - i1); i1++) {
|
||||||
|
spare = spare - (ncolour - 1 - i1); // remove the Nc-1-i1 terms
|
||||||
|
}
|
||||||
|
i2 = i1 + 1 + spare;
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Pull out a subgroup and project on to real coeffs x pauli basis
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
template <class vcplx, ONLY_IF_SU>
|
||||||
|
static void su2Extract(Lattice<iSinglet<vcplx> > &Determinant,
|
||||||
|
Lattice<iSU2Matrix<vcplx> > &subgroup,
|
||||||
|
const Lattice<iGroupMatrix<vcplx> > &source,
|
||||||
|
int su2_index) {
|
||||||
|
GridBase *grid(source.Grid());
|
||||||
|
conformable(subgroup, source);
|
||||||
|
conformable(subgroup, Determinant);
|
||||||
|
int i0, i1;
|
||||||
|
su2SubGroupIndex(i0, i1, su2_index);
|
||||||
|
|
||||||
|
autoView(subgroup_v, subgroup, AcceleratorWrite);
|
||||||
|
autoView(source_v, source, AcceleratorRead);
|
||||||
|
autoView(Determinant_v, Determinant, AcceleratorWrite);
|
||||||
|
accelerator_for(ss, grid->oSites(), 1, {
|
||||||
|
subgroup_v[ss]()()(0, 0) = source_v[ss]()()(i0, i0);
|
||||||
|
subgroup_v[ss]()()(0, 1) = source_v[ss]()()(i0, i1);
|
||||||
|
subgroup_v[ss]()()(1, 0) = source_v[ss]()()(i1, i0);
|
||||||
|
subgroup_v[ss]()()(1, 1) = source_v[ss]()()(i1, i1);
|
||||||
|
|
||||||
|
iSU2Matrix<vcplx> Sigma = subgroup_v[ss];
|
||||||
|
|
||||||
|
Sigma = Sigma - adj(Sigma) + trace(adj(Sigma));
|
||||||
|
|
||||||
|
subgroup_v[ss] = Sigma;
|
||||||
|
|
||||||
|
// this should be purely real
|
||||||
|
Determinant_v[ss] =
|
||||||
|
Sigma()()(0, 0) * Sigma()()(1, 1) - Sigma()()(0, 1) * Sigma()()(1, 0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Set matrix to one and insert a pauli subgroup
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
template <class vcplx, ONLY_IF_SU>
|
||||||
|
static void su2Insert(const Lattice<iSU2Matrix<vcplx> > &subgroup,
|
||||||
|
Lattice<iGroupMatrix<vcplx> > &dest, int su2_index) {
|
||||||
|
GridBase *grid(dest.Grid());
|
||||||
|
conformable(subgroup, dest);
|
||||||
|
int i0, i1;
|
||||||
|
su2SubGroupIndex(i0, i1, su2_index);
|
||||||
|
|
||||||
|
dest = 1.0; // start out with identity
|
||||||
|
autoView(dest_v, dest, AcceleratorWrite);
|
||||||
|
autoView(subgroup_v, subgroup, AcceleratorRead);
|
||||||
|
accelerator_for(ss, grid->oSites(), 1, {
|
||||||
|
dest_v[ss]()()(i0, i0) = subgroup_v[ss]()()(0, 0);
|
||||||
|
dest_v[ss]()()(i0, i1) = subgroup_v[ss]()()(0, 1);
|
||||||
|
dest_v[ss]()()(i1, i0) = subgroup_v[ss]()()(1, 0);
|
||||||
|
dest_v[ss]()()(i1, i1) = subgroup_v[ss]()()(1, 1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////
|
||||||
|
// Generate e^{ Re Tr Staple Link} dlink
|
||||||
|
//
|
||||||
|
// *** Note Staple should be appropriate linear compbination between all
|
||||||
|
// staples.
|
||||||
|
// *** If already by beta pass coefficient 1.0.
|
||||||
|
// *** This routine applies the additional 1/Nc factor that comes after trace
|
||||||
|
// in action.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////
|
||||||
|
template <ONLY_IF_SU>
|
||||||
|
static void SubGroupHeatBath(
|
||||||
|
GridSerialRNG &sRNG, GridParallelRNG &pRNG,
|
||||||
|
RealD beta, // coeff multiplying staple in action (with no 1/Nc)
|
||||||
|
LatticeMatrix &link,
|
||||||
|
const LatticeMatrix &barestaple, // multiplied by action coeffs so th
|
||||||
|
int su2_subgroup, int nheatbath, LatticeInteger &wheremask) {
|
||||||
|
GridBase *grid = link.Grid();
|
||||||
|
|
||||||
|
const RealD twopi = 2.0 * M_PI;
|
||||||
|
|
||||||
|
LatticeMatrix staple(grid);
|
||||||
|
|
||||||
|
staple = barestaple * (beta / ncolour);
|
||||||
|
|
||||||
|
LatticeMatrix V(grid);
|
||||||
|
V = link * staple;
|
||||||
|
|
||||||
|
// Subgroup manipulation in the lie algebra space
|
||||||
|
LatticeSU2Matrix u(
|
||||||
|
grid); // Kennedy pendleton "u" real projected normalised Sigma
|
||||||
|
LatticeSU2Matrix uinv(grid);
|
||||||
|
LatticeSU2Matrix ua(grid); // a in pauli form
|
||||||
|
LatticeSU2Matrix b(grid); // rotated matrix after hb
|
||||||
|
|
||||||
|
// Some handy constant fields
|
||||||
|
LatticeComplex ones(grid);
|
||||||
|
ones = 1.0;
|
||||||
|
LatticeComplex zeros(grid);
|
||||||
|
zeros = Zero();
|
||||||
|
LatticeReal rones(grid);
|
||||||
|
rones = 1.0;
|
||||||
|
LatticeReal rzeros(grid);
|
||||||
|
rzeros = Zero();
|
||||||
|
LatticeComplex udet(grid); // determinant of real(staple)
|
||||||
|
LatticeInteger mask_true(grid);
|
||||||
|
mask_true = 1;
|
||||||
|
LatticeInteger mask_false(grid);
|
||||||
|
mask_false = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
PLB 156 P393 (1985) (Kennedy and Pendleton)
|
||||||
|
|
||||||
|
Note: absorb "beta" into the def of sigma compared to KP paper; staple
|
||||||
|
passed to this routine has "beta" already multiplied in
|
||||||
|
|
||||||
|
Action linear in links h and of form:
|
||||||
|
|
||||||
|
beta S = beta Sum_p (1 - 1/Nc Re Tr Plaq )
|
||||||
|
|
||||||
|
Writing Sigma = 1/Nc (beta Sigma') where sum over staples is "Sigma' "
|
||||||
|
|
||||||
|
beta S = const - beta/Nc Re Tr h Sigma'
|
||||||
|
= const - Re Tr h Sigma
|
||||||
|
|
||||||
|
Decompose h and Sigma into (1, sigma_j) ; h_i real, h^2=1, Sigma_i complex
|
||||||
|
arbitrary.
|
||||||
|
|
||||||
|
Tr h Sigma = h_i Sigma_j Tr (sigma_i sigma_j) = h_i Sigma_j 2 delta_ij
|
||||||
|
Re Tr h Sigma = 2 h_j Re Sigma_j
|
||||||
|
|
||||||
|
Normalised re Sigma_j = xi u_j
|
||||||
|
|
||||||
|
With u_j a unit vector and U can be in SU(2);
|
||||||
|
|
||||||
|
Re Tr h Sigma = 2 h_j Re Sigma_j = 2 xi (h.u)
|
||||||
|
|
||||||
|
4xi^2 = Det [ Sig - Sig^dag + 1 Tr Sigdag]
|
||||||
|
u = 1/2xi [ Sig - Sig^dag + 1 Tr Sigdag]
|
||||||
|
|
||||||
|
xi = sqrt(Det)/2;
|
||||||
|
|
||||||
|
Write a= u h in SU(2); a has pauli decomp a_j;
|
||||||
|
|
||||||
|
Note: Product b' xi is unvariant because scaling Sigma leaves
|
||||||
|
normalised vector "u" fixed; Can rescale Sigma so b' = 1.
|
||||||
|
*/
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////
|
||||||
|
// Real part of Pauli decomposition
|
||||||
|
// Note a subgroup can project to zero in cold start
|
||||||
|
////////////////////////////////////////////////////////
|
||||||
|
su2Extract(udet, u, V, su2_subgroup);
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////
|
||||||
|
// Normalising this vector if possible; else identity
|
||||||
|
//////////////////////////////////////////////////////
|
||||||
|
LatticeComplex xi(grid);
|
||||||
|
|
||||||
|
LatticeSU2Matrix lident(grid);
|
||||||
|
|
||||||
|
SU2Matrix ident = Complex(1.0);
|
||||||
|
SU2Matrix pauli1;
|
||||||
|
GaugeGroup<2, GroupName::SU>::generator(0, pauli1);
|
||||||
|
SU2Matrix pauli2;
|
||||||
|
GaugeGroup<2, GroupName::SU>::generator(1, pauli2);
|
||||||
|
SU2Matrix pauli3;
|
||||||
|
GaugeGroup<2, GroupName::SU>::generator(2, pauli3);
|
||||||
|
pauli1 = timesI(pauli1) * 2.0;
|
||||||
|
pauli2 = timesI(pauli2) * 2.0;
|
||||||
|
pauli3 = timesI(pauli3) * 2.0;
|
||||||
|
|
||||||
|
LatticeComplex cone(grid);
|
||||||
|
LatticeReal adet(grid);
|
||||||
|
adet = abs(toReal(udet));
|
||||||
|
lident = Complex(1.0);
|
||||||
|
cone = Complex(1.0);
|
||||||
|
Real machine_epsilon = 1.0e-7;
|
||||||
|
u = where(adet > machine_epsilon, u, lident);
|
||||||
|
udet = where(adet > machine_epsilon, udet, cone);
|
||||||
|
|
||||||
|
xi = 0.5 * sqrt(udet); // 4xi^2 = Det [ Sig - Sig^dag + 1 Tr Sigdag]
|
||||||
|
u = 0.5 * u * pow(xi, -1.0); // u = 1/2xi [ Sig - Sig^dag + 1 Tr Sigdag]
|
||||||
|
|
||||||
|
// Debug test for sanity
|
||||||
|
uinv = adj(u);
|
||||||
|
b = u * uinv - 1.0;
|
||||||
|
assert(norm2(b) < 1.0e-4);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Measure: Haar measure dh has d^4a delta(1-|a^2|)
|
||||||
|
In polars:
|
||||||
|
da = da0 r^2 sin theta dr dtheta dphi delta( 1 - r^2 -a0^2)
|
||||||
|
= da0 r^2 sin theta dr dtheta dphi delta( (sqrt(1-a0^) - r)(sqrt(1-a0^) +
|
||||||
|
r) )
|
||||||
|
= da0 r/2 sin theta dr dtheta dphi delta( (sqrt(1-a0^) - r) )
|
||||||
|
|
||||||
|
Action factor Q(h) dh = e^-S[h] dh = e^{ xi Tr uh} dh // beta
|
||||||
|
enters through xi = e^{2 xi (h.u)} dh = e^{2 xi h0u0}.e^{2 xi h1u1}.e^{2
|
||||||
|
xi h2u2}.e^{2 xi h3u3} dh
|
||||||
|
|
||||||
|
Therefore for each site, take xi for that site
|
||||||
|
i) generate |a0|<1 with dist
|
||||||
|
(1-a0^2)^0.5 e^{2 xi a0 } da0
|
||||||
|
|
||||||
|
Take alpha = 2 xi = 2 xi [ recall 2 beta/Nc unmod staple norm];
|
||||||
|
hence 2.0/Nc factor in Chroma ] A. Generate two uniformly distributed
|
||||||
|
pseudo-random numbers R and R', R'', R''' in the unit interval; B. Set X =
|
||||||
|
-(ln R)/alpha, X' =-(ln R')/alpha; C. Set C = cos^2(2pi R"), with R"
|
||||||
|
another uniform random number in [0,1] ; D. Set A = XC; E. Let d = X'+A;
|
||||||
|
F. If R'''^2 :> 1 - 0.5 d, go back to A;
|
||||||
|
G. Set a0 = 1 - d;
|
||||||
|
|
||||||
|
Note that in step D setting B ~ X - A and using B in place of A in step E
|
||||||
|
will generate a second independent a 0 value.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////
|
||||||
|
// count the number of sites by picking "1"'s out of hat
|
||||||
|
/////////////////////////////////////////////////////////
|
||||||
|
Integer hit = 0;
|
||||||
|
LatticeReal rtmp(grid);
|
||||||
|
rtmp = where(wheremask, rones, rzeros);
|
||||||
|
RealD numSites = sum(rtmp);
|
||||||
|
RealD numAccepted;
|
||||||
|
LatticeInteger Accepted(grid);
|
||||||
|
Accepted = Zero();
|
||||||
|
LatticeInteger newlyAccepted(grid);
|
||||||
|
|
||||||
|
std::vector<LatticeReal> xr(4, grid);
|
||||||
|
std::vector<LatticeReal> a(4, grid);
|
||||||
|
LatticeReal d(grid);
|
||||||
|
d = Zero();
|
||||||
|
LatticeReal alpha(grid);
|
||||||
|
|
||||||
|
// std::cout<<GridLogMessage<<"xi "<<xi <<std::endl;
|
||||||
|
xi = 2.0 * xi;
|
||||||
|
alpha = toReal(xi);
|
||||||
|
|
||||||
|
do {
|
||||||
|
// A. Generate two uniformly distributed pseudo-random numbers R and R',
|
||||||
|
// R'', R''' in the unit interval;
|
||||||
|
random(pRNG, xr[0]);
|
||||||
|
random(pRNG, xr[1]);
|
||||||
|
random(pRNG, xr[2]);
|
||||||
|
random(pRNG, xr[3]);
|
||||||
|
|
||||||
|
// B. Set X = - ln R/alpha, X' = -ln R'/alpha
|
||||||
|
xr[1] = -log(xr[1]) / alpha;
|
||||||
|
xr[2] = -log(xr[2]) / alpha;
|
||||||
|
|
||||||
|
// C. Set C = cos^2(2piR'')
|
||||||
|
xr[3] = cos(xr[3] * twopi);
|
||||||
|
xr[3] = xr[3] * xr[3];
|
||||||
|
|
||||||
|
LatticeReal xrsq(grid);
|
||||||
|
|
||||||
|
// D. Set A = XC;
|
||||||
|
// E. Let d = X'+A;
|
||||||
|
xrsq = xr[2] + xr[1] * xr[3];
|
||||||
|
|
||||||
|
d = where(Accepted, d, xr[2] + xr[1] * xr[3]);
|
||||||
|
|
||||||
|
// F. If R'''^2 :> 1 - 0.5 d, go back to A;
|
||||||
|
LatticeReal thresh(grid);
|
||||||
|
thresh = 1.0 - d * 0.5;
|
||||||
|
xrsq = xr[0] * xr[0];
|
||||||
|
LatticeInteger ione(grid);
|
||||||
|
ione = 1;
|
||||||
|
LatticeInteger izero(grid);
|
||||||
|
izero = Zero();
|
||||||
|
|
||||||
|
newlyAccepted = where(xrsq < thresh, ione, izero);
|
||||||
|
Accepted = where(newlyAccepted, newlyAccepted, Accepted);
|
||||||
|
Accepted = where(wheremask, Accepted, izero);
|
||||||
|
|
||||||
|
// FIXME need an iSum for integer to avoid overload on return type??
|
||||||
|
rtmp = where(Accepted, rones, rzeros);
|
||||||
|
numAccepted = sum(rtmp);
|
||||||
|
|
||||||
|
hit++;
|
||||||
|
|
||||||
|
} while ((numAccepted < numSites) && (hit < nheatbath));
|
||||||
|
|
||||||
|
// G. Set a0 = 1 - d;
|
||||||
|
a[0] = Zero();
|
||||||
|
a[0] = where(wheremask, 1.0 - d, a[0]);
|
||||||
|
|
||||||
|
//////////////////////////////////////////
|
||||||
|
// ii) generate a_i uniform on two sphere radius (1-a0^2)^0.5
|
||||||
|
//////////////////////////////////////////
|
||||||
|
|
||||||
|
LatticeReal a123mag(grid);
|
||||||
|
a123mag = sqrt(abs(1.0 - a[0] * a[0]));
|
||||||
|
|
||||||
|
LatticeReal cos_theta(grid);
|
||||||
|
LatticeReal sin_theta(grid);
|
||||||
|
LatticeReal phi(grid);
|
||||||
|
|
||||||
|
random(pRNG, phi);
|
||||||
|
phi = phi * twopi; // uniform in [0,2pi]
|
||||||
|
random(pRNG, cos_theta);
|
||||||
|
cos_theta = (cos_theta * 2.0) - 1.0; // uniform in [-1,1]
|
||||||
|
sin_theta = sqrt(abs(1.0 - cos_theta * cos_theta));
|
||||||
|
|
||||||
|
a[1] = a123mag * sin_theta * cos(phi);
|
||||||
|
a[2] = a123mag * sin_theta * sin(phi);
|
||||||
|
a[3] = a123mag * cos_theta;
|
||||||
|
|
||||||
|
ua = toComplex(a[0]) * ident + toComplex(a[1]) * pauli1 +
|
||||||
|
toComplex(a[2]) * pauli2 + toComplex(a[3]) * pauli3;
|
||||||
|
|
||||||
|
b = 1.0;
|
||||||
|
b = where(wheremask, uinv * ua, b);
|
||||||
|
su2Insert(b, V, su2_subgroup);
|
||||||
|
|
||||||
|
// mask the assignment back based on Accptance
|
||||||
|
link = where(Accepted, V * link, link);
|
||||||
|
|
||||||
|
//////////////////////////////
|
||||||
|
// Debug Checks
|
||||||
|
// SU2 check
|
||||||
|
LatticeSU2Matrix check(grid); // rotated matrix after hb
|
||||||
|
u = Zero();
|
||||||
|
check = ua * adj(ua) - 1.0;
|
||||||
|
check = where(Accepted, check, u);
|
||||||
|
assert(norm2(check) < 1.0e-4);
|
||||||
|
|
||||||
|
check = b * adj(b) - 1.0;
|
||||||
|
check = where(Accepted, check, u);
|
||||||
|
assert(norm2(check) < 1.0e-4);
|
||||||
|
|
||||||
|
LatticeMatrix Vcheck(grid);
|
||||||
|
Vcheck = Zero();
|
||||||
|
Vcheck = where(Accepted, V * adj(V) - 1.0, Vcheck);
|
||||||
|
// std::cout<<GridLogMessage << "SU3 check " <<norm2(Vcheck)<<std::endl;
|
||||||
|
assert(norm2(Vcheck) < 1.0e-4);
|
||||||
|
|
||||||
|
// Verify the link stays in SU(3)
|
||||||
|
// std::cout<<GridLogMessage <<"Checking the modified link"<<std::endl;
|
||||||
|
Vcheck = link * adj(link) - 1.0;
|
||||||
|
assert(norm2(Vcheck) < 1.0e-4);
|
||||||
|
/////////////////////////////////
|
||||||
|
}
|
||||||
|
|
||||||
|
template <ONLY_IF_SU>
|
||||||
|
static void testGenerators(GroupName::SU) {
|
||||||
|
Matrix ta;
|
||||||
|
Matrix tb;
|
||||||
|
std::cout << GridLogMessage
|
||||||
|
<< "Fundamental - Checking trace ta tb is 0.5 delta_ab"
|
||||||
|
<< std::endl;
|
||||||
|
for (int a = 0; a < AdjointDimension; a++) {
|
||||||
|
for (int b = 0; b < AdjointDimension; b++) {
|
||||||
|
generator(a, ta);
|
||||||
|
generator(b, tb);
|
||||||
|
Complex tr = TensorRemove(trace(ta * tb));
|
||||||
|
std::cout << GridLogMessage << "(" << a << "," << b << ") = " << tr
|
||||||
|
<< std::endl;
|
||||||
|
if (a == b) assert(abs(tr - Complex(0.5)) < 1.0e-6);
|
||||||
|
if (a != b) assert(abs(tr) < 1.0e-6);
|
||||||
|
}
|
||||||
|
std::cout << GridLogMessage << std::endl;
|
||||||
|
}
|
||||||
|
std::cout << GridLogMessage << "Fundamental - Checking if hermitian"
|
||||||
|
<< std::endl;
|
||||||
|
for (int a = 0; a < AdjointDimension; a++) {
|
||||||
|
generator(a, ta);
|
||||||
|
std::cout << GridLogMessage << a << std::endl;
|
||||||
|
assert(norm2(ta - adj(ta)) < 1.0e-6);
|
||||||
|
}
|
||||||
|
std::cout << GridLogMessage << std::endl;
|
||||||
|
|
||||||
|
std::cout << GridLogMessage << "Fundamental - Checking if traceless"
|
||||||
|
<< std::endl;
|
||||||
|
for (int a = 0; a < AdjointDimension; a++) {
|
||||||
|
generator(a, ta);
|
||||||
|
Complex tr = TensorRemove(trace(ta));
|
||||||
|
std::cout << GridLogMessage << a << " " << std::endl;
|
||||||
|
assert(abs(tr) < 1.0e-6);
|
||||||
|
}
|
||||||
|
std::cout << GridLogMessage << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <int N, class vtype>
|
||||||
|
static Lattice<iScalar<iScalar<iMatrix<vtype, N> > > >
|
||||||
|
ProjectOnGeneralGroup(const Lattice<iScalar<iScalar<iMatrix<vtype, N> > > > &Umu, GroupName::SU) {
|
||||||
|
return ProjectOnGroup(Umu);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class vtype>
|
||||||
|
accelerator_inline static iScalar<vtype> ProjectOnGeneralGroup(const iScalar<vtype> &r, GroupName::SU) {
|
||||||
|
return ProjectOnGroup(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class vtype, int N>
|
||||||
|
accelerator_inline static iVector<vtype,N> ProjectOnGeneralGroup(const iVector<vtype,N> &r, GroupName::SU) {
|
||||||
|
return ProjectOnGroup(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class vtype,int N, typename std::enable_if< GridTypeMapper<vtype>::TensorLevel == 0 >::type * =nullptr>
|
||||||
|
accelerator_inline static iMatrix<vtype,N> ProjectOnGeneralGroup(const iMatrix<vtype,N> &arg, GroupName::SU) {
|
||||||
|
return ProjectOnGroup(arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename LatticeMatrixType>
|
||||||
|
static void taProj(const LatticeMatrixType &in, LatticeMatrixType &out, GroupName::SU) {
|
||||||
|
out = Ta(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fundamental rep gauge xform
|
||||||
|
*/
|
||||||
|
template<typename Fundamental,typename GaugeMat>
|
||||||
|
static void GaugeTransformFundamental( Fundamental &ferm, GaugeMat &g){
|
||||||
|
GridBase *grid = ferm._grid;
|
||||||
|
conformable(grid,g._grid);
|
||||||
|
ferm = g*ferm;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Adjoint rep gauge xform
|
||||||
|
*/
|
||||||
|
|
||||||
|
template<typename Gimpl>
|
||||||
|
static void GaugeTransform(typename Gimpl::GaugeField &Umu, typename Gimpl::GaugeLinkField &g){
|
||||||
|
GridBase *grid = Umu.Grid();
|
||||||
|
conformable(grid,g.Grid());
|
||||||
|
|
||||||
|
typename Gimpl::GaugeLinkField U(grid);
|
||||||
|
typename Gimpl::GaugeLinkField ag(grid); ag = adj(g);
|
||||||
|
|
||||||
|
for(int mu=0;mu<Nd;mu++){
|
||||||
|
U= PeekIndex<LorentzIndex>(Umu,mu);
|
||||||
|
U = g*U*Gimpl::CshiftLink(ag, mu, 1); //BC-aware
|
||||||
|
PokeIndex<LorentzIndex>(Umu,U,mu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
template<typename Gimpl>
|
||||||
|
static void GaugeTransform( std::vector<typename Gimpl::GaugeLinkField> &U, typename Gimpl::GaugeLinkField &g){
|
||||||
|
GridBase *grid = g.Grid();
|
||||||
|
typename Gimpl::GaugeLinkField ag(grid); ag = adj(g);
|
||||||
|
for(int mu=0;mu<Nd;mu++){
|
||||||
|
U[mu] = g*U[mu]*Gimpl::CshiftLink(ag, mu, 1); //BC-aware
|
||||||
|
}
|
||||||
|
}
|
||||||
|
template<typename Gimpl>
|
||||||
|
static void RandomGaugeTransform(GridParallelRNG &pRNG, typename Gimpl::GaugeField &Umu, typename Gimpl::GaugeLinkField &g){
|
||||||
|
LieRandomize(pRNG,g,1.0);
|
||||||
|
GaugeTransform<Gimpl>(Umu,g);
|
||||||
|
}
|
@ -51,6 +51,10 @@ public:
|
|||||||
typedef Lattice<iVector<iScalar<iMatrix<vComplexF, Dimension> >, Nd> > LatticeAdjFieldF;
|
typedef Lattice<iVector<iScalar<iMatrix<vComplexF, Dimension> >, Nd> > LatticeAdjFieldF;
|
||||||
typedef Lattice<iVector<iScalar<iMatrix<vComplexD, Dimension> >, Nd> > LatticeAdjFieldD;
|
typedef Lattice<iVector<iScalar<iMatrix<vComplexD, Dimension> >, Nd> > LatticeAdjFieldD;
|
||||||
|
|
||||||
|
|
||||||
|
template <typename vtype>
|
||||||
|
using iSUnMatrix = iScalar<iScalar<iMatrix<vtype, ncolour> > >;
|
||||||
|
|
||||||
typedef Lattice<iScalar<iScalar<iVector<vComplex, Dimension> > > > LatticeAdjVector;
|
typedef Lattice<iScalar<iScalar<iVector<vComplex, Dimension> > > > LatticeAdjVector;
|
||||||
|
|
||||||
template <class cplx>
|
template <class cplx>
|
||||||
@ -58,8 +62,8 @@ public:
|
|||||||
// returns i(T_Adj)^index necessary for the projectors
|
// returns i(T_Adj)^index necessary for the projectors
|
||||||
// see definitions above
|
// see definitions above
|
||||||
iAdjTa = Zero();
|
iAdjTa = Zero();
|
||||||
Vector<typename SU<ncolour>::template iSUnMatrix<cplx> > ta(ncolour * ncolour - 1);
|
Vector<iSUnMatrix<cplx> > ta(ncolour * ncolour - 1);
|
||||||
typename SU<ncolour>::template iSUnMatrix<cplx> tmp;
|
iSUnMatrix<cplx> tmp;
|
||||||
|
|
||||||
// FIXME not very efficient to get all the generators everytime
|
// FIXME not very efficient to get all the generators everytime
|
||||||
for (int a = 0; a < Dimension; a++) SU<ncolour>::generator(a, ta[a]);
|
for (int a = 0; a < Dimension; a++) SU<ncolour>::generator(a, ta[a]);
|
||||||
@ -67,8 +71,7 @@ public:
|
|||||||
for (int a = 0; a < Dimension; a++) {
|
for (int a = 0; a < Dimension; a++) {
|
||||||
tmp = ta[a] * ta[Index] - ta[Index] * ta[a];
|
tmp = ta[a] * ta[Index] - ta[Index] * ta[a];
|
||||||
for (int b = 0; b < (ncolour * ncolour - 1); b++) {
|
for (int b = 0; b < (ncolour * ncolour - 1); b++) {
|
||||||
typename SU<ncolour>::template iSUnMatrix<cplx> tmp1 =
|
iSUnMatrix<cplx> tmp1 = 2.0 * tmp * ta[b]; // 2.0 from the normalization
|
||||||
2.0 * tmp * ta[b]; // 2.0 from the normalization
|
|
||||||
Complex iTr = TensorRemove(timesI(trace(tmp1)));
|
Complex iTr = TensorRemove(timesI(trace(tmp1)));
|
||||||
//iAdjTa()()(b, a) = iTr;
|
//iAdjTa()()(b, a) = iTr;
|
||||||
iAdjTa()()(a, b) = iTr;
|
iAdjTa()()(a, b) = iTr;
|
||||||
@ -134,8 +137,7 @@ public:
|
|||||||
|
|
||||||
for (int a = 0; a < Dimension; a++) {
|
for (int a = 0; a < Dimension; a++) {
|
||||||
generator(a, iTa);
|
generator(a, iTa);
|
||||||
LatticeComplex tmp = real(trace(iTa * in)) * coefficient;
|
pokeColour(h_out, real(trace(iTa * in)) * coefficient, a);
|
||||||
pokeColour(h_out, tmp, a);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,273 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// * Two index representation generators
|
|
||||||
//
|
|
||||||
// * Normalisation for the fundamental generators:
|
|
||||||
// trace ta tb = 1/2 delta_ab = T_F delta_ab
|
|
||||||
// T_F = 1/2 for SU(N) groups
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// base for NxN two index (anti-symmetric) matrices
|
|
||||||
// normalized to 1 (d_ij is the kroenecker delta)
|
|
||||||
//
|
|
||||||
// (e^(ij)_{kl} = 1 / sqrt(2) (d_ik d_jl +/- d_jk d_il)
|
|
||||||
//
|
|
||||||
// Then the generators are written as
|
|
||||||
//
|
|
||||||
// (iT_a)^(ij)(lk) = i * ( tr[e^(ij)^dag e^(lk) T^trasp_a] +
|
|
||||||
// tr[e^(lk)e^(ij)^dag T_a] ) //
|
|
||||||
//
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// Authors: David Preti, Guido Cossu
|
|
||||||
|
|
||||||
#ifndef QCD_UTIL_SUN2INDEX_H
|
|
||||||
#define QCD_UTIL_SUN2INDEX_H
|
|
||||||
|
|
||||||
|
|
||||||
NAMESPACE_BEGIN(Grid);
|
|
||||||
|
|
||||||
enum TwoIndexSymmetry { Symmetric = 1, AntiSymmetric = -1 };
|
|
||||||
|
|
||||||
inline Real delta(int a, int b) { return (a == b) ? 1.0 : 0.0; }
|
|
||||||
|
|
||||||
template <int ncolour, TwoIndexSymmetry S>
|
|
||||||
class SU_TwoIndex : public SU<ncolour> {
|
|
||||||
public:
|
|
||||||
static const int Dimension = ncolour * (ncolour + S) / 2;
|
|
||||||
static const int NumGenerators = SU<ncolour>::AdjointDimension;
|
|
||||||
|
|
||||||
template <typename vtype>
|
|
||||||
using iSUnTwoIndexMatrix = iScalar<iScalar<iMatrix<vtype, Dimension> > >;
|
|
||||||
|
|
||||||
typedef iSUnTwoIndexMatrix<Complex> TIMatrix;
|
|
||||||
typedef iSUnTwoIndexMatrix<ComplexF> TIMatrixF;
|
|
||||||
typedef iSUnTwoIndexMatrix<ComplexD> TIMatrixD;
|
|
||||||
|
|
||||||
typedef iSUnTwoIndexMatrix<vComplex> vTIMatrix;
|
|
||||||
typedef iSUnTwoIndexMatrix<vComplexF> vTIMatrixF;
|
|
||||||
typedef iSUnTwoIndexMatrix<vComplexD> vTIMatrixD;
|
|
||||||
|
|
||||||
typedef Lattice<vTIMatrix> LatticeTwoIndexMatrix;
|
|
||||||
typedef Lattice<vTIMatrixF> LatticeTwoIndexMatrixF;
|
|
||||||
typedef Lattice<vTIMatrixD> LatticeTwoIndexMatrixD;
|
|
||||||
|
|
||||||
typedef Lattice<iVector<iScalar<iMatrix<vComplex, Dimension> >, Nd> >
|
|
||||||
LatticeTwoIndexField;
|
|
||||||
typedef Lattice<iVector<iScalar<iMatrix<vComplexF, Dimension> >, Nd> >
|
|
||||||
LatticeTwoIndexFieldF;
|
|
||||||
typedef Lattice<iVector<iScalar<iMatrix<vComplexD, Dimension> >, Nd> >
|
|
||||||
LatticeTwoIndexFieldD;
|
|
||||||
|
|
||||||
template <typename vtype>
|
|
||||||
using iSUnMatrix = iScalar<iScalar<iMatrix<vtype, ncolour> > >;
|
|
||||||
|
|
||||||
typedef iSUnMatrix<Complex> Matrix;
|
|
||||||
typedef iSUnMatrix<ComplexF> MatrixF;
|
|
||||||
typedef iSUnMatrix<ComplexD> MatrixD;
|
|
||||||
|
|
||||||
template <class cplx>
|
|
||||||
static void base(int Index, iSUnMatrix<cplx> &eij) {
|
|
||||||
// returns (e)^(ij)_{kl} necessary for change of base U_F -> U_R
|
|
||||||
assert(Index < NumGenerators);
|
|
||||||
eij = Zero();
|
|
||||||
|
|
||||||
// for the linearisation of the 2 indexes
|
|
||||||
static int a[ncolour * (ncolour - 1) / 2][2]; // store the a <-> i,j
|
|
||||||
static bool filled = false;
|
|
||||||
if (!filled) {
|
|
||||||
int counter = 0;
|
|
||||||
for (int i = 1; i < ncolour; i++) {
|
|
||||||
for (int j = 0; j < i; j++) {
|
|
||||||
a[counter][0] = i;
|
|
||||||
a[counter][1] = j;
|
|
||||||
counter++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
filled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Index < ncolour * (ncolour - 1) / 2) {
|
|
||||||
baseOffDiagonal(a[Index][0], a[Index][1], eij);
|
|
||||||
} else {
|
|
||||||
baseDiagonal(Index, eij);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class cplx>
|
|
||||||
static void baseDiagonal(int Index, iSUnMatrix<cplx> &eij) {
|
|
||||||
eij = Zero();
|
|
||||||
eij()()(Index - ncolour * (ncolour - 1) / 2,
|
|
||||||
Index - ncolour * (ncolour - 1) / 2) = 1.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class cplx>
|
|
||||||
static void baseOffDiagonal(int i, int j, iSUnMatrix<cplx> &eij) {
|
|
||||||
eij = Zero();
|
|
||||||
for (int k = 0; k < ncolour; k++)
|
|
||||||
for (int l = 0; l < ncolour; l++)
|
|
||||||
eij()()(l, k) = delta(i, k) * delta(j, l) +
|
|
||||||
S * delta(j, k) * delta(i, l);
|
|
||||||
|
|
||||||
RealD nrm = 1. / std::sqrt(2.0);
|
|
||||||
eij = eij * nrm;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void printBase(void) {
|
|
||||||
for (int gen = 0; gen < Dimension; gen++) {
|
|
||||||
Matrix tmp;
|
|
||||||
base(gen, tmp);
|
|
||||||
std::cout << GridLogMessage << "Nc = " << ncolour << " t_" << gen
|
|
||||||
<< std::endl;
|
|
||||||
std::cout << GridLogMessage << tmp << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class cplx>
|
|
||||||
static void generator(int Index, iSUnTwoIndexMatrix<cplx> &i2indTa) {
|
|
||||||
Vector<typename SU<ncolour>::template iSUnMatrix<cplx> > ta(
|
|
||||||
ncolour * ncolour - 1);
|
|
||||||
Vector<typename SU<ncolour>::template iSUnMatrix<cplx> > eij(Dimension);
|
|
||||||
typename SU<ncolour>::template iSUnMatrix<cplx> tmp;
|
|
||||||
i2indTa = Zero();
|
|
||||||
|
|
||||||
for (int a = 0; a < ncolour * ncolour - 1; a++)
|
|
||||||
SU<ncolour>::generator(a, ta[a]);
|
|
||||||
|
|
||||||
for (int a = 0; a < Dimension; a++) base(a, eij[a]);
|
|
||||||
|
|
||||||
for (int a = 0; a < Dimension; a++) {
|
|
||||||
tmp = transpose(ta[Index]) * adj(eij[a]) + adj(eij[a]) * ta[Index];
|
|
||||||
for (int b = 0; b < Dimension; b++) {
|
|
||||||
typename SU<ncolour>::template iSUnMatrix<cplx> tmp1 =
|
|
||||||
tmp * eij[b];
|
|
||||||
Complex iTr = TensorRemove(timesI(trace(tmp1)));
|
|
||||||
i2indTa()()(a, b) = iTr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void printGenerators(void) {
|
|
||||||
for (int gen = 0; gen < ncolour * ncolour - 1; gen++) {
|
|
||||||
TIMatrix i2indTa;
|
|
||||||
generator(gen, i2indTa);
|
|
||||||
std::cout << GridLogMessage << "Nc = " << ncolour << " t_" << gen
|
|
||||||
<< std::endl;
|
|
||||||
std::cout << GridLogMessage << i2indTa << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void testGenerators(void) {
|
|
||||||
TIMatrix i2indTa, i2indTb;
|
|
||||||
std::cout << GridLogMessage << "2IndexRep - Checking if traceless"
|
|
||||||
<< std::endl;
|
|
||||||
for (int a = 0; a < ncolour * ncolour - 1; a++) {
|
|
||||||
generator(a, i2indTa);
|
|
||||||
std::cout << GridLogMessage << a << std::endl;
|
|
||||||
assert(norm2(trace(i2indTa)) < 1.0e-6);
|
|
||||||
}
|
|
||||||
std::cout << GridLogMessage << std::endl;
|
|
||||||
|
|
||||||
std::cout << GridLogMessage << "2IndexRep - Checking if antihermitean"
|
|
||||||
<< std::endl;
|
|
||||||
for (int a = 0; a < ncolour * ncolour - 1; a++) {
|
|
||||||
generator(a, i2indTa);
|
|
||||||
std::cout << GridLogMessage << a << std::endl;
|
|
||||||
assert(norm2(adj(i2indTa) + i2indTa) < 1.0e-6);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cout << GridLogMessage << std::endl;
|
|
||||||
std::cout << GridLogMessage
|
|
||||||
<< "2IndexRep - Checking Tr[Ta*Tb]=delta(a,b)*(N +- 2)/2"
|
|
||||||
<< std::endl;
|
|
||||||
for (int a = 0; a < ncolour * ncolour - 1; a++) {
|
|
||||||
for (int b = 0; b < ncolour * ncolour - 1; b++) {
|
|
||||||
generator(a, i2indTa);
|
|
||||||
generator(b, i2indTb);
|
|
||||||
|
|
||||||
// generator returns iTa, so we need a minus sign here
|
|
||||||
Complex Tr = -TensorRemove(trace(i2indTa * i2indTb));
|
|
||||||
std::cout << GridLogMessage << "a=" << a << "b=" << b << "Tr=" << Tr
|
|
||||||
<< std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
std::cout << GridLogMessage << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void TwoIndexLieAlgebraMatrix(
|
|
||||||
const typename SU<ncolour>::LatticeAlgebraVector &h,
|
|
||||||
LatticeTwoIndexMatrix &out, Real scale = 1.0) {
|
|
||||||
conformable(h, out);
|
|
||||||
GridBase *grid = out.Grid();
|
|
||||||
LatticeTwoIndexMatrix la(grid);
|
|
||||||
TIMatrix i2indTa;
|
|
||||||
|
|
||||||
out = Zero();
|
|
||||||
for (int a = 0; a < ncolour * ncolour - 1; a++) {
|
|
||||||
generator(a, i2indTa);
|
|
||||||
la = peekColour(h, a) * i2indTa;
|
|
||||||
out += la;
|
|
||||||
}
|
|
||||||
out *= scale;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Projects the algebra components
|
|
||||||
// of a lattice matrix ( of dimension ncol*ncol -1 )
|
|
||||||
static void projectOnAlgebra(
|
|
||||||
typename SU<ncolour>::LatticeAlgebraVector &h_out,
|
|
||||||
const LatticeTwoIndexMatrix &in, Real scale = 1.0) {
|
|
||||||
conformable(h_out, in);
|
|
||||||
h_out = Zero();
|
|
||||||
TIMatrix i2indTa;
|
|
||||||
Real coefficient = -2.0 / (ncolour + 2 * S) * scale;
|
|
||||||
// 2/(Nc +/- 2) for the normalization of the trace in the two index rep
|
|
||||||
for (int a = 0; a < ncolour * ncolour - 1; a++) {
|
|
||||||
generator(a, i2indTa);
|
|
||||||
auto tmp = real(trace(i2indTa * in)) * coefficient;
|
|
||||||
pokeColour(h_out, tmp, a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// a projector that keeps the generators stored to avoid the overhead of
|
|
||||||
// recomputing them
|
|
||||||
static void projector(typename SU<ncolour>::LatticeAlgebraVector &h_out,
|
|
||||||
const LatticeTwoIndexMatrix &in, Real scale = 1.0) {
|
|
||||||
conformable(h_out, in);
|
|
||||||
// to store the generators
|
|
||||||
static std::vector<TIMatrix> i2indTa(ncolour * ncolour -1);
|
|
||||||
h_out = Zero();
|
|
||||||
static bool precalculated = false;
|
|
||||||
if (!precalculated) {
|
|
||||||
precalculated = true;
|
|
||||||
for (int a = 0; a < ncolour * ncolour - 1; a++) generator(a, i2indTa[a]);
|
|
||||||
}
|
|
||||||
|
|
||||||
Real coefficient =
|
|
||||||
-2.0 / (ncolour + 2 * S) * scale; // 2/(Nc +/- 2) for the normalization
|
|
||||||
// of the trace in the two index rep
|
|
||||||
|
|
||||||
for (int a = 0; a < ncolour * ncolour - 1; a++) {
|
|
||||||
auto tmp = real(trace(i2indTa[a] * in)) * coefficient;
|
|
||||||
pokeColour(h_out, tmp, a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Some useful type names
|
|
||||||
typedef SU_TwoIndex<Nc, Symmetric> TwoIndexSymmMatrices;
|
|
||||||
typedef SU_TwoIndex<Nc, AntiSymmetric> TwoIndexAntiSymmMatrices;
|
|
||||||
|
|
||||||
typedef SU_TwoIndex<2, Symmetric> SU2TwoIndexSymm;
|
|
||||||
typedef SU_TwoIndex<3, Symmetric> SU3TwoIndexSymm;
|
|
||||||
typedef SU_TwoIndex<4, Symmetric> SU4TwoIndexSymm;
|
|
||||||
typedef SU_TwoIndex<5, Symmetric> SU5TwoIndexSymm;
|
|
||||||
|
|
||||||
typedef SU_TwoIndex<2, AntiSymmetric> SU2TwoIndexAntiSymm;
|
|
||||||
typedef SU_TwoIndex<3, AntiSymmetric> SU3TwoIndexAntiSymm;
|
|
||||||
typedef SU_TwoIndex<4, AntiSymmetric> SU4TwoIndexAntiSymm;
|
|
||||||
typedef SU_TwoIndex<5, AntiSymmetric> SU5TwoIndexAntiSymm;
|
|
||||||
|
|
||||||
NAMESPACE_END(Grid);
|
|
||||||
|
|
||||||
#endif
|
|
317
Grid/qcd/utils/Sp2n.impl
Normal file
317
Grid/qcd/utils/Sp2n.impl
Normal file
@ -0,0 +1,317 @@
|
|||||||
|
// This file is #included into the body of the class template definition of
|
||||||
|
// GaugeGroup. So, image there to be
|
||||||
|
//
|
||||||
|
// template <int ncolour, class group_name>
|
||||||
|
// class GaugeGroup {
|
||||||
|
//
|
||||||
|
// around it.
|
||||||
|
//
|
||||||
|
// Please note that the unconventional file extension makes sure that it
|
||||||
|
// doesn't get found by the scripts/filelist during bootstrapping.
|
||||||
|
|
||||||
|
private:
|
||||||
|
template <ONLY_IF_Sp>
|
||||||
|
static int su2subgroups(GroupName::Sp) { return (ncolour/2 * (ncolour/2 - 1)) / 2; }
|
||||||
|
|
||||||
|
// Sp(2N) has N(2N+1) = 2N^2+N generators
|
||||||
|
//
|
||||||
|
// normalise the generators such that
|
||||||
|
// Trace ( Ta Tb) = 1/2 delta_ab
|
||||||
|
//
|
||||||
|
// N generators in the cartan, 2N^2 off
|
||||||
|
// off diagonal:
|
||||||
|
// there are 6 types named a,b,c,d and w,z
|
||||||
|
// abcd are N(N-1)/2 each while wz are N each
|
||||||
|
|
||||||
|
template <class cplx, ONLY_IF_Sp>
|
||||||
|
static void generator(int lieIndex, iGroupMatrix<cplx> &ta, GroupName::Sp) {
|
||||||
|
// map lie index into type of generators: diagonal, abcd type, wz type
|
||||||
|
|
||||||
|
const int nsp = ncolour/2;
|
||||||
|
int diagIndex;
|
||||||
|
int aIndex, bIndex, cIndex, dIndex;
|
||||||
|
int wIndex, zIndex; // a,b,c,d are N(N-1)/2 and w,z are N
|
||||||
|
const int mod = nsp * (nsp - 1) * 0.5;
|
||||||
|
const int offdiag =
|
||||||
|
2 * nsp * nsp; // number of generators not in the cartan subalgebra
|
||||||
|
const int wmod = 4 * mod;
|
||||||
|
const int zmod = wmod + nsp;
|
||||||
|
if (lieIndex >= offdiag) {
|
||||||
|
diagIndex = lieIndex - offdiag; // 0, ... ,N-1
|
||||||
|
// std::cout << GridLogMessage << "diag type " << std::endl;
|
||||||
|
generatorDiagtype(diagIndex, ta);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ((lieIndex >= wmod) && (lieIndex < zmod)) {
|
||||||
|
// std::cout << GridLogMessage << "w type " << std::endl;
|
||||||
|
wIndex = lieIndex - wmod; // 0, ... ,N-1
|
||||||
|
generatorWtype(wIndex, ta);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ((lieIndex >= zmod) && (lieIndex < offdiag)) {
|
||||||
|
// std::cout << GridLogMessage << "z type " << std::endl;
|
||||||
|
// std::cout << GridLogMessage << "lie index " << lieIndex << std::endl;
|
||||||
|
// std::cout << GridLogMessage << "z mod " << zmod << std::endl;
|
||||||
|
zIndex = lieIndex - zmod; // 0, ... ,N-1
|
||||||
|
generatorZtype(zIndex, ta);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (lieIndex < mod) { // atype 0, ... , N(N-1)/2=mod
|
||||||
|
// std::cout << GridLogMessage << "a type " << std::endl;
|
||||||
|
aIndex = lieIndex;
|
||||||
|
// std::cout << GridLogMessage << "a indx " << aIndex << std::endl;
|
||||||
|
generatorAtype(aIndex, ta);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ((lieIndex >= mod) && lieIndex < 2 * mod) { // btype mod, ... , 2mod-1
|
||||||
|
// std::cout << GridLogMessage << "b type " << std::endl;
|
||||||
|
bIndex = lieIndex - mod;
|
||||||
|
generatorBtype(bIndex, ta);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ((lieIndex >= 2 * mod) &&
|
||||||
|
lieIndex < 3 * mod) { // ctype 2mod, ... , 3mod-1
|
||||||
|
// std::cout << GridLogMessage << "c type " << std::endl;
|
||||||
|
cIndex = lieIndex - 2 * mod;
|
||||||
|
generatorCtype(cIndex, ta);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ((lieIndex >= 3 * mod) &&
|
||||||
|
lieIndex < wmod) { // ctype 3mod, ... , 4mod-1 = wmod-1
|
||||||
|
// std::cout << GridLogMessage << "d type " << std::endl;
|
||||||
|
dIndex = lieIndex - 3 * mod;
|
||||||
|
generatorDtype(dIndex, ta);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // end of generator
|
||||||
|
|
||||||
|
template <class cplx, ONLY_IF_Sp>
|
||||||
|
static void generatorDiagtype(int diagIndex, iGroupMatrix<cplx> &ta) {
|
||||||
|
// ta(i,i) = - ta(i+N,i+N) = 1/2 for each i index of the cartan subalgebra
|
||||||
|
|
||||||
|
const int nsp=ncolour/2;
|
||||||
|
ta = Zero();
|
||||||
|
RealD nrm = 1.0 / 2;
|
||||||
|
|
||||||
|
ta()()(diagIndex, diagIndex) = nrm;
|
||||||
|
ta()()(diagIndex + nsp, diagIndex + nsp) = -nrm;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class cplx, ONLY_IF_Sp>
|
||||||
|
static void generatorAtype(int aIndex, iGroupMatrix<cplx> &ta) {
|
||||||
|
// ta(i,j) = ta(j,i) = -ta(i+N,j+N) = -ta(j+N,i+N) = 1 / 2 sqrt(2)
|
||||||
|
// with i<j and i=0,...,N-2
|
||||||
|
// follows that j=i+1, ... , N
|
||||||
|
int i1, i2;
|
||||||
|
const int nsp=ncolour/2;
|
||||||
|
ta = Zero();
|
||||||
|
RealD nrm = 1 / (2 * std::sqrt(2));
|
||||||
|
|
||||||
|
su2SubGroupIndex(i1, i2, aIndex);
|
||||||
|
ta()()(i1, i2) = 1;
|
||||||
|
ta()()(i2, i1) = 1;
|
||||||
|
ta()()(i1 + nsp, i2 + nsp) = -1;
|
||||||
|
ta()()(i2 + nsp, i1 + nsp) = -1;
|
||||||
|
|
||||||
|
ta = ta * nrm;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class cplx, ONLY_IF_Sp>
|
||||||
|
static void generatorBtype(int bIndex, iGroupMatrix<cplx> &ta) {
|
||||||
|
// ta(i,j) = -ta(j,i) = ta(i+N,j+N) = -ta(j+N,i+N) = i / 1/ 2 sqrt(2)
|
||||||
|
// with i<j and i=0,...,N-2
|
||||||
|
// follows that j=i+1, ... , N-1
|
||||||
|
|
||||||
|
const int nsp=ncolour/2;
|
||||||
|
int i1, i2;
|
||||||
|
ta = Zero();
|
||||||
|
cplx i(0.0, 1.0);
|
||||||
|
RealD nrm = 1 / (2 * std::sqrt(2));
|
||||||
|
su2SubGroupIndex(i1, i2, bIndex);
|
||||||
|
|
||||||
|
ta()()(i1, i2) = i;
|
||||||
|
ta()()(i2, i1) = -i;
|
||||||
|
ta()()(i1 + nsp, i2 + nsp) = i;
|
||||||
|
ta()()(i2 + nsp, i1 + nsp) = -i;
|
||||||
|
|
||||||
|
ta = ta * nrm;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class cplx, ONLY_IF_Sp>
|
||||||
|
static void generatorCtype(int cIndex, iGroupMatrix<cplx> &ta) {
|
||||||
|
// ta(i,j+N) = ta(j,i+N) = ta(i+N,j) = ta(j+N,i) = 1 / 2 sqrt(2)
|
||||||
|
|
||||||
|
const int nsp=ncolour/2;
|
||||||
|
int i1, i2;
|
||||||
|
ta = Zero();
|
||||||
|
RealD nrm = 1 / (2 * std::sqrt(2));
|
||||||
|
su2SubGroupIndex(i1, i2, cIndex);
|
||||||
|
|
||||||
|
ta()()(i1, i2 + nsp) = 1;
|
||||||
|
ta()()(i2, i1 + nsp) = 1;
|
||||||
|
ta()()(i1 + nsp, i2) = 1;
|
||||||
|
ta()()(i2 + nsp, i1) = 1;
|
||||||
|
|
||||||
|
ta = ta * nrm;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class cplx, ONLY_IF_Sp>
|
||||||
|
static void generatorDtype(int dIndex, iGroupMatrix<cplx> &ta) {
|
||||||
|
// ta(i,j+N) = ta(j,i+N) = -ta(i+N,j) = -ta(j+N,i) = i / 2 sqrt(2)
|
||||||
|
|
||||||
|
const int nsp=ncolour/2;
|
||||||
|
int i1, i2;
|
||||||
|
ta = Zero();
|
||||||
|
cplx i(0.0, 1.0);
|
||||||
|
RealD nrm = 1 / (2 * std::sqrt(2));
|
||||||
|
su2SubGroupIndex(i1, i2, dIndex);
|
||||||
|
|
||||||
|
ta()()(i1, i2 + nsp) = i;
|
||||||
|
ta()()(i2, i1 + nsp) = i;
|
||||||
|
ta()()(i1 + nsp, i2) = -i;
|
||||||
|
ta()()(i2 + nsp, i1) = -i;
|
||||||
|
|
||||||
|
ta = ta * nrm;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class cplx, ONLY_IF_Sp>
|
||||||
|
static void generatorWtype(int wIndex, iGroupMatrix<cplx> &ta) {
|
||||||
|
// ta(i,i+N) = ta(i+N,i) = 1/2
|
||||||
|
|
||||||
|
const int nsp=ncolour/2;
|
||||||
|
ta = Zero();
|
||||||
|
RealD nrm = 1.0 / 2; // check
|
||||||
|
|
||||||
|
ta()()(wIndex, wIndex + nsp) = 1;
|
||||||
|
ta()()(wIndex + nsp, wIndex) = 1;
|
||||||
|
|
||||||
|
ta = ta * nrm;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class cplx, ONLY_IF_Sp>
|
||||||
|
static void generatorZtype(int zIndex, iGroupMatrix<cplx> &ta) {
|
||||||
|
// ta(i,i+N) = - ta(i+N,i) = i/2
|
||||||
|
|
||||||
|
const int nsp=ncolour/2;
|
||||||
|
ta = Zero();
|
||||||
|
RealD nrm = 1.0 / 2; // check
|
||||||
|
cplx i(0.0, 1.0);
|
||||||
|
ta()()(zIndex, zIndex + nsp) = i;
|
||||||
|
ta()()(zIndex + nsp, zIndex) = -i;
|
||||||
|
|
||||||
|
ta = ta * nrm;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
// Map a su2 subgroup number to the pair of rows that are non zero
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
template <ONLY_IF_Sp>
|
||||||
|
static void su2SubGroupIndex(int &i1, int &i2, int su2_index, GroupName::Sp) {
|
||||||
|
const int nsp=ncolour/2;
|
||||||
|
assert((su2_index >= 0) && (su2_index < (nsp * (nsp - 1)) / 2));
|
||||||
|
|
||||||
|
int spare = su2_index;
|
||||||
|
for (i1 = 0; spare >= (nsp - 1 - i1); i1++) {
|
||||||
|
spare = spare - (nsp - 1 - i1); // remove the Nc-1-i1 terms
|
||||||
|
}
|
||||||
|
i2 = i1 + 1 + spare;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void testGenerators(GroupName::Sp) {
|
||||||
|
Matrix ta;
|
||||||
|
Matrix tb;
|
||||||
|
std::cout << GridLogMessage
|
||||||
|
<< "Fundamental - Checking trace ta tb is 0.5 delta_ab "
|
||||||
|
<< std::endl;
|
||||||
|
for (int a = 0; a < AlgebraDimension; a++) {
|
||||||
|
for (int b = 0; b < AlgebraDimension; b++) {
|
||||||
|
generator(a, ta);
|
||||||
|
generator(b, tb);
|
||||||
|
Complex tr = TensorRemove(trace(ta * tb));
|
||||||
|
std::cout << GridLogMessage << "(" << a << "," << b << ") = " << tr
|
||||||
|
<< std::endl;
|
||||||
|
if (a == b) assert(abs(tr - Complex(0.5)) < 1.0e-6);
|
||||||
|
if (a != b) assert(abs(tr) < 1.0e-6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cout << GridLogMessage << std::endl;
|
||||||
|
std::cout << GridLogMessage << "Fundamental - Checking if hermitian"
|
||||||
|
<< std::endl;
|
||||||
|
for (int a = 0; a < AlgebraDimension; a++) {
|
||||||
|
generator(a, ta);
|
||||||
|
std::cout << GridLogMessage << a << std::endl;
|
||||||
|
assert(norm2(ta - adj(ta)) < 1.0e-6);
|
||||||
|
}
|
||||||
|
std::cout << GridLogMessage << std::endl;
|
||||||
|
std::cout << GridLogMessage << "Fundamental - Checking if traceless"
|
||||||
|
<< std::endl;
|
||||||
|
for (int a = 0; a < AlgebraDimension; a++) {
|
||||||
|
generator(a, ta);
|
||||||
|
Complex tr = TensorRemove(trace(ta));
|
||||||
|
std::cout << GridLogMessage << a << std::endl;
|
||||||
|
assert(abs(tr) < 1.0e-6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <int N>
|
||||||
|
static Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > >
|
||||||
|
ProjectOnGeneralGroup(const Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > &Umu, GroupName::Sp) {
|
||||||
|
return ProjectOnSpGroup(Umu);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class vtype>
|
||||||
|
accelerator_inline static iScalar<vtype> ProjectOnGeneralGroup(const iScalar<vtype> &r, GroupName::Sp) {
|
||||||
|
return ProjectOnSpGroup(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class vtype, int N>
|
||||||
|
accelerator_inline static iVector<vtype,N> ProjectOnGeneralGroup(const iVector<vtype,N> &r, GroupName::Sp) {
|
||||||
|
return ProjectOnSpGroup(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class vtype,int N, typename std::enable_if< GridTypeMapper<vtype>::TensorLevel == 0 >::type * =nullptr>
|
||||||
|
accelerator_inline static iMatrix<vtype,N> ProjectOnGeneralGroup(const iMatrix<vtype,N> &arg, GroupName::Sp) {
|
||||||
|
return ProjectOnSpGroup(arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename LatticeMatrixType>
|
||||||
|
static void taProj(const LatticeMatrixType &in, LatticeMatrixType &out, GroupName::Sp) {
|
||||||
|
out = SpTa(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
template <ONLY_IF_Sp>
|
||||||
|
static void Omega(LatticeColourMatrixD &in) {
|
||||||
|
const int nsp=ncolour/2;
|
||||||
|
LatticeColourMatrixD OmegaLatt(in.Grid());
|
||||||
|
LatticeColourMatrixD identity(in.Grid());
|
||||||
|
ColourMatrix Omega;
|
||||||
|
|
||||||
|
OmegaLatt = Zero();
|
||||||
|
Omega = Zero();
|
||||||
|
identity = 1.;
|
||||||
|
|
||||||
|
for (int i = 0; i < nsp; i++) {
|
||||||
|
Omega()()(i, nsp + i) = 1.;
|
||||||
|
Omega()()(nsp + i, i) = -1;
|
||||||
|
}
|
||||||
|
OmegaLatt = OmegaLatt + (identity * Omega);
|
||||||
|
in = OmegaLatt;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <ONLY_IF_Sp, class vtype, int N>
|
||||||
|
static void Omega(iScalar<iScalar<iMatrix<vtype, N> > > &in) {
|
||||||
|
const int nsp=ncolour/2;
|
||||||
|
|
||||||
|
iScalar<iScalar<iMatrix<vtype, N> > > Omega;
|
||||||
|
Omega = Zero();
|
||||||
|
|
||||||
|
for (int i = 0; i < nsp; i++) {
|
||||||
|
Omega()()(i, nsp + i) = 1.;
|
||||||
|
Omega()()(nsp + i, i) = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
in = Omega;
|
||||||
|
}
|
@ -8,9 +8,9 @@
|
|||||||
#include <Grid/qcd/utils/ScalarObjs.h>
|
#include <Grid/qcd/utils/ScalarObjs.h>
|
||||||
|
|
||||||
// Include representations
|
// Include representations
|
||||||
#include <Grid/qcd/utils/SUn.h>
|
#include <Grid/qcd/utils/GaugeGroup.h>
|
||||||
#include <Grid/qcd/utils/SUnAdjoint.h>
|
#include <Grid/qcd/utils/SUnAdjoint.h>
|
||||||
#include <Grid/qcd/utils/SUnTwoIndex.h>
|
#include <Grid/qcd/utils/GaugeGroupTwoIndex.h>
|
||||||
|
|
||||||
// All-to-all contraction kernels that touch the
|
// All-to-all contraction kernels that touch the
|
||||||
// internal lattice structure
|
// internal lattice structure
|
||||||
|
@ -66,13 +66,61 @@ template<class vtype,int N> accelerator_inline iMatrix<vtype,N> Ta(const iMatrix
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class vtype> accelerator_inline iScalar<vtype> SpTa(const iScalar<vtype>&r)
|
||||||
|
{
|
||||||
|
iScalar<vtype> ret;
|
||||||
|
ret._internal = SpTa(r._internal);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
template<class vtype,int N> accelerator_inline iVector<vtype,N> SpTa(const iVector<vtype,N>&r)
|
||||||
|
{
|
||||||
|
iVector<vtype,N> ret;
|
||||||
|
for(int i=0;i<N;i++){
|
||||||
|
ret._internal[i] = SpTa(r._internal[i]);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
template<class vtype,int N, typename std::enable_if< GridTypeMapper<vtype>::TensorLevel == 0 >::type * =nullptr>
|
||||||
|
accelerator_inline iMatrix<vtype,N> SpTa(const iMatrix<vtype,N> &arg)
|
||||||
|
{
|
||||||
|
// Generalises Ta to Sp2n
|
||||||
|
// Applies the following projections
|
||||||
|
// P_{antihermitian} P_{antihermitian-Sp-algebra} P_{traceless}
|
||||||
|
// where the ordering matters
|
||||||
|
// P_{traceless} subtracts the trace
|
||||||
|
// P_{antihermitian-Sp-algebra} provides the block structure of the algebra based on U = exp(T) i.e. anti-hermitian generators
|
||||||
|
// P_{antihermitian} does in-adj(in) / 2
|
||||||
|
iMatrix<vtype,N> ret(arg);
|
||||||
|
double factor = (1.0/(double)N);
|
||||||
|
vtype nrm;
|
||||||
|
nrm = 0.5;
|
||||||
|
|
||||||
|
ret = arg - (trace(arg)*factor);
|
||||||
|
|
||||||
|
for(int c1=0;c1<N/2;c1++)
|
||||||
|
{
|
||||||
|
for(int c2=0;c2<N/2;c2++)
|
||||||
|
{
|
||||||
|
ret._internal[c1][c2] = nrm*(conjugate(ret._internal[c1+N/2][c2+N/2]) + ret._internal[c1][c2]); // new[up-left] = old[up-left]+old*[down-right]
|
||||||
|
ret._internal[c1][c2+N/2] = nrm*(ret._internal[c1][c2+N/2] - conjugate(ret._internal[c1+N/2][c2])); // new[up-right] = old[up-right]-old*[down-left]
|
||||||
|
}
|
||||||
|
for(int c2=N/2;c2<N;c2++)
|
||||||
|
{
|
||||||
|
ret._internal[c1+N/2][c2-N/2] = -conjugate(ret._internal[c1][c2]); // reconstructs lower blocks
|
||||||
|
ret._internal[c1+N/2][c2] = conjugate(ret._internal[c1][c2-N/2]); // from upper blocks
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = (ret - adj(ret))*0.5;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// ProjectOnGroup function for scalar, vector, matrix
|
// ProjectOnGroup function for scalar, vector, matrix
|
||||||
// Projects on orthogonal, unitary group
|
// Projects on orthogonal, unitary group
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
template<class vtype> accelerator_inline iScalar<vtype> ProjectOnGroup(const iScalar<vtype>&r)
|
template<class vtype> accelerator_inline iScalar<vtype> ProjectOnGroup(const iScalar<vtype>&r)
|
||||||
{
|
{
|
||||||
iScalar<vtype> ret;
|
iScalar<vtype> ret;
|
||||||
@ -137,6 +185,85 @@ accelerator_inline iMatrix<vtype,N> ProjectOnGroup(const iMatrix<vtype,N> &arg)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// re-do for sp2n
|
||||||
|
|
||||||
|
// Ta cannot be defined here for Sp2n because I need the generators from the Sp class
|
||||||
|
// It is defined in gauge impl types
|
||||||
|
|
||||||
|
template<class vtype> accelerator_inline iScalar<vtype> ProjectOnSpGroup(const iScalar<vtype>&r)
|
||||||
|
{
|
||||||
|
iScalar<vtype> ret;
|
||||||
|
ret._internal = ProjectOnSpGroup(r._internal);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
template<class vtype,int N> accelerator_inline iVector<vtype,N> ProjectOnSpGroup(const iVector<vtype,N>&r)
|
||||||
|
{
|
||||||
|
iVector<vtype,N> ret;
|
||||||
|
for(int i=0;i<N;i++){
|
||||||
|
ret._internal[i] = ProjectOnSpGroup(r._internal[i]);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// int N is 2n in Sp(2n)
|
||||||
|
template<class vtype,int N, typename std::enable_if< GridTypeMapper<vtype>::TensorLevel == 0 >::type * =nullptr>
|
||||||
|
accelerator_inline iMatrix<vtype,N> ProjectOnSpGroup(const iMatrix<vtype,N> &arg)
|
||||||
|
{
|
||||||
|
// need a check for the group type?
|
||||||
|
iMatrix<vtype,N> ret(arg);
|
||||||
|
vtype nrm;
|
||||||
|
vtype inner;
|
||||||
|
|
||||||
|
for(int c1=0;c1<N/2;c1++)
|
||||||
|
{
|
||||||
|
|
||||||
|
for (int b=0; b<c1; b++) // remove the b-rows from U_c1
|
||||||
|
{
|
||||||
|
decltype(ret._internal[b][b]*ret._internal[b][b]) pr;
|
||||||
|
decltype(ret._internal[b][b]*ret._internal[b][b]) prn;
|
||||||
|
zeroit(pr);
|
||||||
|
zeroit(prn);
|
||||||
|
|
||||||
|
for(int c=0; c<N; c++)
|
||||||
|
{
|
||||||
|
pr += conjugate(ret._internal[c1][c])*ret._internal[b][c]; // <U_c1 | U_b >
|
||||||
|
prn += conjugate(ret._internal[c1][c])*ret._internal[b+N/2][c]; // <U_c1 | U_{b+N} >
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for(int c=0; c<N; c++)
|
||||||
|
{
|
||||||
|
ret._internal[c1][c] -= (conjugate(pr) * ret._internal[b][c] + conjugate(prn) * ret._internal[b+N/2][c] ); // U_c1 -= ( <U_c1 | U_b > U_b + <U_c1 | U_{b+N} > U_{b+N} )
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
zeroit(inner);
|
||||||
|
for(int c2=0;c2<N;c2++)
|
||||||
|
{
|
||||||
|
inner += innerProduct(ret._internal[c1][c2],ret._internal[c1][c2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
nrm = sqrt(inner);
|
||||||
|
nrm = 1.0/nrm;
|
||||||
|
for(int c2=0;c2<N;c2++)
|
||||||
|
{
|
||||||
|
ret._internal[c1][c2]*= nrm;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int c2=0;c2<N/2;c2++)
|
||||||
|
{
|
||||||
|
ret._internal[c1+N/2][c2+N/2] = conjugate(ret._internal[c1][c2]); // down right in the new matrix = (up-left)* of the old matrix
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int c2=N/2;c2<N;c2++)
|
||||||
|
{
|
||||||
|
ret._internal[c1+N/2][c2-N/2] = -conjugate(ret._internal[c1][c2]);; // down left in the new matrix = -(up-right)* of the old
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
NAMESPACE_END(Grid);
|
NAMESPACE_END(Grid);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -53,7 +53,6 @@ template<class vtype, int N> accelerator_inline iVector<vtype, N> Exponentiate(c
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Specialisation: Cayley-Hamilton exponential for SU(3)
|
// Specialisation: Cayley-Hamilton exponential for SU(3)
|
||||||
#if 0
|
#if 0
|
||||||
template<class vtype, typename std::enable_if< GridTypeMapper<vtype>::TensorLevel == 0>::type * =nullptr>
|
template<class vtype, typename std::enable_if< GridTypeMapper<vtype>::TensorLevel == 0>::type * =nullptr>
|
||||||
|
24
configure.ac
24
configure.ac
@ -41,7 +41,7 @@ AC_PROG_RANLIB
|
|||||||
|
|
||||||
############### Get compiler informations
|
############### Get compiler informations
|
||||||
AC_LANG([C++])
|
AC_LANG([C++])
|
||||||
AX_CXX_COMPILE_STDCXX_11([noext],[mandatory])
|
AX_CXX_COMPILE_STDCXX(14,noext,mandatory)
|
||||||
AX_COMPILER_VENDOR
|
AX_COMPILER_VENDOR
|
||||||
AC_DEFINE_UNQUOTED([CXX_COMP_VENDOR],["$ax_cv_cxx_compiler_vendor"],
|
AC_DEFINE_UNQUOTED([CXX_COMP_VENDOR],["$ax_cv_cxx_compiler_vendor"],
|
||||||
[vendor of C++ compiler that will compile the code])
|
[vendor of C++ compiler that will compile the code])
|
||||||
@ -191,10 +191,28 @@ case ${ac_Nc} in
|
|||||||
AC_DEFINE([Config_Nc],[4],[Gauge group Nc]);;
|
AC_DEFINE([Config_Nc],[4],[Gauge group Nc]);;
|
||||||
5)
|
5)
|
||||||
AC_DEFINE([Config_Nc],[5],[Gauge group Nc]);;
|
AC_DEFINE([Config_Nc],[5],[Gauge group Nc]);;
|
||||||
|
8)
|
||||||
|
AC_DEFINE([Config_Nc],[8],[Gauge group Nc]);;
|
||||||
*)
|
*)
|
||||||
AC_MSG_ERROR(["Unsupport gauge group choice Nc = ${ac_Nc}"]);;
|
AC_MSG_ERROR(["Unsupport gauge group choice Nc = ${ac_Nc}"]);;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
############### Symplectic group
|
||||||
|
AC_ARG_ENABLE([Sp],
|
||||||
|
[AC_HELP_STRING([--enable-Sp=yes|no], [enable gauge group Sp2n])],
|
||||||
|
[ac_ENABLE_SP=${enable_Sp}], [ac_ENABLE_SP=no])
|
||||||
|
|
||||||
|
AM_CONDITIONAL(BUILD_SP, [ test "${ac_ENABLE_SP}X" == "yesX" ])
|
||||||
|
|
||||||
|
case ${ac_ENABLE_SP} in
|
||||||
|
yes)
|
||||||
|
AC_DEFINE([Sp2n_config],[1],[gauge group Sp2n], [have_sp2n=true]);;
|
||||||
|
no)
|
||||||
|
AC_DEFINE([Sp2n_config],[0],[gauge group SUn], [have_sp2n=false]);;
|
||||||
|
*)
|
||||||
|
AC_MSG_ERROR(["--enable-Sp is either yes or no"]);;
|
||||||
|
esac
|
||||||
|
|
||||||
############### FP16 conversions
|
############### FP16 conversions
|
||||||
AC_ARG_ENABLE([sfw-fp16],
|
AC_ARG_ENABLE([sfw-fp16],
|
||||||
[AS_HELP_STRING([--enable-sfw-fp16=yes|no],[enable software fp16 comms])],
|
[AS_HELP_STRING([--enable-sfw-fp16=yes|no],[enable software fp16 comms])],
|
||||||
@ -737,7 +755,7 @@ case ${ac_TIMERS} in
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
############### Chroma regression test
|
############### Chroma regression test
|
||||||
AC_ARG_ENABLE([chroma],[AS_HELP_STRING([--enable-chroma],[Expect chroma compiled under c++11 ])],ac_CHROMA=yes,ac_CHROMA=no)
|
AC_ARG_ENABLE([chroma],[AS_HELP_STRING([--enable-chroma],[Expect chroma compiled under c++14 ])],ac_CHROMA=yes,ac_CHROMA=no)
|
||||||
|
|
||||||
case ${ac_CHROMA} in
|
case ${ac_CHROMA} in
|
||||||
yes|no)
|
yes|no)
|
||||||
@ -819,6 +837,7 @@ FFTW : `if test "x$have_fftw" = xtrue; then echo yes; els
|
|||||||
LIME (ILDG support) : `if test "x$have_lime" = xtrue; then echo yes; else echo no; fi`
|
LIME (ILDG support) : `if test "x$have_lime" = xtrue; then echo yes; else echo no; fi`
|
||||||
HDF5 : `if test "x$have_hdf5" = xtrue; then echo yes; else echo no; fi`
|
HDF5 : `if test "x$have_hdf5" = xtrue; then echo yes; else echo no; fi`
|
||||||
build DOXYGEN documentation : `if test "$DX_FLAG_doc" = '1'; then echo yes; else echo no; fi`
|
build DOXYGEN documentation : `if test "$DX_FLAG_doc" = '1'; then echo yes; else echo no; fi`
|
||||||
|
Sp2n : ${ac_ENABLE_SP}
|
||||||
----- BUILD FLAGS -------------------------------------
|
----- BUILD FLAGS -------------------------------------
|
||||||
CXXFLAGS:
|
CXXFLAGS:
|
||||||
`echo ${AM_CXXFLAGS} ${CXXFLAGS} | tr ' ' '\n' | sed 's/^-/ -/g'`
|
`echo ${AM_CXXFLAGS} ${CXXFLAGS} | tr ' ' '\n' | sed 's/^-/ -/g'`
|
||||||
@ -847,6 +866,7 @@ AC_CONFIG_FILES(tests/lanczos/Makefile)
|
|||||||
AC_CONFIG_FILES(tests/smearing/Makefile)
|
AC_CONFIG_FILES(tests/smearing/Makefile)
|
||||||
AC_CONFIG_FILES(tests/qdpxx/Makefile)
|
AC_CONFIG_FILES(tests/qdpxx/Makefile)
|
||||||
AC_CONFIG_FILES(tests/testu01/Makefile)
|
AC_CONFIG_FILES(tests/testu01/Makefile)
|
||||||
|
AC_CONFIG_FILES(tests/sp2n/Makefile)
|
||||||
AC_CONFIG_FILES(benchmarks/Makefile)
|
AC_CONFIG_FILES(benchmarks/Makefile)
|
||||||
AC_CONFIG_FILES(examples/Makefile)
|
AC_CONFIG_FILES(examples/Makefile)
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
Binary file not shown.
@ -2778,47 +2778,81 @@ and there are associated reconstruction routines for assembling four spinors fro
|
|||||||
|
|
||||||
These ca
|
These ca
|
||||||
|
|
||||||
|
Gauge Group
|
||||||
SU(N)
|
|
||||||
--------
|
--------
|
||||||
|
A generic Nc qcd/utils/GaugeGroup.h is provided. This defines a template class that can be specialised to different gauge groups::
|
||||||
|
|
||||||
A generic Nc qcd/utils/SUn.h is provided. This defines a template class::
|
template <int ncolour, class group_name>
|
||||||
|
class GaugeGroup {...}
|
||||||
|
|
||||||
template <int ncolour> class SU ;
|
Supported groups are SU(N) and Sp(2N). The group can be specified through the GroupName namespace::
|
||||||
|
|
||||||
The most important external methods are::
|
namespace GroupName {
|
||||||
|
class SU {};
|
||||||
|
class Sp {};
|
||||||
|
}
|
||||||
|
|
||||||
|
A simpler interface is achieved by aliasing the GaugeGroup class with a specific group::
|
||||||
|
|
||||||
|
template <int ncolour>
|
||||||
|
using SU = GaugeGroup<ncolour, GroupName::SU>;
|
||||||
|
|
||||||
|
template <int ncolour>
|
||||||
|
using Sp = GaugeGroup<ncolour, GroupName::Sp>;
|
||||||
|
|
||||||
|
Specific aliases are then defined::
|
||||||
|
|
||||||
|
typedef SU<2> SU2;
|
||||||
|
typedef SU<3> SU3;
|
||||||
|
typedef SU<4> SU4;
|
||||||
|
typedef SU<5> SU5;
|
||||||
|
typedef Sp<2> Sp2;
|
||||||
|
typedef Sp<4> Sp4;
|
||||||
|
typedef Sp<6> Sp6;
|
||||||
|
typedef Sp<8> Sp8;
|
||||||
|
|
||||||
|
Some methods are common to both gauge groups. Common external methods are::
|
||||||
|
|
||||||
static void printGenerators(void) ;
|
|
||||||
template <class cplx> static void generator(int lieIndex, iSUnMatrix<cplx> &ta) ;
|
template <class cplx> static void generator(int lieIndex, iSUnMatrix<cplx> &ta) ;
|
||||||
|
static void GaussianFundamentalLieAlgebraMatrix(GridParallelRNG &pRNG, LatticeMatrix &out, Real scale = 1.0) ;
|
||||||
|
static void HotConfiguration(GridParallelRNG &pRNG, GaugeField &out) ;
|
||||||
|
static void TepidConfiguration(GridParallelRNG &pRNG,GaugeField &out);
|
||||||
|
static void ColdConfiguration(GaugeField &out);
|
||||||
|
static void taProj( const LatticeMatrixType &in, LatticeMatrixType &out);
|
||||||
|
static void taExp(const LatticeMatrixType &x, LatticeMatrixType &ex) ;
|
||||||
|
static void printGenerators(void) ;
|
||||||
|
|
||||||
|
Whenever needed, a different implementation of these methods for the gauge groups is achieved by overloading. For example,::
|
||||||
|
|
||||||
|
template <typename LatticeMatrixType> // shared interface for the traceless-antihermitian projection
|
||||||
|
static void taProj(const LatticeMatrixType &in, LatticeMatrixType &out) {
|
||||||
|
taProj(in, out, group_name());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename LatticeMatrixType> // overloaded function to SU(N) simply perform Ta
|
||||||
|
static void taProj(const LatticeMatrixType &in, LatticeMatrixType &out, GroupName::SU) {
|
||||||
|
out = Ta(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename LatticeMatrixType> // overloaded function to Sp(2N) must use a modified Ta function
|
||||||
|
static void taProj(const LatticeMatrixType &in, LatticeMatrixType &out, GroupName::Sp) {
|
||||||
|
out = SpTa(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
Gauge Group: SU(N)
|
||||||
|
--------
|
||||||
|
The specialisation of GaugeGroup to SU(N), formally part of qcd/utils/GaugeGroup.h, is found in the file qcd/utils/SUn.impl
|
||||||
|
It contains methods that are only implemented for SU(N), and specialisations of shared methods to the special unitary group
|
||||||
|
|
||||||
|
Public methods are::
|
||||||
|
|
||||||
static void SubGroupHeatBath(GridSerialRNG &sRNG, GridParallelRNG &pRNG, RealD beta, // coeff multiplying staple in action (with no 1/Nc)
|
static void SubGroupHeatBath(GridSerialRNG &sRNG, GridParallelRNG &pRNG, RealD beta, // coeff multiplying staple in action (with no 1/Nc)
|
||||||
LatticeMatrix &link,
|
LatticeMatrix &link,
|
||||||
const LatticeMatrix &barestaple, // multiplied by action coeffs so th
|
const LatticeMatrix &barestaple, // multiplied by action coeffs so th
|
||||||
int su2_subgroup, int nheatbath, LatticeInteger &wheremask);
|
int su2_subgroup, int nheatbath, LatticeInteger &wheremask);
|
||||||
|
|
||||||
static void GaussianFundamentalLieAlgebraMatrix(GridParallelRNG &pRNG,
|
|
||||||
LatticeMatrix &out,
|
|
||||||
Real scale = 1.0) ;
|
|
||||||
static void GaugeTransform( GaugeField &Umu, GaugeMat &g)
|
static void GaugeTransform( GaugeField &Umu, GaugeMat &g)
|
||||||
static void RandomGaugeTransform(GridParallelRNG &pRNG, GaugeField &Umu, GaugeMat &g);
|
static void RandomGaugeTransform(GridParallelRNG &pRNG, GaugeField &Umu, GaugeMat &g);
|
||||||
|
|
||||||
static void HotConfiguration(GridParallelRNG &pRNG, GaugeField &out) ;
|
|
||||||
static void TepidConfiguration(GridParallelRNG &pRNG,GaugeField &out);
|
|
||||||
static void ColdConfiguration(GaugeField &out);
|
|
||||||
|
|
||||||
static void taProj( const LatticeMatrixType &in, LatticeMatrixType &out);
|
|
||||||
static void taExp(const LatticeMatrixType &x, LatticeMatrixType &ex) ;
|
|
||||||
|
|
||||||
static int su2subgroups(void) ; // returns how many subgroups
|
|
||||||
|
|
||||||
|
|
||||||
Specific instantiations are defined::
|
|
||||||
|
|
||||||
typedef SU<2> SU2;
|
|
||||||
typedef SU<3> SU3;
|
|
||||||
typedef SU<4> SU4;
|
|
||||||
typedef SU<5> SU5;
|
|
||||||
|
|
||||||
For example, Quenched QCD updating may be run as (tests/core/Test_quenched_update.cc)::
|
For example, Quenched QCD updating may be run as (tests/core/Test_quenched_update.cc)::
|
||||||
|
|
||||||
for(int sweep=0;sweep<1000;sweep++){
|
for(int sweep=0;sweep<1000;sweep++){
|
||||||
@ -2857,6 +2891,16 @@ For example, Quenched QCD updating may be run as (tests/core/Test_quenched_updat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Gauge Group: Sp(2N)
|
||||||
|
--------
|
||||||
|
The specialisation of GaugeGroup to Sp(2N), formally part of qcd/utils/GaugeGroup.h, is found in the file qcd/utils/Sp(2N).impl
|
||||||
|
It contains methods that are only implemented for Sp(2N), and specialisations of shared methods to the special unitary group
|
||||||
|
|
||||||
|
External methods are::
|
||||||
|
|
||||||
|
static void Omega(LatticeColourMatrixD &in) // Symplectic matrix left invariant by Sp(2N)
|
||||||
|
|
||||||
|
Generation of Sp(2N) gauge fields is only supported via HMC.
|
||||||
|
|
||||||
Space time grids
|
Space time grids
|
||||||
----------------
|
----------------
|
||||||
|
@ -15,6 +15,8 @@ STAG_FERMION_FILES=` find . -name '*.cc' -path '*/instantiation/*' -path '*/ins
|
|||||||
GP_FERMION_FILES=` find . -name '*.cc' -path '*/instantiation/*' -path '*/instantiation/Gparity*' `
|
GP_FERMION_FILES=` find . -name '*.cc' -path '*/instantiation/*' -path '*/instantiation/Gparity*' `
|
||||||
ADJ_FERMION_FILES=` find . -name '*.cc' -path '*/instantiation/*' -path '*/instantiation/WilsonAdj*' `
|
ADJ_FERMION_FILES=` find . -name '*.cc' -path '*/instantiation/*' -path '*/instantiation/WilsonAdj*' `
|
||||||
TWOIND_FERMION_FILES=`find . -name '*.cc' -path '*/instantiation/*' -path '*/instantiation/WilsonTwoIndex*'`
|
TWOIND_FERMION_FILES=`find . -name '*.cc' -path '*/instantiation/*' -path '*/instantiation/WilsonTwoIndex*'`
|
||||||
|
SP_FERMION_FILES=`find . -name '*.cc' -path '*/instantiation/*' -path '*/instantiation/SpWilsonImpl*'`
|
||||||
|
SP_TWOIND_FERMION_FILES=`find . -name '*.cc' -path '*/instantiation/*' -path '*/instantiation/SpWilsonTwo*'`
|
||||||
|
|
||||||
HPPFILES=`find . -type f -name '*.hpp'`
|
HPPFILES=`find . -type f -name '*.hpp'`
|
||||||
echo HFILES=$HFILES $HPPFILES > Make.inc
|
echo HFILES=$HFILES $HPPFILES > Make.inc
|
||||||
@ -27,13 +29,14 @@ echo STAG_FERMION_FILES=$STAG_FERMION_FILES >> Make.inc
|
|||||||
echo GP_FERMION_FILES=$GP_FERMION_FILES >> Make.inc
|
echo GP_FERMION_FILES=$GP_FERMION_FILES >> Make.inc
|
||||||
echo ADJ_FERMION_FILES=$ADJ_FERMION_FILES >> Make.inc
|
echo ADJ_FERMION_FILES=$ADJ_FERMION_FILES >> Make.inc
|
||||||
echo TWOIND_FERMION_FILES=$TWOIND_FERMION_FILES >> Make.inc
|
echo TWOIND_FERMION_FILES=$TWOIND_FERMION_FILES >> Make.inc
|
||||||
|
echo SP_FERMION_FILES=$SP_FERMION_FILES >> Make.inc
|
||||||
|
echo SP_TWOIND_FERMION_FILES=$SP_TWOIND_FERMION_FILES >> Make.inc
|
||||||
|
|
||||||
# tests Make.inc
|
# tests Make.inc
|
||||||
cd $home/tests
|
cd $home/tests
|
||||||
dirs=`find . -type d -not -path '*/\.*'`
|
dirs=`find . -type d -not -path '*/\.*'`
|
||||||
for subdir in $dirs; do
|
for subdir in $dirs; do
|
||||||
cd $home/tests/$subdir
|
cd $home/tests/$subdir
|
||||||
pwd
|
|
||||||
TESTS=`ls T*.cc`
|
TESTS=`ls T*.cc`
|
||||||
TESTLIST=`echo ${TESTS} | sed s/.cc//g `
|
TESTLIST=`echo ${TESTS} | sed s/.cc//g `
|
||||||
PREF=`[ $subdir = '.' ] && echo noinst || echo EXTRA`
|
PREF=`[ $subdir = '.' ] && echo noinst || echo EXTRA`
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
BREW=/opt/local/
|
BREW=/opt/local/
|
||||||
MPICXX=mpicxx CXX=c++-12 ../../configure --enable-simd=GEN --enable-comms=mpi-auto --enable-unified=yes --prefix $HOME/QCD/GridInstall --with-lime=/Users/peterboyle/QCD/SciDAC/install/ --with-openssl=$BREW --disable-fermion-reps --disable-gparity --disable-debug
|
MPICXX=mpicxx ../../configure --enable-simd=GEN --enable-comms=mpi-auto --enable-unified=yes --prefix $HOME/QCD/GridInstall --with-lime=/Users/peterboyle/QCD/SciDAC/install/ --with-openssl=$BREW --disable-fermion-reps --disable-gparity --disable-debug
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
SUBDIRS = . core forces hmc solver debug smearing IO lanczos
|
SUBDIRS = . core forces hmc solver debug smearing IO lanczos sp2n
|
||||||
|
|
||||||
if BUILD_CHROMA_REGRESSION
|
if BUILD_CHROMA_REGRESSION
|
||||||
SUBDIRS+= qdpxx
|
SUBDIRS+= qdpxx
|
||||||
|
@ -218,9 +218,9 @@ void runBenchmark(int* argc, char*** argv) {
|
|||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
Grid_init(&argc, &argv);
|
Grid_init(&argc, &argv);
|
||||||
|
#if Nc==3
|
||||||
runBenchmark<vComplexD>(&argc, &argv);
|
runBenchmark<vComplexD>(&argc, &argv);
|
||||||
runBenchmark<vComplexF>(&argc, &argv);
|
runBenchmark<vComplexF>(&argc, &argv);
|
||||||
|
#endif
|
||||||
Grid_finalize();
|
Grid_finalize();
|
||||||
}
|
}
|
||||||
|
@ -29,13 +29,14 @@ See the full license in the file "LICENSE" in the top level distribution
|
|||||||
directory
|
directory
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
/* END LEGAL */
|
/* END LEGAL */
|
||||||
|
|
||||||
#include <Grid/Grid.h>
|
#include <Grid/Grid.h>
|
||||||
|
|
||||||
#include <Grid/qcd/utils/CovariantCshift.h>
|
#include <Grid/qcd/utils/CovariantCshift.h>
|
||||||
|
|
||||||
#include <Grid/qcd/utils/SUn.h>
|
#include <Grid/qcd/utils/GaugeGroup.h>
|
||||||
#include <Grid/qcd/utils/SUnAdjoint.h>
|
#include <Grid/qcd/utils/SUnAdjoint.h>
|
||||||
#include <Grid/qcd/utils/SUnTwoIndex.h>
|
#include <Grid/qcd/utils/GaugeGroupTwoIndex.h>
|
||||||
|
|
||||||
#include <Grid/qcd/representations/adjoint.h>
|
#include <Grid/qcd/representations/adjoint.h>
|
||||||
#include <Grid/qcd/representations/two_index.h>
|
#include <Grid/qcd/representations/two_index.h>
|
||||||
@ -43,7 +44,6 @@ directory
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace Grid;
|
using namespace Grid;
|
||||||
;
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
Grid_init(&argc, &argv);
|
Grid_init(&argc, &argv);
|
||||||
@ -62,9 +62,6 @@ int main(int argc, char** argv) {
|
|||||||
SU2::printGenerators();
|
SU2::printGenerators();
|
||||||
std::cout << "Dimension of adjoint representation: "<< SU2Adjoint::Dimension << std::endl;
|
std::cout << "Dimension of adjoint representation: "<< SU2Adjoint::Dimension << std::endl;
|
||||||
|
|
||||||
// guard as this code fails to compile for Nc != 3
|
|
||||||
#if 1
|
|
||||||
|
|
||||||
std::cout << " Printing Adjoint Generators"<< std::endl;
|
std::cout << " Printing Adjoint Generators"<< std::endl;
|
||||||
|
|
||||||
SU2Adjoint::printGenerators();
|
SU2Adjoint::printGenerators();
|
||||||
@ -72,10 +69,10 @@ int main(int argc, char** argv) {
|
|||||||
SU2Adjoint::testGenerators();
|
SU2Adjoint::testGenerators();
|
||||||
|
|
||||||
std::cout << GridLogMessage << "*********************************************"
|
std::cout << GridLogMessage << "*********************************************"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
std::cout << GridLogMessage << "* Generators for SU(Nc" << std::endl;
|
std::cout << GridLogMessage << "* Generators for SU(3)" << std::endl;
|
||||||
std::cout << GridLogMessage << "*********************************************"
|
std::cout << GridLogMessage << "*********************************************"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
SU3::printGenerators();
|
SU3::printGenerators();
|
||||||
std::cout << "Dimension of adjoint representation: "<< SU3Adjoint::Dimension << std::endl;
|
std::cout << "Dimension of adjoint representation: "<< SU3Adjoint::Dimension << std::endl;
|
||||||
SU3Adjoint::printGenerators();
|
SU3Adjoint::printGenerators();
|
||||||
@ -94,22 +91,22 @@ int main(int argc, char** argv) {
|
|||||||
// Projectors
|
// Projectors
|
||||||
GridParallelRNG gridRNG(grid);
|
GridParallelRNG gridRNG(grid);
|
||||||
gridRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
gridRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
SU3Adjoint::LatticeAdjMatrix Gauss(grid);
|
SU_Adjoint<Nc>::LatticeAdjMatrix Gauss(grid);
|
||||||
SU3::LatticeAlgebraVector ha(grid);
|
SU<Nc>::LatticeAlgebraVector ha(grid);
|
||||||
SU3::LatticeAlgebraVector hb(grid);
|
SU<Nc>::LatticeAlgebraVector hb(grid);
|
||||||
random(gridRNG,Gauss);
|
random(gridRNG,Gauss);
|
||||||
|
|
||||||
std::cout << GridLogMessage << "Start projectOnAlgebra" << std::endl;
|
std::cout << GridLogMessage << "Start projectOnAlgebra" << std::endl;
|
||||||
SU3Adjoint::projectOnAlgebra(ha, Gauss);
|
SU_Adjoint<Nc>::projectOnAlgebra(ha, Gauss);
|
||||||
std::cout << GridLogMessage << "end projectOnAlgebra" << std::endl;
|
std::cout << GridLogMessage << "end projectOnAlgebra" << std::endl;
|
||||||
std::cout << GridLogMessage << "Start projector" << std::endl;
|
std::cout << GridLogMessage << "Start projector" << std::endl;
|
||||||
SU3Adjoint::projector(hb, Gauss);
|
SU_Adjoint<Nc>::projector(hb, Gauss);
|
||||||
std::cout << GridLogMessage << "end projector" << std::endl;
|
std::cout << GridLogMessage << "end projector" << std::endl;
|
||||||
|
|
||||||
std::cout << GridLogMessage << "ReStart projector" << std::endl;
|
std::cout << GridLogMessage << "ReStart projector" << std::endl;
|
||||||
SU3Adjoint::projector(hb, Gauss);
|
SU_Adjoint<Nc>::projector(hb, Gauss);
|
||||||
std::cout << GridLogMessage << "end projector" << std::endl;
|
std::cout << GridLogMessage << "end projector" << std::endl;
|
||||||
SU3::LatticeAlgebraVector diff = ha -hb;
|
SU<Nc>::LatticeAlgebraVector diff = ha -hb;
|
||||||
std::cout << GridLogMessage << "Difference: " << norm2(diff) << std::endl;
|
std::cout << GridLogMessage << "Difference: " << norm2(diff) << std::endl;
|
||||||
|
|
||||||
|
|
||||||
@ -119,8 +116,8 @@ int main(int argc, char** argv) {
|
|||||||
// AdjointRepresentation has the predefined number of colours Nc
|
// AdjointRepresentation has the predefined number of colours Nc
|
||||||
// Representations<FundamentalRepresentation, AdjointRepresentation, TwoIndexSymmetricRepresentation> RepresentationTypes(grid);
|
// Representations<FundamentalRepresentation, AdjointRepresentation, TwoIndexSymmetricRepresentation> RepresentationTypes(grid);
|
||||||
LatticeGaugeField U(grid), V(grid);
|
LatticeGaugeField U(grid), V(grid);
|
||||||
SU3::HotConfiguration<LatticeGaugeField>(gridRNG, U);
|
SU<Nc>::HotConfiguration<LatticeGaugeField>(gridRNG, U);
|
||||||
SU3::HotConfiguration<LatticeGaugeField>(gridRNG, V);
|
SU<Nc>::HotConfiguration<LatticeGaugeField>(gridRNG, V);
|
||||||
|
|
||||||
// Adjoint representation
|
// Adjoint representation
|
||||||
// Test group structure
|
// Test group structure
|
||||||
@ -128,8 +125,8 @@ int main(int argc, char** argv) {
|
|||||||
LatticeGaugeField UV(grid);
|
LatticeGaugeField UV(grid);
|
||||||
UV = Zero();
|
UV = Zero();
|
||||||
for (int mu = 0; mu < Nd; mu++) {
|
for (int mu = 0; mu < Nd; mu++) {
|
||||||
SU3::LatticeMatrix Umu = peekLorentz(U,mu);
|
SU<Nc>::LatticeMatrix Umu = peekLorentz(U,mu);
|
||||||
SU3::LatticeMatrix Vmu = peekLorentz(V,mu);
|
SU<Nc>::LatticeMatrix Vmu = peekLorentz(V,mu);
|
||||||
pokeLorentz(UV,Umu*Vmu, mu);
|
pokeLorentz(UV,Umu*Vmu, mu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,6 +148,7 @@ int main(int argc, char** argv) {
|
|||||||
pokeLorentz(UrVr,Urmu*Vrmu, mu);
|
pokeLorentz(UrVr,Urmu*Vrmu, mu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if Nc==3
|
||||||
typedef typename SU_Adjoint<Nc>::AMatrix AdjointMatrix;
|
typedef typename SU_Adjoint<Nc>::AMatrix AdjointMatrix;
|
||||||
typename AdjointRep<Nc>::LatticeField Diff_check = UVr - UrVr;
|
typename AdjointRep<Nc>::LatticeField Diff_check = UVr - UrVr;
|
||||||
std::cout << GridLogMessage << "Group structure SU("<<Nc<<") check difference (Adjoint representation) : " << norm2(Diff_check) << std::endl;
|
std::cout << GridLogMessage << "Group structure SU("<<Nc<<") check difference (Adjoint representation) : " << norm2(Diff_check) << std::endl;
|
||||||
@ -176,19 +174,19 @@ int main(int argc, char** argv) {
|
|||||||
assert(abs( (2.0*tr1-tr2) ) < 1.0e-7);
|
assert(abs( (2.0*tr1-tr2) ) < 1.0e-7);
|
||||||
std::cout << "------------------"<<std::endl;
|
std::cout << "------------------"<<std::endl;
|
||||||
}}}
|
}}}
|
||||||
|
#endif
|
||||||
// Check correspondence of algebra and group transformations
|
// Check correspondence of algebra and group transformations
|
||||||
// Create a random vector
|
// Create a random vector
|
||||||
SU3::LatticeAlgebraVector h_adj(grid);
|
SU<Nc>::LatticeAlgebraVector h_adj(grid);
|
||||||
typename AdjointRep<Nc>::LatticeMatrix Ar(grid);
|
typename AdjointRep<Nc>::LatticeMatrix Ar(grid);
|
||||||
random(gridRNG,h_adj);
|
random(gridRNG,h_adj);
|
||||||
h_adj = real(h_adj);
|
h_adj = real(h_adj);
|
||||||
SU_Adjoint<Nc>::AdjointLieAlgebraMatrix(h_adj,Ar);
|
SU_Adjoint<Nc>::AdjointLieAlgebraMatrix(h_adj,Ar);
|
||||||
|
|
||||||
// Re-extract h_adj
|
// Re-extract h_adj
|
||||||
SU3::LatticeAlgebraVector h_adj2(grid);
|
SU<Nc>::LatticeAlgebraVector h_adj2(grid);
|
||||||
SU_Adjoint<Nc>::projectOnAlgebra(h_adj2, Ar);
|
SU_Adjoint<Nc>::projectOnAlgebra(h_adj2, Ar);
|
||||||
SU3::LatticeAlgebraVector h_diff = h_adj - h_adj2;
|
SU<Nc>::LatticeAlgebraVector h_diff = h_adj - h_adj2;
|
||||||
std::cout << GridLogMessage << "Projections structure check vector difference (Adjoint representation) : " << norm2(h_diff) << std::endl;
|
std::cout << GridLogMessage << "Projections structure check vector difference (Adjoint representation) : " << norm2(h_diff) << std::endl;
|
||||||
|
|
||||||
// Exponentiate
|
// Exponentiate
|
||||||
@ -210,14 +208,14 @@ int main(int argc, char** argv) {
|
|||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
// Construct the fundamental matrix in the group
|
// Construct the fundamental matrix in the group
|
||||||
SU3::LatticeMatrix Af(grid);
|
SU<Nc>::LatticeMatrix Af(grid);
|
||||||
SU3::FundamentalLieAlgebraMatrix(h_adj,Af);
|
SU<Nc>::FundamentalLieAlgebraMatrix(h_adj,Af);
|
||||||
SU3::LatticeMatrix Ufund(grid);
|
SU<Nc>::LatticeMatrix Ufund(grid);
|
||||||
Ufund = expMat(Af, 1.0, 16);
|
Ufund = expMat(Af, 1.0, 16);
|
||||||
// Check unitarity
|
// Check unitarity
|
||||||
SU3::LatticeMatrix uno_f(grid);
|
SU<Nc>::LatticeMatrix uno_f(grid);
|
||||||
uno_f = 1.0;
|
uno_f = 1.0;
|
||||||
SU3::LatticeMatrix UnitCheck(grid);
|
SU<Nc>::LatticeMatrix UnitCheck(grid);
|
||||||
UnitCheck = Ufund * adj(Ufund) - uno_f;
|
UnitCheck = Ufund * adj(Ufund) - uno_f;
|
||||||
std::cout << GridLogMessage << "unitarity check 1: " << norm2(UnitCheck)
|
std::cout << GridLogMessage << "unitarity check 1: " << norm2(UnitCheck)
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -280,20 +278,20 @@ int main(int argc, char** argv) {
|
|||||||
std::cout << GridLogMessage << "Test for the Two Index Symmetric projectors"
|
std::cout << GridLogMessage << "Test for the Two Index Symmetric projectors"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
// Projectors
|
// Projectors
|
||||||
SU3TwoIndexSymm::LatticeTwoIndexMatrix Gauss2(grid);
|
SU_TwoIndex<Nc, Symmetric>::LatticeTwoIndexMatrix Gauss2(grid);
|
||||||
random(gridRNG,Gauss2);
|
random(gridRNG,Gauss2);
|
||||||
|
|
||||||
std::cout << GridLogMessage << "Start projectOnAlgebra" << std::endl;
|
std::cout << GridLogMessage << "Start projectOnAlgebra" << std::endl;
|
||||||
SU3TwoIndexSymm::projectOnAlgebra(ha, Gauss2);
|
SU_TwoIndex<Nc, Symmetric>::projectOnAlgebra(ha, Gauss2);
|
||||||
std::cout << GridLogMessage << "end projectOnAlgebra" << std::endl;
|
std::cout << GridLogMessage << "end projectOnAlgebra" << std::endl;
|
||||||
std::cout << GridLogMessage << "Start projector" << std::endl;
|
std::cout << GridLogMessage << "Start projector" << std::endl;
|
||||||
SU3TwoIndexSymm::projector(hb, Gauss2);
|
SU_TwoIndex<Nc, Symmetric>::projector(hb, Gauss2);
|
||||||
std::cout << GridLogMessage << "end projector" << std::endl;
|
std::cout << GridLogMessage << "end projector" << std::endl;
|
||||||
|
|
||||||
std::cout << GridLogMessage << "ReStart projector" << std::endl;
|
std::cout << GridLogMessage << "ReStart projector" << std::endl;
|
||||||
SU3TwoIndexSymm::projector(hb, Gauss2);
|
SU_TwoIndex<Nc, Symmetric>::projector(hb, Gauss2);
|
||||||
std::cout << GridLogMessage << "end projector" << std::endl;
|
std::cout << GridLogMessage << "end projector" << std::endl;
|
||||||
SU3::LatticeAlgebraVector diff2 = ha - hb;
|
SU<Nc>::LatticeAlgebraVector diff2 = ha - hb;
|
||||||
std::cout << GridLogMessage << "Difference: " << norm2(diff) << std::endl;
|
std::cout << GridLogMessage << "Difference: " << norm2(diff) << std::endl;
|
||||||
std::cout << GridLogMessage << "*********************************************"
|
std::cout << GridLogMessage << "*********************************************"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -304,20 +302,20 @@ int main(int argc, char** argv) {
|
|||||||
std::cout << GridLogMessage << "Test for the Two index anti-Symmetric projectors"
|
std::cout << GridLogMessage << "Test for the Two index anti-Symmetric projectors"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
// Projectors
|
// Projectors
|
||||||
SU3TwoIndexAntiSymm::LatticeTwoIndexMatrix Gauss2a(grid);
|
SU_TwoIndex<Nc, AntiSymmetric>::LatticeTwoIndexMatrix Gauss2a(grid);
|
||||||
random(gridRNG,Gauss2a);
|
random(gridRNG,Gauss2a);
|
||||||
|
|
||||||
std::cout << GridLogMessage << "Start projectOnAlgebra" << std::endl;
|
std::cout << GridLogMessage << "Start projectOnAlgebra" << std::endl;
|
||||||
SU3TwoIndexAntiSymm::projectOnAlgebra(ha, Gauss2a);
|
SU_TwoIndex<Nc, AntiSymmetric>::projectOnAlgebra(ha, Gauss2a);
|
||||||
std::cout << GridLogMessage << "end projectOnAlgebra" << std::endl;
|
std::cout << GridLogMessage << "end projectOnAlgebra" << std::endl;
|
||||||
std::cout << GridLogMessage << "Start projector" << std::endl;
|
std::cout << GridLogMessage << "Start projector" << std::endl;
|
||||||
SU3TwoIndexAntiSymm::projector(hb, Gauss2a);
|
SU_TwoIndex<Nc, AntiSymmetric>::projector(hb, Gauss2a);
|
||||||
std::cout << GridLogMessage << "end projector" << std::endl;
|
std::cout << GridLogMessage << "end projector" << std::endl;
|
||||||
|
|
||||||
std::cout << GridLogMessage << "ReStart projector" << std::endl;
|
std::cout << GridLogMessage << "ReStart projector" << std::endl;
|
||||||
SU3TwoIndexAntiSymm::projector(hb, Gauss2a);
|
SU_TwoIndex<Nc, AntiSymmetric>::projector(hb, Gauss2a);
|
||||||
std::cout << GridLogMessage << "end projector" << std::endl;
|
std::cout << GridLogMessage << "end projector" << std::endl;
|
||||||
SU3::LatticeAlgebraVector diff2a = ha - hb;
|
SU<Nc>::LatticeAlgebraVector diff2a = ha - hb;
|
||||||
std::cout << GridLogMessage << "Difference: " << norm2(diff2a) << std::endl;
|
std::cout << GridLogMessage << "Difference: " << norm2(diff2a) << std::endl;
|
||||||
std::cout << GridLogMessage << "*********************************************"
|
std::cout << GridLogMessage << "*********************************************"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -326,23 +324,25 @@ int main(int argc, char** argv) {
|
|||||||
std::cout << GridLogMessage << "Two index Symmetric: Checking Group Structure"
|
std::cout << GridLogMessage << "Two index Symmetric: Checking Group Structure"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
// Testing HMC representation classes
|
// Testing HMC representation classes
|
||||||
TwoIndexRep< Nc, Symmetric > TIndexRep(grid);
|
TwoIndexRep< Nc, Symmetric> TIndexRep(grid);
|
||||||
|
|
||||||
// Test group structure
|
// Test group structure
|
||||||
// (U_f * V_f)_r = U_r * V_r
|
// (U_f * V_f)_r = U_r * V_r
|
||||||
LatticeGaugeField U2(grid), V2(grid);
|
LatticeGaugeField U2(grid), V2(grid);
|
||||||
SU3::HotConfiguration<LatticeGaugeField>(gridRNG, U2);
|
|
||||||
SU3::HotConfiguration<LatticeGaugeField>(gridRNG, V2);
|
SU<Nc>::HotConfiguration<LatticeGaugeField>(gridRNG, U2);
|
||||||
|
SU<Nc>::HotConfiguration<LatticeGaugeField>(gridRNG, V2);
|
||||||
|
|
||||||
LatticeGaugeField UV2(grid);
|
LatticeGaugeField UV2(grid);
|
||||||
UV2 = Zero();
|
UV2 = Zero();
|
||||||
for (int mu = 0; mu < Nd; mu++) {
|
for (int mu = 0; mu < Nd; mu++) {
|
||||||
SU3::LatticeMatrix Umu2 = peekLorentz(U2,mu);
|
SU<Nc>::LatticeMatrix Umu2 = peekLorentz(U2,mu);
|
||||||
SU3::LatticeMatrix Vmu2 = peekLorentz(V2,mu);
|
SU<Nc>::LatticeMatrix Vmu2 = peekLorentz(V2,mu);
|
||||||
pokeLorentz(UV2,Umu2*Vmu2, mu);
|
pokeLorentz(UV2,Umu2*Vmu2, mu);
|
||||||
}
|
}
|
||||||
|
|
||||||
TIndexRep.update_representation(UV2);
|
TIndexRep.update_representation(UV2);
|
||||||
|
|
||||||
typename TwoIndexRep< Nc, Symmetric >::LatticeField UVr2 = TIndexRep.U; // (U_f * V_f)_r
|
typename TwoIndexRep< Nc, Symmetric >::LatticeField UVr2 = TIndexRep.U; // (U_f * V_f)_r
|
||||||
|
|
||||||
TIndexRep.update_representation(U2);
|
TIndexRep.update_representation(U2);
|
||||||
@ -352,29 +352,31 @@ int main(int argc, char** argv) {
|
|||||||
typename TwoIndexRep< Nc, Symmetric >::LatticeField Vr2 = TIndexRep.U; // V_r
|
typename TwoIndexRep< Nc, Symmetric >::LatticeField Vr2 = TIndexRep.U; // V_r
|
||||||
|
|
||||||
typename TwoIndexRep< Nc, Symmetric >::LatticeField Ur2Vr2(grid);
|
typename TwoIndexRep< Nc, Symmetric >::LatticeField Ur2Vr2(grid);
|
||||||
|
|
||||||
Ur2Vr2 = Zero();
|
Ur2Vr2 = Zero();
|
||||||
for (int mu = 0; mu < Nd; mu++) {
|
for (int mu = 0; mu < Nd; mu++) {
|
||||||
typename TwoIndexRep< Nc, Symmetric >::LatticeMatrix Urmu2 = peekLorentz(Ur2,mu);
|
typename TwoIndexRep< Nc, Symmetric>::LatticeMatrix Urmu2 = peekLorentz(Ur2,mu);
|
||||||
typename TwoIndexRep< Nc, Symmetric >::LatticeMatrix Vrmu2 = peekLorentz(Vr2,mu);
|
typename TwoIndexRep< Nc, Symmetric>::LatticeMatrix Vrmu2 = peekLorentz(Vr2,mu);
|
||||||
pokeLorentz(Ur2Vr2,Urmu2*Vrmu2, mu);
|
pokeLorentz(Ur2Vr2,Urmu2*Vrmu2, mu);
|
||||||
}
|
}
|
||||||
|
|
||||||
typename TwoIndexRep< Nc, Symmetric >::LatticeField Diff_check2 = UVr2 - Ur2Vr2;
|
typename TwoIndexRep< Nc, Symmetric >::LatticeField Diff_check2 = UVr2 - Ur2Vr2;
|
||||||
|
|
||||||
std::cout << GridLogMessage << "Group structure SU("<<Nc<<") check difference (Two Index Symmetric): " << norm2(Diff_check2) << std::endl;
|
std::cout << GridLogMessage << "Group structure SU("<<Nc<<") check difference (Two Index Symmetric): " << norm2(Diff_check2) << std::endl;
|
||||||
|
|
||||||
|
|
||||||
// Check correspondence of algebra and group transformations
|
// Check correspondence of algebra and group transformations
|
||||||
// Create a random vector
|
// Create a random vector
|
||||||
SU3::LatticeAlgebraVector h_sym(grid);
|
SU<Nc>::LatticeAlgebraVector h_sym(grid);
|
||||||
typename TwoIndexRep< Nc, Symmetric>::LatticeMatrix Ar_sym(grid);
|
typename TwoIndexRep< Nc, Symmetric>::LatticeMatrix Ar_sym(grid);
|
||||||
random(gridRNG,h_sym);
|
random(gridRNG,h_sym);
|
||||||
h_sym = real(h_sym);
|
h_sym = real(h_sym);
|
||||||
SU_TwoIndex<Nc,Symmetric>::TwoIndexLieAlgebraMatrix(h_sym,Ar_sym);
|
SU_TwoIndex<Nc,Symmetric>::TwoIndexLieAlgebraMatrix(h_sym,Ar_sym);
|
||||||
|
|
||||||
// Re-extract h_sym
|
// Re-extract h_sym
|
||||||
SU3::LatticeAlgebraVector h_sym2(grid);
|
SU<Nc>::LatticeAlgebraVector h_sym2(grid);
|
||||||
SU_TwoIndex< Nc, Symmetric>::projectOnAlgebra(h_sym2, Ar_sym);
|
SU_TwoIndex< Nc, Symmetric>::projectOnAlgebra(h_sym2, Ar_sym);
|
||||||
SU3::LatticeAlgebraVector h_diff_sym = h_sym - h_sym2;
|
SU<Nc>::LatticeAlgebraVector h_diff_sym = h_sym - h_sym2;
|
||||||
std::cout << GridLogMessage << "Projections structure check vector difference (Two Index Symmetric): " << norm2(h_diff_sym) << std::endl;
|
std::cout << GridLogMessage << "Projections structure check vector difference (Two Index Symmetric): " << norm2(h_diff_sym) << std::endl;
|
||||||
|
|
||||||
// Exponentiate
|
// Exponentiate
|
||||||
@ -396,11 +398,11 @@ int main(int argc, char** argv) {
|
|||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
// Construct the fundamental matrix in the group
|
// Construct the fundamental matrix in the group
|
||||||
SU3::LatticeMatrix Af_sym(grid);
|
SU<Nc>::LatticeMatrix Af_sym(grid);
|
||||||
SU3::FundamentalLieAlgebraMatrix(h_sym,Af_sym);
|
SU<Nc>::FundamentalLieAlgebraMatrix(h_sym,Af_sym);
|
||||||
SU3::LatticeMatrix Ufund2(grid);
|
SU<Nc>::LatticeMatrix Ufund2(grid);
|
||||||
Ufund2 = expMat(Af_sym, 1.0, 16);
|
Ufund2 = expMat(Af_sym, 1.0, 16);
|
||||||
SU3::LatticeMatrix UnitCheck2(grid);
|
SU<Nc>::LatticeMatrix UnitCheck2(grid);
|
||||||
UnitCheck2 = Ufund2 * adj(Ufund2) - uno_f;
|
UnitCheck2 = Ufund2 * adj(Ufund2) - uno_f;
|
||||||
std::cout << GridLogMessage << "unitarity check 1: " << norm2(UnitCheck2)
|
std::cout << GridLogMessage << "unitarity check 1: " << norm2(UnitCheck2)
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -425,115 +427,113 @@ int main(int argc, char** argv) {
|
|||||||
std::cout << GridLogMessage << "*********************************************"
|
std::cout << GridLogMessage << "*********************************************"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
|
std::cout << GridLogMessage << "Two Index anti-Symmetric: Check Group Structure"
|
||||||
std::cout << GridLogMessage << "Two Index anti-Symmetric: Check Group Structure"
|
<< std::endl;
|
||||||
<< std::endl;
|
// Testing HMC representation classes
|
||||||
// Testing HMC representation classes
|
TwoIndexRep< Nc, AntiSymmetric> TIndexRepA(grid);
|
||||||
TwoIndexRep< Nc, AntiSymmetric > TIndexRepA(grid);
|
|
||||||
|
|
||||||
|
|
||||||
// Test group structure
|
// Test group structure
|
||||||
// (U_f * V_f)_r = U_r * V_r
|
// (U_f * V_f)_r = U_r * V_r
|
||||||
LatticeGaugeField U2A(grid), V2A(grid);
|
LatticeGaugeField U2A(grid), V2A(grid);
|
||||||
SU3::HotConfiguration<LatticeGaugeField>(gridRNG, U2A);
|
SU<Nc>::HotConfiguration<LatticeGaugeField>(gridRNG, U2A);
|
||||||
SU3::HotConfiguration<LatticeGaugeField>(gridRNG, V2A);
|
SU<Nc>::HotConfiguration<LatticeGaugeField>(gridRNG, V2A);
|
||||||
|
|
||||||
LatticeGaugeField UV2A(grid);
|
LatticeGaugeField UV2A(grid);
|
||||||
UV2A = Zero();
|
UV2A = Zero();
|
||||||
for (int mu = 0; mu < Nd; mu++) {
|
for (int mu = 0; mu < Nd; mu++) {
|
||||||
SU3::LatticeMatrix Umu2A = peekLorentz(U2,mu);
|
SU<Nc>::LatticeMatrix Umu2A = peekLorentz(U2,mu);
|
||||||
SU3::LatticeMatrix Vmu2A = peekLorentz(V2,mu);
|
SU<Nc>::LatticeMatrix Vmu2A = peekLorentz(V2,mu);
|
||||||
pokeLorentz(UV2A,Umu2A*Vmu2A, mu);
|
pokeLorentz(UV2A,Umu2A*Vmu2A, mu);
|
||||||
}
|
|
||||||
|
|
||||||
TIndexRep.update_representation(UV2A);
|
|
||||||
typename TwoIndexRep< Nc, AntiSymmetric >::LatticeField UVr2A = TIndexRepA.U; // (U_f * V_f)_r
|
|
||||||
|
|
||||||
TIndexRep.update_representation(U2A);
|
|
||||||
typename TwoIndexRep< Nc, AntiSymmetric >::LatticeField Ur2A = TIndexRepA.U; // U_r
|
|
||||||
|
|
||||||
TIndexRep.update_representation(V2A);
|
|
||||||
typename TwoIndexRep< Nc, AntiSymmetric >::LatticeField Vr2A = TIndexRepA.U; // V_r
|
|
||||||
|
|
||||||
typename TwoIndexRep< Nc, AntiSymmetric >::LatticeField Ur2Vr2A(grid);
|
|
||||||
Ur2Vr2A = Zero();
|
|
||||||
for (int mu = 0; mu < Nd; mu++) {
|
|
||||||
typename TwoIndexRep< Nc, AntiSymmetric >::LatticeMatrix Urmu2A = peekLorentz(Ur2A,mu);
|
|
||||||
typename TwoIndexRep< Nc, AntiSymmetric >::LatticeMatrix Vrmu2A = peekLorentz(Vr2A,mu);
|
|
||||||
pokeLorentz(Ur2Vr2A,Urmu2A*Vrmu2A, mu);
|
|
||||||
}
|
|
||||||
|
|
||||||
typename TwoIndexRep< Nc, AntiSymmetric >::LatticeField Diff_check2A = UVr2A - Ur2Vr2A;
|
|
||||||
std::cout << GridLogMessage << "Group structure SU("<<Nc<<") check difference (Two Index anti-Symmetric): " << norm2(Diff_check2A) << std::endl;
|
|
||||||
|
|
||||||
|
|
||||||
// Check correspondence of algebra and group transformations
|
|
||||||
// Create a random vector
|
|
||||||
SU3::LatticeAlgebraVector h_Asym(grid);
|
|
||||||
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix Ar_Asym(grid);
|
|
||||||
random(gridRNG,h_Asym);
|
|
||||||
h_Asym = real(h_Asym);
|
|
||||||
SU_TwoIndex< Nc, AntiSymmetric>::TwoIndexLieAlgebraMatrix(h_Asym,Ar_Asym);
|
|
||||||
|
|
||||||
// Re-extract h_sym
|
|
||||||
SU3::LatticeAlgebraVector h_Asym2(grid);
|
|
||||||
SU_TwoIndex< Nc, AntiSymmetric>::projectOnAlgebra(h_Asym2, Ar_Asym);
|
|
||||||
SU3::LatticeAlgebraVector h_diff_Asym = h_Asym - h_Asym2;
|
|
||||||
std::cout << GridLogMessage << "Projections structure check vector difference (Two Index anti-Symmetric): " << norm2(h_diff_Asym) << std::endl;
|
|
||||||
|
|
||||||
|
|
||||||
// Exponentiate
|
|
||||||
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix U2iAS(grid);
|
|
||||||
U2iAS = expMat(Ar_Asym, 1.0, 16);
|
|
||||||
|
|
||||||
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix uno2iAS(grid);
|
|
||||||
uno2iAS = 1.0;
|
|
||||||
// Check matrix U2iS, must be real orthogonal
|
|
||||||
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix Ucheck2iAS = U2iAS - conjugate(U2iAS);
|
|
||||||
std::cout << GridLogMessage << "Reality check: " << norm2(Ucheck2iAS)
|
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
Ucheck2iAS = U2iAS * adj(U2iAS) - uno2iAS;
|
|
||||||
std::cout << GridLogMessage << "orthogonality check 1: " << norm2(Ucheck2iAS)
|
|
||||||
<< std::endl;
|
|
||||||
Ucheck2iAS = adj(U2iAS) * U2iAS - uno2iAS;
|
|
||||||
std::cout << GridLogMessage << "orthogonality check 2: " << norm2(Ucheck2iAS)
|
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Construct the fundamental matrix in the group
|
|
||||||
SU3::LatticeMatrix Af_Asym(grid);
|
|
||||||
SU3::FundamentalLieAlgebraMatrix(h_Asym,Af_Asym);
|
|
||||||
SU3::LatticeMatrix Ufund2A(grid);
|
|
||||||
Ufund2A = expMat(Af_Asym, 1.0, 16);
|
|
||||||
SU3::LatticeMatrix UnitCheck2A(grid);
|
|
||||||
UnitCheck2A = Ufund2A * adj(Ufund2A) - uno_f;
|
|
||||||
std::cout << GridLogMessage << "unitarity check 1: " << norm2(UnitCheck2A)
|
|
||||||
<< std::endl;
|
|
||||||
UnitCheck2A = adj(Ufund2A) * Ufund2A - uno_f;
|
|
||||||
std::cout << GridLogMessage << "unitarity check 2: " << norm2(UnitCheck2A)
|
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
|
|
||||||
// Tranform to the 2Index Sym representation
|
|
||||||
U = Zero(); // fill this with only one direction
|
|
||||||
pokeLorentz(U,Ufund2A,0); // the representation transf acts on full gauge fields
|
|
||||||
|
|
||||||
TIndexRepA.update_representation(U);
|
|
||||||
Ur2A = TIndexRepA.U; // U_r
|
|
||||||
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix Ur02A = peekLorentz(Ur2A,0); // this should be the same as U2iS
|
|
||||||
|
|
||||||
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix Diff_check_mat2A = Ur02A - U2iAS;
|
|
||||||
std::cout << GridLogMessage << "Projections structure check group difference (Two Index anti-Symmetric): " << norm2(Diff_check_mat2A) << std::endl;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
std::cout << GridLogMessage << "Skipping Two Index anti-Symmetric tests "
|
|
||||||
"because representation is trivial (dim = 1)"
|
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
TIndexRep.update_representation(UV2A);
|
||||||
|
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeField UVr2A = TIndexRepA.U; // (U_f * V_f)_r
|
||||||
|
|
||||||
|
TIndexRep.update_representation(U2A);
|
||||||
|
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeField Ur2A = TIndexRepA.U; // U_r
|
||||||
|
|
||||||
|
TIndexRep.update_representation(V2A);
|
||||||
|
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeField Vr2A = TIndexRepA.U; // V_r
|
||||||
|
|
||||||
|
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeField Ur2Vr2A(grid);
|
||||||
|
Ur2Vr2A = Zero();
|
||||||
|
for (int mu = 0; mu < Nd; mu++) {
|
||||||
|
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix Urmu2A = peekLorentz(Ur2A,mu);
|
||||||
|
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix Vrmu2A = peekLorentz(Vr2A,mu);
|
||||||
|
pokeLorentz(Ur2Vr2A,Urmu2A*Vrmu2A, mu);
|
||||||
|
}
|
||||||
|
|
||||||
|
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeField Diff_check2A = UVr2A - Ur2Vr2A;
|
||||||
|
std::cout << GridLogMessage << "Group structure SU("<<Nc<<") check difference (Two Index anti-Symmetric): " << norm2(Diff_check2A) << std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
// Check correspondence of algebra and group transformations
|
||||||
|
// Create a random vector
|
||||||
|
SU<Nc>::LatticeAlgebraVector h_Asym(grid);
|
||||||
|
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix Ar_Asym(grid);
|
||||||
|
random(gridRNG,h_Asym);
|
||||||
|
h_Asym = real(h_Asym);
|
||||||
|
SU_TwoIndex< Nc, AntiSymmetric>::TwoIndexLieAlgebraMatrix(h_Asym,Ar_Asym);
|
||||||
|
|
||||||
|
// Re-extract h_sym
|
||||||
|
SU<Nc>::LatticeAlgebraVector h_Asym2(grid);
|
||||||
|
SU_TwoIndex< Nc, AntiSymmetric>::projectOnAlgebra(h_Asym2, Ar_Asym);
|
||||||
|
SU<Nc>::LatticeAlgebraVector h_diff_Asym = h_Asym - h_Asym2;
|
||||||
|
std::cout << GridLogMessage << "Projections structure check vector difference (Two Index anti-Symmetric): " << norm2(h_diff_Asym) << std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
// Exponentiate
|
||||||
|
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix U2iAS(grid);
|
||||||
|
U2iAS = expMat(Ar_Asym, 1.0, 16);
|
||||||
|
|
||||||
|
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix uno2iAS(grid);
|
||||||
|
uno2iAS = 1.0;
|
||||||
|
// Check matrix U2iS, must be real orthogonal
|
||||||
|
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix Ucheck2iAS = U2iAS - conjugate(U2iAS);
|
||||||
|
std::cout << GridLogMessage << "Reality check: " << norm2(Ucheck2iAS)
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
|
Ucheck2iAS = U2iAS * adj(U2iAS) - uno2iAS;
|
||||||
|
std::cout << GridLogMessage << "orthogonality check 1: " << norm2(Ucheck2iAS)
|
||||||
|
<< std::endl;
|
||||||
|
Ucheck2iAS = adj(U2iAS) * U2iAS - uno2iAS;
|
||||||
|
std::cout << GridLogMessage << "orthogonality check 2: " << norm2(Ucheck2iAS)
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Construct the fundamental matrix in the group
|
||||||
|
SU<Nc>::LatticeMatrix Af_Asym(grid);
|
||||||
|
SU<Nc>::FundamentalLieAlgebraMatrix(h_Asym,Af_Asym);
|
||||||
|
SU<Nc>::LatticeMatrix Ufund2A(grid);
|
||||||
|
Ufund2A = expMat(Af_Asym, 1.0, 16);
|
||||||
|
SU<Nc>::LatticeMatrix UnitCheck2A(grid);
|
||||||
|
UnitCheck2A = Ufund2A * adj(Ufund2A) - uno_f;
|
||||||
|
std::cout << GridLogMessage << "unitarity check 1: " << norm2(UnitCheck2A)
|
||||||
|
<< std::endl;
|
||||||
|
UnitCheck2A = adj(Ufund2A) * Ufund2A - uno_f;
|
||||||
|
std::cout << GridLogMessage << "unitarity check 2: " << norm2(UnitCheck2A)
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
// Tranform to the 2Index Sym representation
|
||||||
|
U = Zero(); // fill this with only one direction
|
||||||
|
pokeLorentz(U,Ufund2A,0); // the representation transf acts on full gauge fields
|
||||||
|
|
||||||
|
TIndexRepA.update_representation(U);
|
||||||
|
Ur2A = TIndexRepA.U; // U_r
|
||||||
|
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix Ur02A = peekLorentz(Ur2A,0); // this should be the same as U2iS
|
||||||
|
|
||||||
|
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix Diff_check_mat2A = Ur02A - U2iAS;
|
||||||
|
std::cout << GridLogMessage << "Projections structure check group difference (Two Index anti-Symmetric): " << norm2(Diff_check_mat2A) << std::endl;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
std::cout << GridLogMessage << "Skipping Two Index anti-Symmetric tests "
|
||||||
|
"because representation is trivial (dim = 1)"
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
Grid_finalize();
|
Grid_finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
|||||||
See the full license in the file "LICENSE" in the top level distribution directory
|
See the full license in the file "LICENSE" in the top level distribution directory
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
/* END LEGAL */
|
/* END LEGAL */
|
||||||
|
|
||||||
#include <Grid/Grid.h>
|
#include <Grid/Grid.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -122,7 +123,8 @@ int main (int argc, char ** argv)
|
|||||||
std::cout << "Determinant defect before projection " <<norm2(detU)<<std::endl;
|
std::cout << "Determinant defect before projection " <<norm2(detU)<<std::endl;
|
||||||
tmp = U*adj(U) - ident;
|
tmp = U*adj(U) - ident;
|
||||||
std::cout << "Unitarity check before projection " << norm2(tmp)<<std::endl;
|
std::cout << "Unitarity check before projection " << norm2(tmp)<<std::endl;
|
||||||
#if (Nc == 3)
|
|
||||||
|
#if Nc==3
|
||||||
ProjectSU3(U);
|
ProjectSU3(U);
|
||||||
detU= Determinant(U) ;
|
detU= Determinant(U) ;
|
||||||
detU= detU -1.0;
|
detU= detU -1.0;
|
||||||
@ -140,7 +142,3 @@ int main (int argc, char ** argv)
|
|||||||
|
|
||||||
Grid_finalize();
|
Grid_finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,16 +93,9 @@ int main(int argc, char** argv) {
|
|||||||
// Setup of Dirac Matrix and Operator //
|
// Setup of Dirac Matrix and Operator //
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
LatticeGaugeField Umu(Grid_f);
|
LatticeGaugeField Umu(Grid_f);
|
||||||
#if (Nc==2)
|
SU<Nc>::HotConfiguration(pRNG_f, Umu);
|
||||||
SU2::HotConfiguration(pRNG_f, Umu);
|
|
||||||
#elif (defined Nc==3)
|
|
||||||
SU3::HotConfiguration(pRNG_f, Umu);
|
|
||||||
#elif (defined Nc==4)
|
|
||||||
SU4::HotConfiguration(pRNG_f, Umu);
|
|
||||||
#elif (defined Nc==5)
|
|
||||||
SU5::HotConfiguration(pRNG_f, Umu);
|
|
||||||
#endif
|
|
||||||
RealD checkTolerance = (getPrecision<LatticeFermion>::value == 1) ? 1e-7 : 1e-15;
|
RealD checkTolerance = (getPrecision<LatticeFermion>::value == 1) ? 1e-7 : 1e-15;
|
||||||
|
|
||||||
RealD mass = -0.30;
|
RealD mass = -0.30;
|
||||||
|
8
tests/sp2n/Makefile.am
Normal file
8
tests/sp2n/Makefile.am
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
.PHONY: check
|
||||||
|
|
||||||
|
include Make.inc
|
||||||
|
|
||||||
|
check: tests
|
||||||
|
./Test_project_on_Sp
|
||||||
|
./Test_sp2n_lie_gen
|
||||||
|
./Test_Sp_start
|
149
tests/sp2n/Test_2as_base.cc
Normal file
149
tests/sp2n/Test_2as_base.cc
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
#include <Grid/Grid.h>
|
||||||
|
|
||||||
|
#define verbose 0
|
||||||
|
|
||||||
|
using namespace Grid;
|
||||||
|
|
||||||
|
template<int this_nc>
|
||||||
|
static void check_dimensions() {
|
||||||
|
|
||||||
|
const int this_n = this_nc/2;
|
||||||
|
const int this_algebra_dim = Sp<this_nc>::AlgebraDimension;
|
||||||
|
|
||||||
|
RealD realA;
|
||||||
|
std::cout << GridLogMessage << "Nc = " << this_n << " 2as dimension is " << Sp_TwoIndex<this_nc, AntiSymmetric>::Dimension << std::endl;
|
||||||
|
std::cout << GridLogMessage << "Nc = " << this_n << " 2s dimension is " << Sp_TwoIndex<this_nc, Symmetric>::Dimension << std::endl;
|
||||||
|
std::cout << GridLogMessage << "Nc = " << this_n << " algebra dimension is " << this_algebra_dim << std::endl;
|
||||||
|
realA = Sp_TwoIndex<this_nc, AntiSymmetric>::Dimension + Sp_TwoIndex<this_nc, Symmetric>::Dimension;
|
||||||
|
std::cout << GridLogMessage << "Checking dim(2AS) + dim(AS) + 1 = Nc * Nc " << this_algebra_dim << std::endl;
|
||||||
|
assert ( realA == this_nc * this_nc - 1); // Nc x Nc = dim(2indxS) + dim(2indxAS) + dim(singlet)
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int this_nc, TwoIndexSymmetry S>
|
||||||
|
static void run_symmetry_checks() {
|
||||||
|
typedef typename Sp_TwoIndex<this_nc, S>::template iGroupMatrix<Complex> Matrix;
|
||||||
|
const int this_n = this_nc/2;
|
||||||
|
const int this_irrep_dim = Sp_TwoIndex<this_nc, S>::Dimension;
|
||||||
|
const int this_algebra_dim = Sp<this_nc>::AlgebraDimension;
|
||||||
|
Matrix eij_c;
|
||||||
|
Matrix e_sum;
|
||||||
|
RealD realS = S;
|
||||||
|
|
||||||
|
std::cout << GridLogMessage << "checking base has symmetry " << S << std::endl;
|
||||||
|
for (int a=0; a < this_irrep_dim; a++)
|
||||||
|
{
|
||||||
|
Sp_TwoIndex<this_nc, S>::base(a, eij_c);
|
||||||
|
e_sum = eij_c - realS * transpose(eij_c);
|
||||||
|
std::cout << GridLogMessage << "e_ab - (" << S << " * e_ab^T ) = " << norm2(e_sum) << std::endl;
|
||||||
|
assert(norm2(e_sum) < 1e-8);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int this_nc, TwoIndexSymmetry S>
|
||||||
|
static void run_traces_checks() {
|
||||||
|
typedef typename Sp_TwoIndex<this_nc, S>::template iGroupMatrix<Complex> Matrix;
|
||||||
|
const int this_n = this_nc/2;
|
||||||
|
const int this_irrep_dim = Sp_TwoIndex<this_nc, S>::Dimension;
|
||||||
|
const int this_algebra_dim = Sp<this_nc>::AlgebraDimension;
|
||||||
|
Matrix eij_a;
|
||||||
|
Matrix eij_b;
|
||||||
|
Matrix Omega;
|
||||||
|
Sp<this_nc>::Omega(Omega);
|
||||||
|
RealD realS = S;
|
||||||
|
RealD realA;
|
||||||
|
|
||||||
|
std::cout << GridLogMessage << "Checking Tr (e^(ab) Omega ) = 0 and Tr (e^(ab) e^(cd) = delta^((ab)(cd)) ) " << std::endl;
|
||||||
|
for (int a=0; a < Sp_TwoIndex<this_nc, S>::Dimension; a++) {
|
||||||
|
Sp_TwoIndex<this_nc, S>::base(a, eij_a);
|
||||||
|
realA = norm2(trace(Omega*eij_a));
|
||||||
|
std::cout << GridLogMessage << "Checkig Omega-trace for e_{ab=" << a << "} " << std::endl;
|
||||||
|
//std::cout << GridLogMessage << "Tr ( Omega e_{ab=" << a << "} ) = " << realA << std::endl;
|
||||||
|
assert(realA < 1e-8);
|
||||||
|
for (int b=0; b < Sp_TwoIndex<this_nc, S>::Dimension; b++) {
|
||||||
|
Sp_TwoIndex<this_nc, S>::base(b, eij_b);
|
||||||
|
auto d_ab = TensorRemove(trace(eij_a * eij_b));
|
||||||
|
#if verbose
|
||||||
|
std::cout << GridLogMessage << "Tr( e_{ab=" << a << "} e_{cd=" << b << "} ) = " << d_ab << std::endl;
|
||||||
|
#endif
|
||||||
|
std::cout << GridLogMessage << "Checking orthonormality for e_{ab = " << a << "} " << std::endl;
|
||||||
|
if (a==b) {
|
||||||
|
assert(real(d_ab) - realS < 1e-8);
|
||||||
|
} else {
|
||||||
|
assert(real(d_ab) < 1e-8);
|
||||||
|
}
|
||||||
|
assert(imag(d_ab) < 1e-8);
|
||||||
|
assert(imag(d_ab) < 1e-8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int this_nc, TwoIndexSymmetry S>
|
||||||
|
static void run_generators_checks() {
|
||||||
|
const int this_n = this_nc/2;
|
||||||
|
const int this_irrep_dim = Sp_TwoIndex<this_nc, S>::Dimension;
|
||||||
|
const int this_algebra_dim = Sp<this_nc>::AlgebraDimension;
|
||||||
|
typedef typename Sp_TwoIndex<this_nc, S>::template iGroupMatrix<Complex> Matrix;
|
||||||
|
int sum = 0;
|
||||||
|
int sum_im = 0;
|
||||||
|
Vector<Matrix> ta_fund(this_algebra_dim);
|
||||||
|
Vector<Matrix> eij(this_irrep_dim);
|
||||||
|
Matrix tmp_l;
|
||||||
|
Matrix tmp_r;
|
||||||
|
for (int n = 0; n < this_algebra_dim; n++)
|
||||||
|
{
|
||||||
|
Sp<this_nc>::generator(n, ta_fund[n]); // generators in the fundamental
|
||||||
|
}
|
||||||
|
for (int a = 0; a < this_irrep_dim; a++)
|
||||||
|
{
|
||||||
|
Sp_TwoIndex<this_nc, S>::base(a, eij[a]); // base functions e_ij^a for upgrading gauge links from fund to 2-index
|
||||||
|
}
|
||||||
|
for (int gen_id = 0; gen_id < this_algebra_dim; gen_id++)
|
||||||
|
{
|
||||||
|
sum = 0;
|
||||||
|
sum_im = 0;
|
||||||
|
std::cout << GridLogMessage << "generator number " << gen_id << std::endl;
|
||||||
|
for (int a = 0; a < this_irrep_dim; a++)
|
||||||
|
{
|
||||||
|
|
||||||
|
tmp_l = adj(eij[a])*ta_fund[gen_id]*eij[a];
|
||||||
|
tmp_r = adj(eij[a])*eij[a]*transpose(ta_fund[gen_id]);
|
||||||
|
#if verbose
|
||||||
|
std::cout << GridLogMessage << " as_indx = " << a << " eDag T_F e = " << std::endl << tmp_l << std::endl;
|
||||||
|
std::cout << GridLogMessage << " as_indx = " << a << " eDag e T_F^T = " << std::endl << tmp_r << std::endl;
|
||||||
|
#endif
|
||||||
|
//std::cout << GridLogMessage << " as_indx = " << a << " Tr(eDag T_F e + eDag e T_F^T) = " << TensorRemove(trace(tmp_l+tmp_r)) << std::endl;
|
||||||
|
sum += real(TensorRemove(trace(tmp_l+tmp_r)));
|
||||||
|
sum_im += imag(TensorRemove(trace(tmp_l+tmp_r)));
|
||||||
|
}
|
||||||
|
std::cout << GridLogMessage << "re-evaluated trace of the generator " << gen_id << " is " << sum << " " << sum_im << std::endl;
|
||||||
|
assert ( sum < 1e-8) ;
|
||||||
|
assert ( sum_im < 1e-8) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int this_nc, TwoIndexSymmetry S>
|
||||||
|
static void run_base_checks() {
|
||||||
|
std::cout << GridLogMessage << " ****** " << std::endl;
|
||||||
|
std::cout << GridLogMessage << "Running checks for Nc = " << this_nc << " TwoIndex Symmetry = " << S << std::endl;
|
||||||
|
run_symmetry_checks<this_nc, S>();
|
||||||
|
run_traces_checks<this_nc, S>();
|
||||||
|
run_generators_checks<this_nc, S>();
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char** argv) {
|
||||||
|
check_dimensions<2>();
|
||||||
|
check_dimensions<4>();
|
||||||
|
check_dimensions<6>();
|
||||||
|
check_dimensions<8>();
|
||||||
|
|
||||||
|
run_base_checks<2, Symmetric>(); // For Nc=2 the AS is the singlet
|
||||||
|
run_base_checks<4, Symmetric>();
|
||||||
|
run_base_checks<4, AntiSymmetric>();
|
||||||
|
run_base_checks<6, Symmetric>();
|
||||||
|
run_base_checks<6, AntiSymmetric>();
|
||||||
|
run_base_checks<8, Symmetric>();
|
||||||
|
run_base_checks<8, AntiSymmetric>();
|
||||||
|
}
|
110
tests/sp2n/Test_Sp_start.cc
Normal file
110
tests/sp2n/Test_Sp_start.cc
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
#include <Grid/Grid.h>
|
||||||
|
|
||||||
|
using namespace Grid;
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool has_correct_group_block_structure(const T& U) {
|
||||||
|
std::cout << GridLogMessage << "Checking the structure is " << std::endl;
|
||||||
|
std::cout << GridLogMessage << "U = ( W X ) " << std::endl;
|
||||||
|
std::cout << GridLogMessage << " ( -X^* W^* ) " << std::endl;
|
||||||
|
std::cout << GridLogMessage << std::endl;
|
||||||
|
|
||||||
|
const int nsp = Nc / 2;
|
||||||
|
Complex i(0., 1.);
|
||||||
|
for (int c1 = 0; c1 < nsp; c1++) // check on W
|
||||||
|
{
|
||||||
|
for (int c2 = 0; c2 < nsp; c2++) {
|
||||||
|
auto W = PeekIndex<ColourIndex>(U, c1, c2);
|
||||||
|
auto Wstar = PeekIndex<ColourIndex>(U, c1 + nsp, c2 + nsp);
|
||||||
|
auto Ww = conjugate(Wstar);
|
||||||
|
auto amizero = sum(W - Ww);
|
||||||
|
auto amizeroo = TensorRemove(amizero);
|
||||||
|
assert(amizeroo.real() < 10e-6);
|
||||||
|
amizeroo *= i;
|
||||||
|
assert(amizeroo.real() < 10e-6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int c1 = 0; c1 < nsp; c1++) {
|
||||||
|
for (int c2 = 0; c2 < nsp; c2++) {
|
||||||
|
auto X = PeekIndex<ColourIndex>(U, c1, c2 + nsp);
|
||||||
|
auto minusXstar = PeekIndex<ColourIndex>(U, c1 + nsp, c2);
|
||||||
|
auto minusXx = conjugate(minusXstar);
|
||||||
|
auto amizero = sum(X + minusXx);
|
||||||
|
auto amizeroo = TensorRemove(amizero);
|
||||||
|
assert(amizeroo.real() < 10e-6);
|
||||||
|
amizeroo *= i;
|
||||||
|
assert(amizeroo.real() < 10e-6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool is_element_of_sp2n_group(const T& U) {
|
||||||
|
LatticeColourMatrixD aux(U.Grid());
|
||||||
|
LatticeColourMatrixD identity(U.Grid());
|
||||||
|
identity = 1.0;
|
||||||
|
LatticeColourMatrixD Omega(U.Grid());
|
||||||
|
Sp<Nc>::Omega(Omega);
|
||||||
|
|
||||||
|
std::cout << GridLogMessage << "Check matrix is non-zero " << std::endl;
|
||||||
|
assert(norm2(U) > 1e-8);
|
||||||
|
|
||||||
|
std::cout << GridLogMessage << "Unitary check" << std::endl;
|
||||||
|
aux = U * adj(U) - identity;
|
||||||
|
std::cout << GridLogMessage << "U adjU - 1 = " << norm2(aux) << std::endl;
|
||||||
|
assert(norm2(aux) < 1e-8);
|
||||||
|
|
||||||
|
aux = Omega - (U * Omega * transpose(U));
|
||||||
|
std::cout << GridLogMessage << "Omega - U Omega transpose(U) = " << norm2(aux)
|
||||||
|
<< std::endl;
|
||||||
|
assert(norm2(aux) < 1e-8);
|
||||||
|
|
||||||
|
std::cout << GridLogMessage
|
||||||
|
<< "|Det| = " << norm2(Determinant(U)) / U.Grid()->gSites()
|
||||||
|
<< std::endl;
|
||||||
|
assert(norm2(Determinant(U)) / U.Grid()->gSites() - 1 < 1e-8);
|
||||||
|
|
||||||
|
return has_correct_group_block_structure(U);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main (int argc, char **argv)
|
||||||
|
{
|
||||||
|
Grid_init(&argc,&argv);
|
||||||
|
|
||||||
|
Coordinate latt_size = GridDefaultLatt();
|
||||||
|
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
||||||
|
Coordinate mpi_layout = GridDefaultMpi();
|
||||||
|
|
||||||
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
|
GridRedBlackCartesian RBGrid(&Grid);
|
||||||
|
|
||||||
|
LatticeGaugeField Umu(&Grid);
|
||||||
|
LatticeColourMatrixD U(&Grid);
|
||||||
|
|
||||||
|
std::vector<int> pseeds({1,2,3,4,5});
|
||||||
|
std::vector<int> sseeds({6,7,8,9,10});
|
||||||
|
GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(pseeds);
|
||||||
|
GridSerialRNG sRNG; sRNG.SeedFixedIntegers(sseeds);
|
||||||
|
|
||||||
|
std::cout << GridLogMessage << "Checking Cold Configuration " << std::endl;
|
||||||
|
Sp<Nc>::ColdConfiguration(pRNG,Umu);
|
||||||
|
U = PeekIndex<LorentzIndex>(Umu,1);
|
||||||
|
assert(is_element_of_sp2n_group(U));
|
||||||
|
|
||||||
|
std::cout << GridLogMessage << "Checking Hot Configuration" << std::endl;
|
||||||
|
Sp<Nc>::HotConfiguration(pRNG,Umu);
|
||||||
|
U = PeekIndex<LorentzIndex>(Umu,1);
|
||||||
|
assert(is_element_of_sp2n_group(U));
|
||||||
|
|
||||||
|
std::cout << GridLogMessage << "Checking Tepid Configuration" << std::endl;
|
||||||
|
Sp<Nc>::TepidConfiguration(pRNG,Umu);
|
||||||
|
U = PeekIndex<LorentzIndex>(Umu,1);
|
||||||
|
assert(is_element_of_sp2n_group(U));
|
||||||
|
|
||||||
|
Grid_finalize();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
97
tests/sp2n/Test_hmc_Sp_WF_2_Fund_3_2AS.cc
Normal file
97
tests/sp2n/Test_hmc_Sp_WF_2_Fund_3_2AS.cc
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
#include <Grid/Grid.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
using namespace Grid;
|
||||||
|
|
||||||
|
typedef Representations< SpFundamentalRepresentation, SpTwoIndexAntiSymmetricRepresentation > TheRepresentations;
|
||||||
|
|
||||||
|
Grid_init(&argc, &argv);
|
||||||
|
|
||||||
|
typedef GenericSpHMCRunnerHirep<TheRepresentations, MinimumNorm2> HMCWrapper;
|
||||||
|
|
||||||
|
typedef SpWilsonTwoIndexAntiSymmetricImplR TwoIndexFermionImplPolicy;
|
||||||
|
typedef SpWilsonTwoIndexAntiSymmetricFermionD TwoIndexFermionAction;
|
||||||
|
typedef typename TwoIndexFermionAction::FermionField TwoIndexFermionField;
|
||||||
|
|
||||||
|
typedef SpWilsonImplR FundFermionImplPolicy; // ok
|
||||||
|
typedef SpWilsonFermionD FundFermionAction; // ok
|
||||||
|
typedef typename FundFermionAction::FermionField FundFermionField;
|
||||||
|
|
||||||
|
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||||
|
|
||||||
|
HMCWrapper TheHMC;
|
||||||
|
|
||||||
|
TheHMC.Resources.AddFourDimGrid("gauge");
|
||||||
|
|
||||||
|
// Checkpointer definition
|
||||||
|
CheckpointerParameters CPparams;
|
||||||
|
CPparams.config_prefix = "ckpoint_lat";
|
||||||
|
CPparams.rng_prefix = "ckpoint_rng";
|
||||||
|
CPparams.saveInterval = 5;
|
||||||
|
CPparams.format = "IEEE64BIG";
|
||||||
|
|
||||||
|
TheHMC.Resources.LoadNerscCheckpointer(CPparams);
|
||||||
|
|
||||||
|
RNGModuleParameters RNGpar;
|
||||||
|
RNGpar.serial_seeds = "1 2 3 4 5";
|
||||||
|
RNGpar.parallel_seeds = "6 7 8 9 10";
|
||||||
|
TheHMC.Resources.SetRNGSeeds(RNGpar);
|
||||||
|
|
||||||
|
// Construct observables
|
||||||
|
typedef PlaquetteMod<HMCWrapper::ImplPolicy> PlaqObs;
|
||||||
|
TheHMC.Resources.AddObservable<PlaqObs>();
|
||||||
|
|
||||||
|
typedef PolyakovMod<HMCWrapper::ImplPolicy> PolyakovObs;
|
||||||
|
TheHMC.Resources.AddObservable<PolyakovObs>();
|
||||||
|
|
||||||
|
RealD beta = 6 ;
|
||||||
|
|
||||||
|
SpWilsonGaugeActionR Waction(beta);
|
||||||
|
|
||||||
|
auto GridPtr = TheHMC.Resources.GetCartesian();
|
||||||
|
auto GridRBPtr = TheHMC.Resources.GetRBCartesian();
|
||||||
|
|
||||||
|
SpFundamentalRepresentation::LatticeField fundU(GridPtr);
|
||||||
|
SpTwoIndexAntiSymmetricRepresentation::LatticeField asU(GridPtr);
|
||||||
|
//LatticeGaugeField U(GridPtr);
|
||||||
|
|
||||||
|
RealD Fundmass = -0.71;
|
||||||
|
RealD ASmass = -0.71;
|
||||||
|
std::vector<Complex> boundary = {-1,-1,-1,-1};
|
||||||
|
|
||||||
|
FundFermionAction::ImplParams bc(boundary);
|
||||||
|
TwoIndexFermionAction::ImplParams bbc(boundary);
|
||||||
|
|
||||||
|
FundFermionAction FundFermOp(fundU, *GridPtr, *GridRBPtr, Fundmass, bbc);
|
||||||
|
TwoIndexFermionAction TwoIndexFermOp(asU, *GridPtr, *GridRBPtr, ASmass, bbc);
|
||||||
|
ConjugateGradient<FundFermionField> fCG(1.0e-8, 2000, false);
|
||||||
|
ConjugateGradient<TwoIndexFermionField> asCG(1.0e-8, 2000, false);
|
||||||
|
OneFlavourRationalParams Params(1.0e-6, 64.0, 2000, 1.0e-6, 16);
|
||||||
|
|
||||||
|
TwoFlavourPseudoFermionAction<FundFermionImplPolicy> fundNf2(FundFermOp, fCG, fCG);
|
||||||
|
TwoFlavourPseudoFermionAction<TwoIndexFermionImplPolicy> asNf2(TwoIndexFermOp, asCG, asCG);
|
||||||
|
OneFlavourRationalPseudoFermionAction<TwoIndexFermionImplPolicy> asNf1(TwoIndexFermOp,Params);
|
||||||
|
|
||||||
|
fundNf2.is_smeared = false;
|
||||||
|
asNf2.is_smeared = false;
|
||||||
|
asNf1.is_smeared = false;
|
||||||
|
|
||||||
|
ActionLevel<HMCWrapper::Field, TheRepresentations > Level1(1);
|
||||||
|
Level1.push_back(&fundNf2);
|
||||||
|
Level1.push_back(&asNf2);
|
||||||
|
Level1.push_back(&asNf1);
|
||||||
|
|
||||||
|
ActionLevel<HMCWrapper::Field, TheRepresentations > Level2(4);
|
||||||
|
Level2.push_back(&Waction);
|
||||||
|
|
||||||
|
TheHMC.TheAction.push_back(Level1);
|
||||||
|
TheHMC.TheAction.push_back(Level2);
|
||||||
|
|
||||||
|
TheHMC.Parameters.MD.MDsteps = 28;
|
||||||
|
TheHMC.Parameters.MD.trajL = 1.0;
|
||||||
|
|
||||||
|
TheHMC.ReadCommandLine(argc, argv);
|
||||||
|
TheHMC.Run();
|
||||||
|
|
||||||
|
Grid_finalize();
|
||||||
|
}
|
81
tests/sp2n/Test_hmc_Sp_Wilson2ASFermionGauge.cc
Normal file
81
tests/sp2n/Test_hmc_Sp_Wilson2ASFermionGauge.cc
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
#include <Grid/Grid.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
using namespace Grid;
|
||||||
|
|
||||||
|
typedef Representations<SpFundamentalRepresentation,
|
||||||
|
SpTwoIndexAntiSymmetricRepresentation>
|
||||||
|
TheRepresentations;
|
||||||
|
|
||||||
|
Grid_init(&argc, &argv);
|
||||||
|
|
||||||
|
typedef GenericSpHMCRunnerHirep<TheRepresentations, MinimumNorm2>
|
||||||
|
HMCWrapper;
|
||||||
|
typedef SpWilsonTwoIndexAntiSymmetricImplR FermionImplPolicy;
|
||||||
|
typedef SpWilsonTwoIndexAntiSymmetricFermionD FermionAction;
|
||||||
|
typedef typename FermionAction::FermionField FermionField;
|
||||||
|
|
||||||
|
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||||
|
|
||||||
|
HMCWrapper TheHMC;
|
||||||
|
|
||||||
|
TheHMC.Resources.AddFourDimGrid("gauge");
|
||||||
|
|
||||||
|
// Checkpointer definition
|
||||||
|
CheckpointerParameters CPparams;
|
||||||
|
CPparams.config_prefix = "ckpoint_lat";
|
||||||
|
CPparams.rng_prefix = "ckpoint_rng";
|
||||||
|
CPparams.saveInterval = 100;
|
||||||
|
CPparams.format = "IEEE64BIG";
|
||||||
|
|
||||||
|
TheHMC.Resources.LoadNerscCheckpointer(CPparams);
|
||||||
|
|
||||||
|
RNGModuleParameters RNGpar;
|
||||||
|
RNGpar.serial_seeds = "1 2 3 4 5";
|
||||||
|
RNGpar.parallel_seeds = "6 7 8 9 10";
|
||||||
|
TheHMC.Resources.SetRNGSeeds(RNGpar);
|
||||||
|
|
||||||
|
// Construct observables
|
||||||
|
typedef PlaquetteMod<HMCWrapper::ImplPolicy> PlaqObs;
|
||||||
|
TheHMC.Resources.AddObservable<PlaqObs>();
|
||||||
|
|
||||||
|
RealD beta = 6.7;
|
||||||
|
|
||||||
|
SpWilsonGaugeActionR Waction(beta);
|
||||||
|
|
||||||
|
auto GridPtr = TheHMC.Resources.GetCartesian();
|
||||||
|
auto GridRBPtr = TheHMC.Resources.GetRBCartesian();
|
||||||
|
|
||||||
|
SpTwoIndexAntiSymmetricRepresentation::LatticeField U(GridPtr);
|
||||||
|
// LatticeGaugeField U(GridPtr);
|
||||||
|
|
||||||
|
RealD mass = -0.115;
|
||||||
|
|
||||||
|
std::vector<Complex> boundary = {-1, -1, -1, -1};
|
||||||
|
FermionAction::ImplParams bc(boundary);
|
||||||
|
FermionAction FermOp(U, *GridPtr, *GridRBPtr, mass, bc);
|
||||||
|
|
||||||
|
ConjugateGradient<FermionField> CG(1.0e-8, 2000, false);
|
||||||
|
|
||||||
|
TwoFlavourPseudoFermionAction<FermionImplPolicy> Nf2(FermOp, CG, CG);
|
||||||
|
|
||||||
|
Nf2.is_smeared = false;
|
||||||
|
std::cout << GridLogMessage << "mass " << mass << std::endl;
|
||||||
|
|
||||||
|
ActionLevel<HMCWrapper::Field, TheRepresentations> Level1(1);
|
||||||
|
Level1.push_back(&Nf2);
|
||||||
|
|
||||||
|
ActionLevel<HMCWrapper::Field, TheRepresentations> Level2(4);
|
||||||
|
Level2.push_back(&Waction);
|
||||||
|
|
||||||
|
TheHMC.TheAction.push_back(Level1);
|
||||||
|
TheHMC.TheAction.push_back(Level2);
|
||||||
|
|
||||||
|
TheHMC.Parameters.MD.MDsteps = 16;
|
||||||
|
TheHMC.Parameters.MD.trajL = 1.0;
|
||||||
|
|
||||||
|
TheHMC.ReadCommandLine(argc, argv);
|
||||||
|
TheHMC.Run();
|
||||||
|
|
||||||
|
Grid_finalize();
|
||||||
|
}
|
74
tests/sp2n/Test_hmc_Sp_WilsonFundFermionGauge.cc
Normal file
74
tests/sp2n/Test_hmc_Sp_WilsonFundFermionGauge.cc
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
#include <Grid/Grid.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
using namespace Grid;
|
||||||
|
|
||||||
|
typedef Representations< SpFundamentalRepresentation > TheRepresentations;
|
||||||
|
|
||||||
|
Grid_init(&argc, &argv);
|
||||||
|
|
||||||
|
typedef GenericSpHMCRunnerHirep<TheRepresentations, MinimumNorm2> HMCWrapper; // ok
|
||||||
|
typedef SpWilsonImplR FermionImplPolicy; // ok
|
||||||
|
typedef SpWilsonFermionD FermionAction; // ok
|
||||||
|
typedef typename FermionAction::FermionField FermionField; // ok?
|
||||||
|
|
||||||
|
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||||
|
|
||||||
|
HMCWrapper TheHMC;
|
||||||
|
|
||||||
|
TheHMC.Resources.AddFourDimGrid("gauge");
|
||||||
|
|
||||||
|
// Checkpointer definition
|
||||||
|
CheckpointerParameters CPparams;
|
||||||
|
CPparams.config_prefix = "ckpoint_lat";
|
||||||
|
CPparams.rng_prefix = "ckpoint_rng";
|
||||||
|
CPparams.saveInterval = 100;
|
||||||
|
CPparams.format = "IEEE64BIG";
|
||||||
|
|
||||||
|
TheHMC.Resources.LoadNerscCheckpointer(CPparams);
|
||||||
|
|
||||||
|
RNGModuleParameters RNGpar;
|
||||||
|
RNGpar.serial_seeds = "1 2 3 4 5";
|
||||||
|
RNGpar.parallel_seeds = "6 7 8 9 10";
|
||||||
|
TheHMC.Resources.SetRNGSeeds(RNGpar);
|
||||||
|
|
||||||
|
// Construct observables
|
||||||
|
typedef PlaquetteMod<HMCWrapper::ImplPolicy> PlaqObs;
|
||||||
|
TheHMC.Resources.AddObservable<PlaqObs>();
|
||||||
|
|
||||||
|
RealD beta = 7.2 ;
|
||||||
|
|
||||||
|
SpWilsonGaugeActionR Waction(beta);
|
||||||
|
|
||||||
|
auto GridPtr = TheHMC.Resources.GetCartesian();
|
||||||
|
auto GridRBPtr = TheHMC.Resources.GetRBCartesian();
|
||||||
|
|
||||||
|
SpFundamentalRepresentation::LatticeField U(GridPtr);
|
||||||
|
|
||||||
|
RealD mass = -0.76;
|
||||||
|
|
||||||
|
FermionAction FermOp(U, *GridPtr, *GridRBPtr, mass);
|
||||||
|
|
||||||
|
ConjugateGradient<FermionField> CG(1.0e-8, 2000, false);
|
||||||
|
|
||||||
|
TwoFlavourPseudoFermionAction<FermionImplPolicy> Nf2(FermOp, CG, CG);
|
||||||
|
|
||||||
|
Nf2.is_smeared = false;
|
||||||
|
|
||||||
|
ActionLevel<HMCWrapper::Field, TheRepresentations > Level1(1);
|
||||||
|
Level1.push_back(&Nf2);
|
||||||
|
|
||||||
|
ActionLevel<HMCWrapper::Field, TheRepresentations > Level2(4);
|
||||||
|
Level2.push_back(&Waction);
|
||||||
|
|
||||||
|
TheHMC.TheAction.push_back(Level1);
|
||||||
|
TheHMC.TheAction.push_back(Level2);
|
||||||
|
|
||||||
|
TheHMC.Parameters.MD.MDsteps = 36;
|
||||||
|
TheHMC.Parameters.MD.trajL = 1.0;
|
||||||
|
|
||||||
|
TheHMC.ReadCommandLine(argc, argv);
|
||||||
|
TheHMC.Run();
|
||||||
|
|
||||||
|
Grid_finalize();
|
||||||
|
}
|
99
tests/sp2n/Test_hmc_Sp_pureGaugeWilson.cc
Normal file
99
tests/sp2n/Test_hmc_Sp_pureGaugeWilson.cc
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
/*************************************************************************************
|
||||||
|
|
||||||
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
|
Source file: ./tests/Test_hmc_WilsonFermionGauge.cc
|
||||||
|
|
||||||
|
Copyright (C) 2015
|
||||||
|
|
||||||
|
Author: Peter Boyle <pabobyle@ph.ed.ac.uk>
|
||||||
|
Author: neo <cossu@post.kek.jp>
|
||||||
|
Author: Guido Cossu <guido.cossu@ed.ac.uk>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
See the full license in the file "LICENSE" in the top level distribution
|
||||||
|
directory
|
||||||
|
*************************************************************************************/
|
||||||
|
/* END LEGAL */
|
||||||
|
#include <Grid/Grid.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
using namespace Grid;
|
||||||
|
|
||||||
|
Grid_init(&argc, &argv);
|
||||||
|
GridLogLayout();
|
||||||
|
|
||||||
|
typedef GenericSpHMCRunner<MinimumNorm2> HMCWrapper;
|
||||||
|
HMCWrapper TheHMC;
|
||||||
|
|
||||||
|
TheHMC.Resources.AddFourDimGrid("gauge");
|
||||||
|
|
||||||
|
// Checkpointer definition
|
||||||
|
CheckpointerParameters CPparams;
|
||||||
|
CPparams.config_prefix = "ckpoint_lat";
|
||||||
|
CPparams.rng_prefix = "ckpoint_rng";
|
||||||
|
CPparams.saveInterval = 5;
|
||||||
|
CPparams.format = "IEEE64BIG";
|
||||||
|
|
||||||
|
TheHMC.Resources.LoadNerscCheckpointer(CPparams);
|
||||||
|
|
||||||
|
RNGModuleParameters RNGpar;
|
||||||
|
RNGpar.serial_seeds = "12 22 32 42 52";
|
||||||
|
RNGpar.parallel_seeds = "76 77 87 79 70";
|
||||||
|
TheHMC.Resources.SetRNGSeeds(RNGpar);
|
||||||
|
|
||||||
|
// Construct observables
|
||||||
|
// here there is too much indirection
|
||||||
|
typedef PlaquetteMod<HMCWrapper::ImplPolicy> PlaqObs;
|
||||||
|
typedef TopologicalChargeMod<HMCWrapper::ImplPolicy> QObs;
|
||||||
|
TheHMC.Resources.AddObservable<PlaqObs>();
|
||||||
|
TopologyObsParameters TopParams;
|
||||||
|
TopParams.interval = 5;
|
||||||
|
TopParams.do_smearing = true;
|
||||||
|
TopParams.Smearing.init_step_size = 0.01;
|
||||||
|
TopParams.Smearing.tolerance = 1e-5;
|
||||||
|
//TopParams.Smearing.steps = 200;
|
||||||
|
//TopParams.Smearing.step_size = 0.01;
|
||||||
|
TopParams.Smearing.meas_interval = 50;
|
||||||
|
TopParams.Smearing.maxTau = 2.0;
|
||||||
|
TheHMC.Resources.AddObservable<QObs>(TopParams);
|
||||||
|
//////////////////////////////////////////////
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////
|
||||||
|
// Collect actions, here use more encapsulation
|
||||||
|
// need wrappers of the fermionic classes
|
||||||
|
// that have a complex construction
|
||||||
|
// standard
|
||||||
|
RealD beta = 8.0 ;
|
||||||
|
SpWilsonGaugeActionR Waction(beta);
|
||||||
|
|
||||||
|
ActionLevel<HMCWrapper::Field> Level1(1);
|
||||||
|
Level1.push_back(&Waction);
|
||||||
|
//Level1.push_back(WGMod.getPtr());
|
||||||
|
TheHMC.TheAction.push_back(Level1);
|
||||||
|
/////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// HMC parameters are serialisable
|
||||||
|
TheHMC.Parameters.MD.MDsteps = 10;
|
||||||
|
TheHMC.Parameters.MD.trajL = 1.0;
|
||||||
|
|
||||||
|
TheHMC.ReadCommandLine(argc, argv); // these can be parameters from file
|
||||||
|
TheHMC.Run(); // no smearing
|
||||||
|
|
||||||
|
Grid_finalize();
|
||||||
|
|
||||||
|
} // main
|
240
tests/sp2n/Test_project_on_Sp.cc
Normal file
240
tests/sp2n/Test_project_on_Sp.cc
Normal file
@ -0,0 +1,240 @@
|
|||||||
|
#include <Grid/Grid.h>
|
||||||
|
|
||||||
|
using namespace Grid;
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool has_correct_group_block_structure(const T& U) {
|
||||||
|
std::cout << GridLogMessage << "Checking the structure is " << std::endl;
|
||||||
|
std::cout << GridLogMessage << "U = ( W X ) " << std::endl;
|
||||||
|
std::cout << GridLogMessage << " ( -X^* W^* ) " << std::endl;
|
||||||
|
std::cout << GridLogMessage << std::endl;
|
||||||
|
|
||||||
|
const int nsp = Nc / 2;
|
||||||
|
Complex i(0., 1.);
|
||||||
|
for (int c1 = 0; c1 < nsp; c1++) // check on W
|
||||||
|
{
|
||||||
|
for (int c2 = 0; c2 < nsp; c2++) {
|
||||||
|
auto W = PeekIndex<ColourIndex>(U, c1, c2);
|
||||||
|
auto Wstar = PeekIndex<ColourIndex>(U, c1 + nsp, c2 + nsp);
|
||||||
|
auto Ww = conjugate(Wstar);
|
||||||
|
auto amizero = sum(W - Ww);
|
||||||
|
auto amizeroo = TensorRemove(amizero);
|
||||||
|
assert(amizeroo.real() < 10e-6);
|
||||||
|
amizeroo *= i;
|
||||||
|
assert(amizeroo.real() < 10e-6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int c1 = 0; c1 < nsp; c1++) {
|
||||||
|
for (int c2 = 0; c2 < nsp; c2++) {
|
||||||
|
auto X = PeekIndex<ColourIndex>(U, c1, c2 + nsp);
|
||||||
|
auto minusXstar = PeekIndex<ColourIndex>(U, c1 + nsp, c2);
|
||||||
|
auto minusXx = conjugate(minusXstar);
|
||||||
|
auto amizero = sum(X + minusXx);
|
||||||
|
auto amizeroo = TensorRemove(amizero);
|
||||||
|
assert(amizeroo.real() < 10e-6);
|
||||||
|
amizeroo *= i;
|
||||||
|
assert(amizeroo.real() < 10e-6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool is_element_of_sp2n_group(const T& U) {
|
||||||
|
LatticeColourMatrixD aux(U.Grid());
|
||||||
|
LatticeColourMatrixD identity(U.Grid());
|
||||||
|
identity = 1.0;
|
||||||
|
LatticeColourMatrixD Omega(U.Grid());
|
||||||
|
Sp<Nc>::Omega(Omega);
|
||||||
|
|
||||||
|
std::cout << GridLogMessage << "Check matrix is non-zero " << std::endl;
|
||||||
|
assert(norm2(U) > 1e-8);
|
||||||
|
|
||||||
|
std::cout << GridLogMessage << "Unitary check" << std::endl;
|
||||||
|
aux = U * adj(U) - identity;
|
||||||
|
std::cout << GridLogMessage << "U adjU - 1 = " << norm2(aux) << std::endl;
|
||||||
|
assert(norm2(aux) < 1e-8);
|
||||||
|
|
||||||
|
aux = Omega - (U * Omega * transpose(U));
|
||||||
|
std::cout << GridLogMessage << "Omega - U Omega transpose(U) = " << norm2(aux)
|
||||||
|
<< std::endl;
|
||||||
|
assert(norm2(aux) < 1e-8);
|
||||||
|
|
||||||
|
std::cout << GridLogMessage
|
||||||
|
<< "|Det| = " << norm2(Determinant(U)) / U.Grid()->gSites()
|
||||||
|
<< std::endl;
|
||||||
|
assert(norm2(Determinant(U)) / U.Grid()->gSites() - 1 < 1e-8);
|
||||||
|
|
||||||
|
return has_correct_group_block_structure(U);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void test_group_projections(T U) {
|
||||||
|
RealD Delta = 666.;
|
||||||
|
LatticeColourMatrixD identity(U.Grid());
|
||||||
|
identity = 1.0;
|
||||||
|
|
||||||
|
std::cout << GridLogMessage << "# # # #" << std::endl;
|
||||||
|
std::cout << GridLogMessage << "Group" << std::endl;
|
||||||
|
std::cout << GridLogMessage << "# # # #" << std::endl;
|
||||||
|
std::cout << GridLogMessage << std::endl;
|
||||||
|
|
||||||
|
std::string name = "ProjectOnSpGroup";
|
||||||
|
std::cout << GridLogMessage << "Testing " << name << std::endl;
|
||||||
|
std::cout << GridLogMessage << "Apply to deformed matrix" << std::endl;
|
||||||
|
|
||||||
|
U = U + Delta * identity;
|
||||||
|
U = ProjectOnSpGroup(U);
|
||||||
|
assert(is_element_of_sp2n_group(U));
|
||||||
|
|
||||||
|
name = "ProjectOnGeneralGroup";
|
||||||
|
std::cout << GridLogMessage << "Testing " << name << std::endl;
|
||||||
|
std::cout << GridLogMessage << "Apply to deformed matrix" << std::endl;
|
||||||
|
|
||||||
|
U = U + Delta * identity;
|
||||||
|
U = Sp<Nc>::ProjectOnGeneralGroup(U);
|
||||||
|
assert(is_element_of_sp2n_group(U));
|
||||||
|
|
||||||
|
name = "ProjectOnSpecialGroup";
|
||||||
|
std::cout << GridLogMessage << "Testing " << name << std::endl;
|
||||||
|
std::cout << GridLogMessage << "Apply to deformed matrix" << std::endl;
|
||||||
|
|
||||||
|
U = U + Delta * identity;
|
||||||
|
Sp<Nc>::ProjectOnSpecialGroup(U);
|
||||||
|
assert(is_element_of_sp2n_group(U));
|
||||||
|
|
||||||
|
name = "ProjectSpn";
|
||||||
|
std::cout << GridLogMessage << "Testing " << name << std::endl;
|
||||||
|
std::cout << GridLogMessage << "Apply to deformed matrix" << std::endl;
|
||||||
|
|
||||||
|
U = U + Delta * identity;
|
||||||
|
ProjectSpn(U);
|
||||||
|
assert(is_element_of_sp2n_group(U));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool has_correct_algebra_block_structure(const T& U) {
|
||||||
|
// this only checks for the anti-hermitian part of the algebra
|
||||||
|
const int nsp = Nc / 2;
|
||||||
|
Complex i(0., 1.);
|
||||||
|
std::cout << GridLogMessage << "Checking the structure is " << std::endl;
|
||||||
|
std::cout << GridLogMessage << "U = ( W X ) " << std::endl;
|
||||||
|
std::cout << GridLogMessage << " ( -X^* W^* ) " << std::endl;
|
||||||
|
for (int c1 = 0; c1 < nsp; c1++) // check on W
|
||||||
|
{
|
||||||
|
for (int c2 = 0; c2 < nsp; c2++) {
|
||||||
|
auto W = PeekIndex<ColourIndex>(U, c1, c2);
|
||||||
|
auto Wstar = PeekIndex<ColourIndex>(U, c1 + nsp, c2 + nsp);
|
||||||
|
auto Ww = conjugate(Wstar);
|
||||||
|
auto amizero = sum(W - Ww);
|
||||||
|
auto amizeroo = TensorRemove(amizero);
|
||||||
|
assert(amizeroo.real() < 10e-6);
|
||||||
|
amizeroo *= i;
|
||||||
|
assert(amizeroo.real() < 10e-6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int c1 = 0; c1 < nsp; c1++) {
|
||||||
|
for (int c2 = 0; c2 < nsp; c2++) {
|
||||||
|
auto X = PeekIndex<ColourIndex>(U, c1, c2 + nsp);
|
||||||
|
auto minusXstar = PeekIndex<ColourIndex>(U, c1 + nsp, c2);
|
||||||
|
auto minusXx = conjugate(minusXstar);
|
||||||
|
auto amizero = sum(X + minusXx);
|
||||||
|
auto amizeroo = TensorRemove(amizero);
|
||||||
|
assert(amizeroo.real() < 10e-6);
|
||||||
|
amizeroo *= i;
|
||||||
|
assert(amizeroo.real() < 10e-6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool is_element_of_sp2n_algebra(const T& U) {
|
||||||
|
LatticeColourMatrixD aux(U.Grid());
|
||||||
|
LatticeColourMatrixD identity(U.Grid());
|
||||||
|
identity = 1.0;
|
||||||
|
LatticeColourMatrixD Omega(U.Grid());
|
||||||
|
Sp<Nc>::Omega(Omega);
|
||||||
|
|
||||||
|
std::cout << GridLogMessage << "Check matrix is non-zero " << std::endl;
|
||||||
|
assert(norm2(U) > 1e-8);
|
||||||
|
|
||||||
|
aux = U - adj(U);
|
||||||
|
std::cout << GridLogMessage << "T - Tda = " << norm2(aux)
|
||||||
|
<< " (not supposed to vanish)" << std::endl;
|
||||||
|
|
||||||
|
aux = U + adj(U);
|
||||||
|
std::cout << GridLogMessage << "T + Tda = " << norm2(aux)
|
||||||
|
<< " (supposed to vanish)" << std::endl;
|
||||||
|
assert(norm2(aux) - 1 < 1e-8);
|
||||||
|
|
||||||
|
std::cout << GridLogMessage << "Check that Omega T Omega + conj(T) = 0 "
|
||||||
|
<< std::endl;
|
||||||
|
aux = Omega * U * Omega + conjugate(U);
|
||||||
|
assert(norm2(aux) < 1e-8);
|
||||||
|
|
||||||
|
return has_correct_algebra_block_structure(U);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void test_algebra_projections(T U) {
|
||||||
|
RealD Delta = 666.;
|
||||||
|
LatticeColourMatrixD tmp(U.Grid());
|
||||||
|
LatticeColourMatrixD identity(U.Grid());
|
||||||
|
identity = 1.0;
|
||||||
|
|
||||||
|
std::cout << GridLogMessage << "# # # #" << std::endl;
|
||||||
|
std::cout << GridLogMessage << "Algebra" << std::endl;
|
||||||
|
std::cout << GridLogMessage << "# # # #" << std::endl;
|
||||||
|
std::cout << GridLogMessage << std::endl;
|
||||||
|
|
||||||
|
std::string name = "SpTa";
|
||||||
|
std::cout << GridLogMessage << "Testing " << name << std::endl;
|
||||||
|
std::cout << GridLogMessage << "Apply to deformed matrix" << std::endl;
|
||||||
|
|
||||||
|
U = U + Delta * identity;
|
||||||
|
U = SpTa(U);
|
||||||
|
assert(is_element_of_sp2n_algebra(U));
|
||||||
|
|
||||||
|
name = "TaProj";
|
||||||
|
std::cout << GridLogMessage << "Testing " << name << std::endl;
|
||||||
|
std::cout << GridLogMessage << "Apply to deformed matrix" << std::endl;
|
||||||
|
|
||||||
|
U = U + Delta * identity;
|
||||||
|
Sp<Nc>::taProj(U, tmp);
|
||||||
|
U = tmp;
|
||||||
|
assert(is_element_of_sp2n_algebra(U));
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char** argv) {
|
||||||
|
Grid_init(&argc, &argv);
|
||||||
|
|
||||||
|
Coordinate latt_size = GridDefaultLatt();
|
||||||
|
Coordinate simd_layout = GridDefaultSimd(Nd, vComplex::Nsimd());
|
||||||
|
Coordinate mpi_layout = GridDefaultMpi();
|
||||||
|
|
||||||
|
GridCartesian Grid(latt_size, simd_layout, mpi_layout);
|
||||||
|
|
||||||
|
LatticeGaugeField Umu(&Grid);
|
||||||
|
LatticeColourMatrixD U(&Grid);
|
||||||
|
|
||||||
|
// Will test resimplectification-related functionalities (from
|
||||||
|
// ProjectOnGeneralGroup, ProjectOnSpGroup, ProjectOnSpecialGroup) and projection on the
|
||||||
|
// algebra (from SpTa)
|
||||||
|
// ProjectOnGeneralGroup, ProjectOnSpGroup project on the non-special group allowi for complex determinants of module 1
|
||||||
|
// ProjectOnSpecialGroup projects on the full gauge group providing a determinant equals to 1
|
||||||
|
|
||||||
|
std::vector<int> pseeds({1, 2, 3, 4, 5});
|
||||||
|
GridParallelRNG pRNG(&Grid);
|
||||||
|
pRNG.SeedFixedIntegers(pseeds);
|
||||||
|
|
||||||
|
SU<Nc>::HotConfiguration(pRNG, Umu);
|
||||||
|
U = PeekIndex<LorentzIndex>(Umu, 0);
|
||||||
|
test_group_projections(U);
|
||||||
|
U = PeekIndex<LorentzIndex>(Umu, 1);
|
||||||
|
test_algebra_projections(U);
|
||||||
|
|
||||||
|
Grid_finalize();
|
||||||
|
}
|
65
tests/sp2n/Test_sp2n_lie_gen.cc
Normal file
65
tests/sp2n/Test_sp2n_lie_gen.cc
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
#include <Grid/Grid.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace Grid;
|
||||||
|
|
||||||
|
template <int ngroup>
|
||||||
|
std::ostream& operator<<(std::ostream& o, Sp<ngroup> g) {
|
||||||
|
return o << "Sp(" << ngroup << ") Fundamental";
|
||||||
|
}
|
||||||
|
|
||||||
|
template <int ngroup, TwoIndexSymmetry S>
|
||||||
|
std::ostream& operator<<(std::ostream& o, Sp_TwoIndex<ngroup, S> g) {
|
||||||
|
return o << "Sp(" << ngroup << ") TwoIndex "
|
||||||
|
<< (S == Symmetric ? "Symmetric" : "AntiSymmetric");
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Group>
|
||||||
|
void run_check_on(bool print_generators = false) {
|
||||||
|
std::cout << GridLogMessage << "*********************************************"
|
||||||
|
<< std::endl;
|
||||||
|
std::cout << GridLogMessage << "* Generators for " << Group() << std::endl;
|
||||||
|
std::cout << GridLogMessage << "*********************************************"
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
|
if (print_generators) {
|
||||||
|
Group::printGenerators();
|
||||||
|
}
|
||||||
|
Group::testGenerators();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <int ngroup>
|
||||||
|
void run_checks() {
|
||||||
|
run_check_on<Sp<ngroup>>();
|
||||||
|
run_check_on<Sp_TwoIndex<ngroup, Symmetric>>();
|
||||||
|
run_check_on<Sp_TwoIndex<ngroup, AntiSymmetric>>();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void run_checks<2>() {
|
||||||
|
// Print generators because they are small enough to be actually helpful.
|
||||||
|
run_check_on<Sp<2>>(true);
|
||||||
|
run_check_on<Sp_TwoIndex<2, Symmetric>>(true);
|
||||||
|
// The AntiSymmetric representation is 0 dimensional. This makes problems in
|
||||||
|
// device code.
|
||||||
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void run_checks<4>() {
|
||||||
|
// Print generators because they are small enough to be actually helpful.
|
||||||
|
run_check_on<Sp<4>>(true);
|
||||||
|
run_check_on<Sp_TwoIndex<4, Symmetric>>(true);
|
||||||
|
run_check_on<Sp_TwoIndex<4, AntiSymmetric>>(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char** argv) {
|
||||||
|
Grid_init(&argc, &argv);
|
||||||
|
|
||||||
|
run_checks<2>();
|
||||||
|
run_checks<4>();
|
||||||
|
run_checks<6>();
|
||||||
|
run_checks<8>();
|
||||||
|
|
||||||
|
Grid_finalize();
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user