mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-11 22:50:45 +01:00
Autoformat google style
This commit is contained in:
parent
1aa28b47ae
commit
9273f2937c
@ -194,8 +194,6 @@ public:
|
||||
ta = ta * nrm;
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Map a su2 subgroup number to the pair of rows that are non zero
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@ -227,7 +225,6 @@ public:
|
||||
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);
|
||||
@ -259,14 +256,12 @@ public:
|
||||
dest = 1.0; // start out with identity
|
||||
autoView(dest_v, dest, AcceleratorWrite);
|
||||
autoView(subgroup_v, subgroup, AcceleratorRead);
|
||||
accelerator_for(ss, grid->oSites(),1,
|
||||
{
|
||||
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);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////
|
||||
@ -279,12 +274,12 @@ public:
|
||||
// in action.
|
||||
//
|
||||
///////////////////////////////////////////////
|
||||
static void SubGroupHeatBath(GridSerialRNG &sRNG, GridParallelRNG &pRNG,
|
||||
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)
|
||||
{
|
||||
int su2_subgroup, int nheatbath, LatticeInteger &wheremask) {
|
||||
GridBase *grid = link.Grid();
|
||||
|
||||
const RealD twopi = 2.0 * M_PI;
|
||||
@ -297,7 +292,8 @@ public:
|
||||
V = link * staple;
|
||||
|
||||
// Subgroup manipulation in the lie algebra space
|
||||
LatticeSU2Matrix u(grid); // Kennedy pendleton "u" real projected normalised Sigma
|
||||
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
|
||||
@ -405,29 +401,24 @@ public:
|
||||
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
|
||||
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;
|
||||
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.
|
||||
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.
|
||||
*/
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
@ -568,8 +559,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void testGenerators(void) {
|
||||
Matrix ta;
|
||||
Matrix tb;
|
||||
@ -610,8 +599,8 @@ public:
|
||||
|
||||
// reunitarise??
|
||||
template <typename LatticeMatrixType>
|
||||
static void LieRandomize(GridParallelRNG &pRNG, LatticeMatrixType &out, double scale = 1.0)
|
||||
{
|
||||
static void LieRandomize(GridParallelRNG &pRNG, LatticeMatrixType &out,
|
||||
double scale = 1.0) {
|
||||
GridBase *grid = out.Grid();
|
||||
|
||||
typedef typename LatticeMatrixType::vector_type vector_type;
|
||||
@ -620,7 +609,8 @@ public:
|
||||
typedef iSinglet<vector_type> vTComplexType;
|
||||
|
||||
typedef Lattice<vTComplexType> LatticeComplexType;
|
||||
typedef typename GridTypeMapper<typename LatticeMatrixType::vector_object>::scalar_object MatrixType;
|
||||
typedef typename GridTypeMapper<
|
||||
typename LatticeMatrixType::vector_object>::scalar_object MatrixType;
|
||||
|
||||
LatticeComplexType ca(grid);
|
||||
LatticeMatrixType lie(grid);
|
||||
@ -642,7 +632,6 @@ public:
|
||||
la = ci * ca * ta;
|
||||
|
||||
lie = lie + la; // e^{i la ta}
|
||||
|
||||
}
|
||||
taExp(lie, out);
|
||||
}
|
||||
@ -700,7 +689,8 @@ public:
|
||||
conformable(grid, g.Grid());
|
||||
|
||||
GaugeMat U(grid);
|
||||
GaugeMat ag(grid); ag = adj(g);
|
||||
GaugeMat ag(grid);
|
||||
ag = adj(g);
|
||||
|
||||
for (int mu = 0; mu < Nd; mu++) {
|
||||
U = PeekIndex<LorentzIndex>(Umu, mu);
|
||||
@ -711,20 +701,23 @@ public:
|
||||
template <typename GaugeMat>
|
||||
static void GaugeTransform(std::vector<GaugeMat> &U, GaugeMat &g) {
|
||||
GridBase *grid = g.Grid();
|
||||
GaugeMat ag(grid); ag = adj(g);
|
||||
GaugeMat ag(grid);
|
||||
ag = adj(g);
|
||||
for (int mu = 0; mu < Nd; mu++) {
|
||||
U[mu] = g * U[mu] * Cshift(ag, mu, 1);
|
||||
}
|
||||
}
|
||||
template <typename GaugeField, typename GaugeMat>
|
||||
static void RandomGaugeTransform(GridParallelRNG &pRNG, GaugeField &Umu, GaugeMat &g){
|
||||
static void RandomGaugeTransform(GridParallelRNG &pRNG, GaugeField &Umu,
|
||||
GaugeMat &g) {
|
||||
LieRandomize(pRNG, g, 1.0);
|
||||
GaugeTransform(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) {
|
||||
// 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;
|
||||
@ -800,8 +793,8 @@ public:
|
||||
};
|
||||
|
||||
template <int N>
|
||||
LatticeComplexD Determinant(const Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > &Umu)
|
||||
{
|
||||
LatticeComplexD Determinant(
|
||||
const Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > &Umu) {
|
||||
GridBase *grid = Umu.Grid();
|
||||
auto lvol = grid->lSites();
|
||||
LatticeComplexD ret(grid);
|
||||
@ -817,15 +810,16 @@ LatticeComplexD Determinant(const Lattice<iScalar<iScalar<iMatrix<vComplexD, N>
|
||||
for (int i = 0; i < N; i++) {
|
||||
for (int j = 0; j < N; j++) {
|
||||
EigenU(i, j) = Us()()(i, j);
|
||||
}}
|
||||
}
|
||||
}
|
||||
ComplexD det = EigenU.determinant();
|
||||
pokeLocalSite(det, ret_v, lcoor);
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
template <int N>
|
||||
static void ProjectSUn(Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > &Umu)
|
||||
{
|
||||
static void ProjectSUn(
|
||||
Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > &Umu) {
|
||||
Umu = ProjectOnGroup(Umu);
|
||||
auto det = Determinant(Umu);
|
||||
|
||||
@ -838,8 +832,8 @@ static void ProjectSUn(Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > &Umu)
|
||||
}
|
||||
}
|
||||
template <int N>
|
||||
static void ProjectSUn(Lattice<iVector<iScalar<iMatrix<vComplexD, N> >,Nd> > &U)
|
||||
{
|
||||
static void ProjectSUn(
|
||||
Lattice<iVector<iScalar<iMatrix<vComplexD, N> >, Nd> > &U) {
|
||||
GridBase *grid = U.Grid();
|
||||
// Reunitarise
|
||||
for (int mu = 0; mu < Nd; mu++) {
|
||||
@ -851,9 +845,8 @@ static void ProjectSUn(Lattice<iVector<iScalar<iMatrix<vComplexD, N> >,Nd> > &U)
|
||||
}
|
||||
// Explicit specialisation for SU(3).
|
||||
// Explicit specialisation for SU(3).
|
||||
static void
|
||||
ProjectSU3 (Lattice<iScalar<iScalar<iMatrix<vComplexD, 3> > > > &Umu)
|
||||
{
|
||||
static void ProjectSU3(
|
||||
Lattice<iScalar<iScalar<iMatrix<vComplexD, 3> > > > &Umu) {
|
||||
GridBase *grid = Umu.Grid();
|
||||
const int x = 0;
|
||||
const int y = 1;
|
||||
@ -863,14 +856,17 @@ ProjectSU3 (Lattice<iScalar<iScalar<iMatrix<vComplexD, 3> > > > &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
|
||||
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)
|
||||
{
|
||||
static void ProjectSU3(
|
||||
Lattice<iVector<iScalar<iMatrix<vComplexD, 3> >, Nd> > &U) {
|
||||
GridBase *grid = U.Grid();
|
||||
// Reunitarise
|
||||
for (int mu = 0; mu < Nd; mu++) {
|
||||
@ -886,7 +882,6 @@ typedef SU<3> SU3;
|
||||
typedef SU<4> SU4;
|
||||
typedef SU<5> SU5;
|
||||
|
||||
|
||||
typedef SU<Nc> FundamentalMatrices;
|
||||
|
||||
NAMESPACE_END(Grid);
|
||||
|
Loading…
x
Reference in New Issue
Block a user