2016-07-08 15:40:11 +01:00
|
|
|
/*************************************************************************************
|
2016-01-02 14:51:32 +00:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
Grid physics library, www.github.com/paboyle/Grid
|
2016-01-02 14:51:32 +00:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
Source file: ./lib/qcd/utils/SUn.h
|
2016-01-02 14:51:32 +00:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
Copyright (C) 2015
|
2016-01-02 14:51:32 +00:00
|
|
|
|
|
|
|
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>
|
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
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.
|
2016-01-02 14:51:32 +00:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
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.
|
2016-01-02 14:51:32 +00:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
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.
|
2016-01-02 14:51:32 +00:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
See the full license in the file "LICENSE" in the top level distribution
|
|
|
|
directory
|
|
|
|
*************************************************************************************/
|
2018-01-14 21:58:47 +00:00
|
|
|
/* END LEGAL */
|
2015-06-14 01:28:54 +01:00
|
|
|
#ifndef QCD_UTIL_SUN_H
|
|
|
|
#define QCD_UTIL_SUN_H
|
|
|
|
|
2018-01-14 21:58:47 +00:00
|
|
|
NAMESPACE_BEGIN(Grid);
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
template <int ncolour>
|
2015-06-14 01:28:54 +01:00
|
|
|
class SU {
|
2018-01-14 21:58:47 +00:00
|
|
|
public:
|
2016-07-12 13:36:10 +01:00
|
|
|
static const int Dimension = ncolour;
|
|
|
|
static const int AdjointDimension = ncolour * ncolour - 1;
|
2016-07-08 15:40:11 +01:00
|
|
|
static int su2subgroups(void) { return (ncolour * (ncolour - 1)) / 2; }
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
template <typename vtype>
|
|
|
|
using iSUnMatrix = iScalar<iScalar<iMatrix<vtype, ncolour> > >;
|
|
|
|
template <typename vtype>
|
|
|
|
using iSU2Matrix = iScalar<iScalar<iMatrix<vtype, 2> > >;
|
|
|
|
template <typename vtype>
|
2016-07-12 13:36:10 +01:00
|
|
|
using iSUnAlgebraVector =
|
2018-01-14 21:58:47 +00:00
|
|
|
iScalar<iScalar<iVector<vtype, AdjointDimension> > >;
|
2015-06-14 01:28:54 +01:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
2016-07-08 15:40:11 +01:00
|
|
|
// Types can be accessed as SU<2>::Matrix , SU<2>::vSUnMatrix,
|
|
|
|
// SU<2>::LatticeMatrix etc...
|
2015-06-14 01:28:54 +01:00
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
2016-07-08 15:40:11 +01:00
|
|
|
typedef iSUnMatrix<Complex> Matrix;
|
|
|
|
typedef iSUnMatrix<ComplexF> MatrixF;
|
|
|
|
typedef iSUnMatrix<ComplexD> MatrixD;
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
typedef iSUnMatrix<vComplex> vMatrix;
|
|
|
|
typedef iSUnMatrix<vComplexF> vMatrixF;
|
|
|
|
typedef iSUnMatrix<vComplexD> vMatrixD;
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2016-07-08 16:14:16 +01:00
|
|
|
// 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;
|
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
typedef Lattice<vMatrix> LatticeMatrix;
|
|
|
|
typedef Lattice<vMatrixF> LatticeMatrixF;
|
|
|
|
typedef Lattice<vMatrixD> LatticeMatrixD;
|
2015-06-16 14:17:11 +01:00
|
|
|
|
2016-07-08 16:14:16 +01:00
|
|
|
typedef Lattice<vAlgebraVector> LatticeAlgebraVector;
|
|
|
|
typedef Lattice<vAlgebraVectorF> LatticeAlgebraVectorF;
|
|
|
|
typedef Lattice<vAlgebraVectorD> LatticeAlgebraVectorD;
|
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
typedef iSU2Matrix<Complex> SU2Matrix;
|
|
|
|
typedef iSU2Matrix<ComplexF> SU2MatrixF;
|
|
|
|
typedef iSU2Matrix<ComplexD> SU2MatrixD;
|
2015-06-16 14:17:11 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
typedef iSU2Matrix<vComplex> vSU2Matrix;
|
|
|
|
typedef iSU2Matrix<vComplexF> vSU2MatrixF;
|
|
|
|
typedef iSU2Matrix<vComplexD> vSU2MatrixD;
|
|
|
|
|
|
|
|
typedef Lattice<vSU2Matrix> LatticeSU2Matrix;
|
|
|
|
typedef Lattice<vSU2MatrixF> LatticeSU2MatrixF;
|
|
|
|
typedef Lattice<vSU2MatrixD> LatticeSU2MatrixD;
|
2015-06-16 14:17:11 +01:00
|
|
|
|
2015-06-14 01:28:54 +01:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
// There are N^2-1 generators for SU(N).
|
|
|
|
//
|
|
|
|
// We take a traceless hermitian generator basis as follows
|
|
|
|
//
|
2016-07-08 15:40:11 +01:00
|
|
|
// * Normalisation: trace ta tb = 1/2 delta_ab = T_F delta_ab
|
|
|
|
// T_F = 1/2 for SU(N) groups
|
|
|
|
//
|
2015-06-14 01:28:54 +01:00
|
|
|
// * Off diagonal
|
|
|
|
// - pairs of rows i1,i2 behaving like pauli matrices signma_x, sigma_y
|
2016-07-08 15:40:11 +01:00
|
|
|
//
|
|
|
|
// - there are (Nc-1-i1) slots for i2 on each row [ x 0 x ]
|
|
|
|
// direct count off each row
|
2015-06-14 01:28:54 +01:00
|
|
|
//
|
|
|
|
// - Sum of all pairs is Nc(Nc-1)/2: proof arithmetic series
|
|
|
|
//
|
2016-07-08 15:40:11 +01:00
|
|
|
// (Nc-1) + (Nc-2)+... 1 ==> Nc*(Nc-1)/2
|
|
|
|
// 1+ 2+ + + Nc-1
|
|
|
|
//
|
2015-06-14 01:28:54 +01:00
|
|
|
// - There are 2 x Nc (Nc-1)/ 2 of these = Nc^2 - Nc
|
|
|
|
//
|
|
|
|
// - We enumerate the row-col pairs.
|
2016-07-08 15:40:11 +01:00
|
|
|
// - for each row col pair there is a (sigma_x) and a (sigma_y) like
|
|
|
|
// generator
|
2015-06-14 01:28:54 +01:00
|
|
|
//
|
|
|
|
//
|
2016-07-08 15:40:11 +01:00
|
|
|
// 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})
|
|
|
|
//
|
2015-06-14 01:28:54 +01:00
|
|
|
// * Diagonal; must be traceless and normalised
|
2016-07-08 15:40:11 +01:00
|
|
|
// - Sequence is
|
2015-06-14 01:28:54 +01:00
|
|
|
// 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
|
|
|
|
//
|
2016-07-08 15:40:11 +01:00
|
|
|
// N= sqrt(1/2 . 1/6 ) = 1/2 . 1/sqrt(3)
|
2015-06-14 01:28:54 +01:00
|
|
|
//
|
|
|
|
// ( 1 )
|
|
|
|
// ( 1 ) / sqrt(3) /2 = 1/2 lambda_8
|
|
|
|
// ( -2)
|
2016-07-08 15:40:11 +01:00
|
|
|
//
|
2015-06-14 01:28:54 +01:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
2016-07-08 15:40:11 +01:00
|
|
|
template <class cplx>
|
|
|
|
static void generator(int lieIndex, iSUnMatrix<cplx> &ta) {
|
2015-06-14 01:28:54 +01:00
|
|
|
// map lie index to which type of generator
|
|
|
|
int diagIndex;
|
|
|
|
int su2Index;
|
|
|
|
int sigxy;
|
2016-07-08 15:40:11 +01:00
|
|
|
int NNm1 = ncolour * (ncolour - 1);
|
|
|
|
if (lieIndex >= NNm1) {
|
|
|
|
diagIndex = lieIndex - NNm1;
|
|
|
|
generatorDiagonal(diagIndex, ta);
|
2015-06-14 01:28:54 +01:00
|
|
|
return;
|
|
|
|
}
|
2016-07-12 13:36:10 +01:00
|
|
|
sigxy = lieIndex & 0x1; // even or odd
|
2016-07-08 15:40:11 +01:00
|
|
|
su2Index = lieIndex >> 1;
|
|
|
|
if (sigxy)
|
|
|
|
generatorSigmaY(su2Index, ta);
|
|
|
|
else
|
|
|
|
generatorSigmaX(su2Index, ta);
|
2015-06-14 01:28:54 +01:00
|
|
|
}
|
2016-08-30 11:31:25 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
template <class cplx>
|
2016-08-30 11:31:25 +01:00
|
|
|
static void generatorSigmaY(int su2Index, iSUnMatrix<cplx> &ta) {
|
2018-01-27 23:47:38 +00:00
|
|
|
ta = Zero();
|
2016-07-08 15:40:11 +01:00
|
|
|
int i1, i2;
|
|
|
|
su2SubGroupIndex(i1, i2, su2Index);
|
|
|
|
ta()()(i1, i2) = 1.0;
|
|
|
|
ta()()(i2, i1) = 1.0;
|
|
|
|
ta = ta * 0.5;
|
2015-06-14 01:28:54 +01:00
|
|
|
}
|
2016-10-21 16:06:34 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
template <class cplx>
|
2016-08-30 11:31:25 +01:00
|
|
|
static void generatorSigmaX(int su2Index, iSUnMatrix<cplx> &ta) {
|
2018-01-27 23:47:38 +00:00
|
|
|
ta = Zero();
|
2016-07-08 15:40:11 +01:00
|
|
|
cplx i(0.0, 1.0);
|
|
|
|
int i1, i2;
|
|
|
|
su2SubGroupIndex(i1, i2, su2Index);
|
2016-08-30 11:31:25 +01:00
|
|
|
ta()()(i1, i2) = i;
|
|
|
|
ta()()(i2, i1) = -i;
|
2016-07-08 15:40:11 +01:00
|
|
|
ta = ta * 0.5;
|
2015-06-14 01:28:54 +01:00
|
|
|
}
|
2016-08-30 11:31:25 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
template <class cplx>
|
|
|
|
static void generatorDiagonal(int diagIndex, iSUnMatrix<cplx> &ta) {
|
|
|
|
// diag ({1, 1, ..., 1}(k-times), -k, 0, 0, ...)
|
2018-01-27 23:47:38 +00:00
|
|
|
ta = Zero();
|
2016-07-12 13:36:10 +01:00
|
|
|
int k = diagIndex + 1; // diagIndex starts from 0
|
|
|
|
for (int i = 0; i <= diagIndex; i++) { // k iterations
|
2016-07-08 15:40:11 +01:00
|
|
|
ta()()(i, i) = 1.0;
|
2015-06-14 01:28:54 +01:00
|
|
|
}
|
2016-07-12 13:36:10 +01:00
|
|
|
ta()()(k, k) = -k; // indexing starts from 0
|
|
|
|
RealD nrm = 1.0 / std::sqrt(2.0 * k * (k + 1));
|
2016-07-08 15:40:11 +01:00
|
|
|
ta = ta * nrm;
|
2015-06-14 01:28:54 +01:00
|
|
|
}
|
2015-06-16 14:17:11 +01:00
|
|
|
|
2016-10-21 16:06:34 +01:00
|
|
|
|
|
|
|
|
2015-06-14 01:28:54 +01:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
// Map a su2 subgroup number to the pair of rows that are non zero
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
2016-07-08 15:40:11 +01:00
|
|
|
static void su2SubGroupIndex(int &i1, int &i2, int su2_index) {
|
|
|
|
assert((su2_index >= 0) && (su2_index < (ncolour * (ncolour - 1)) / 2));
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
int spare = su2_index;
|
|
|
|
for (i1 = 0; spare >= (ncolour - 1 - i1); i1++) {
|
|
|
|
spare = spare - (ncolour - 1 - i1); // remove the Nc-1-i1 terms
|
2015-06-14 01:28:54 +01:00
|
|
|
}
|
2016-07-08 15:40:11 +01:00
|
|
|
i2 = i1 + 1 + spare;
|
2015-06-14 01:28:54 +01:00
|
|
|
}
|
2015-06-16 14:17:11 +01:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Pull out a subgroup and project on to real coeffs x pauli basis
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
2016-07-08 15:40:11 +01:00
|
|
|
template <class vcplx>
|
|
|
|
static void su2Extract(Lattice<iSinglet<vcplx> > &Determinant,
|
|
|
|
Lattice<iSU2Matrix<vcplx> > &subgroup,
|
|
|
|
const Lattice<iSUnMatrix<vcplx> > &source,
|
|
|
|
int su2_index) {
|
2018-01-27 00:04:12 +00:00
|
|
|
GridBase *grid(source.Grid());
|
2016-07-08 15:40:11 +01:00
|
|
|
conformable(subgroup, source);
|
|
|
|
conformable(subgroup, Determinant);
|
|
|
|
int i0, i1;
|
|
|
|
su2SubGroupIndex(i0, i1, su2_index);
|
|
|
|
|
2018-01-28 01:01:14 +00:00
|
|
|
thread_loop( (int ss = 0; ss < grid->oSites(); ss++) ,{
|
2018-01-26 23:05:32 +00:00
|
|
|
subgroup[ss]()()(0, 0) = source[ss]()()(i0, i0);
|
|
|
|
subgroup[ss]()()(0, 1) = source[ss]()()(i0, i1);
|
|
|
|
subgroup[ss]()()(1, 0) = source[ss]()()(i1, i0);
|
|
|
|
subgroup[ss]()()(1, 1) = source[ss]()()(i1, i1);
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2018-01-26 23:05:32 +00:00
|
|
|
iSU2Matrix<vcplx> Sigma = subgroup[ss];
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
Sigma = Sigma - adj(Sigma) + trace(adj(Sigma));
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2018-01-26 23:05:32 +00:00
|
|
|
subgroup[ss] = Sigma;
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2015-06-16 14:17:11 +01:00
|
|
|
// this should be purely real
|
2018-01-26 23:05:32 +00:00
|
|
|
Determinant[ss] =
|
2018-01-14 21:58:47 +00:00
|
|
|
Sigma()()(0, 0) * Sigma()()(1, 1) - Sigma()()(0, 1) * Sigma()()(1, 0);
|
2018-01-28 01:01:14 +00:00
|
|
|
});
|
2015-06-16 14:17:11 +01:00
|
|
|
}
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2015-06-16 14:17:11 +01:00
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Set matrix to one and insert a pauli subgroup
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
2016-07-08 15:40:11 +01:00
|
|
|
template <class vcplx>
|
|
|
|
static void su2Insert(const Lattice<iSU2Matrix<vcplx> > &subgroup,
|
|
|
|
Lattice<iSUnMatrix<vcplx> > &dest, int su2_index) {
|
2018-01-27 00:04:12 +00:00
|
|
|
GridBase *grid(dest.Grid());
|
2016-07-08 15:40:11 +01:00
|
|
|
conformable(subgroup, dest);
|
|
|
|
int i0, i1;
|
|
|
|
su2SubGroupIndex(i0, i1, su2_index);
|
|
|
|
|
|
|
|
dest = 1.0; // start out with identity
|
2018-01-28 01:01:14 +00:00
|
|
|
thread_loop( (int ss = 0; ss < grid->oSites(); ss++) ,{
|
2018-01-26 23:05:32 +00:00
|
|
|
dest[ss]()()(i0, i0) = subgroup[ss]()()(0, 0);
|
|
|
|
dest[ss]()()(i0, i1) = subgroup[ss]()()(0, 1);
|
|
|
|
dest[ss]()()(i1, i0) = subgroup[ss]()()(1, 0);
|
|
|
|
dest[ss]()()(i1, i1) = subgroup[ss]()()(1, 1);
|
2018-01-28 01:01:14 +00:00
|
|
|
});
|
2015-06-14 01:28:54 +01:00
|
|
|
}
|
|
|
|
|
2015-06-16 14:17:11 +01:00
|
|
|
///////////////////////////////////////////////
|
2016-07-08 15:40:11 +01:00
|
|
|
// Generate e^{ Re Tr Staple Link} dlink
|
2015-06-16 14:17:11 +01:00
|
|
|
//
|
2016-07-08 15:40:11 +01:00
|
|
|
// *** Note Staple should be appropriate linear compbination between all
|
|
|
|
// staples.
|
2015-06-16 14:17:11 +01:00
|
|
|
// *** If already by beta pass coefficient 1.0.
|
2016-07-08 15:40:11 +01:00
|
|
|
// *** This routine applies the additional 1/Nc factor that comes after trace
|
|
|
|
// in action.
|
2015-06-16 14:17:11 +01:00
|
|
|
//
|
|
|
|
///////////////////////////////////////////////
|
2016-07-08 15:40:11 +01:00
|
|
|
static void SubGroupHeatBath(
|
2018-01-14 21:58:47 +00:00
|
|
|
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) {
|
2018-01-27 00:04:12 +00:00
|
|
|
GridBase *grid = link.Grid();
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
const RealD twopi = 2.0 * M_PI;
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
LatticeMatrix staple(grid);
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
staple = barestaple * (beta / ncolour);
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
LatticeMatrix V(grid);
|
|
|
|
V = link * staple;
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2015-06-16 14:17:11 +01:00
|
|
|
// Subgroup manipulation in the lie algebra space
|
2016-07-08 15:40:11 +01:00
|
|
|
LatticeSU2Matrix u(
|
2018-01-14 21:58:47 +00:00
|
|
|
grid); // Kennedy pendleton "u" real projected normalised Sigma
|
2015-06-16 14:17:11 +01:00
|
|
|
LatticeSU2Matrix uinv(grid);
|
2016-07-08 15:40:11 +01:00
|
|
|
LatticeSU2Matrix ua(grid); // a in pauli form
|
|
|
|
LatticeSU2Matrix b(grid); // rotated matrix after hb
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2015-06-16 14:17:11 +01:00
|
|
|
// Some handy constant fields
|
2016-07-08 15:40:11 +01:00
|
|
|
LatticeComplex ones(grid);
|
|
|
|
ones = 1.0;
|
|
|
|
LatticeComplex zeros(grid);
|
2018-01-27 23:47:38 +00:00
|
|
|
zeros = Zero();
|
2016-07-08 15:40:11 +01:00
|
|
|
LatticeReal rones(grid);
|
|
|
|
rones = 1.0;
|
|
|
|
LatticeReal rzeros(grid);
|
2018-01-27 23:47:38 +00:00
|
|
|
rzeros = Zero();
|
2016-07-08 15:40:11 +01:00
|
|
|
LatticeComplex udet(grid); // determinant of real(staple)
|
|
|
|
LatticeInteger mask_true(grid);
|
|
|
|
mask_true = 1;
|
|
|
|
LatticeInteger mask_false(grid);
|
|
|
|
mask_false = 0;
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
/*
|
2018-01-14 21:58:47 +00:00
|
|
|
PLB 156 P393 (1985) (Kennedy and Pendleton)
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2018-01-14 21:58:47 +00:00
|
|
|
Note: absorb "beta" into the def of sigma compared to KP paper; staple
|
|
|
|
passed to this routine has "beta" already multiplied in
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2018-01-14 21:58:47 +00:00
|
|
|
Action linear in links h and of form:
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
beta S = beta Sum_p (1 - 1/Nc Re Tr Plaq )
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2018-01-14 21:58:47 +00:00
|
|
|
Writing Sigma = 1/Nc (beta Sigma') where sum over staples is "Sigma' "
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2018-01-14 21:58:47 +00:00
|
|
|
beta S = const - beta/Nc Re Tr h Sigma'
|
|
|
|
= const - Re Tr h Sigma
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2018-01-14 21:58:47 +00:00
|
|
|
Decompose h and Sigma into (1, sigma_j) ; h_i real, h^2=1, Sigma_i complex
|
|
|
|
arbitrary.
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
Tr h Sigma = h_i Sigma_j Tr (sigma_i sigma_j) = h_i Sigma_j 2 delta_ij
|
2018-01-14 21:58:47 +00:00
|
|
|
Re Tr h Sigma = 2 h_j Re Sigma_j
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2018-01-14 21:58:47 +00:00
|
|
|
Normalised re Sigma_j = xi u_j
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2018-01-14 21:58:47 +00:00
|
|
|
With u_j a unit vector and U can be in SU(2);
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2018-01-14 21:58:47 +00:00
|
|
|
Re Tr h Sigma = 2 h_j Re Sigma_j = 2 xi (h.u)
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2018-01-14 21:58:47 +00:00
|
|
|
4xi^2 = Det [ Sig - Sig^dag + 1 Tr Sigdag]
|
|
|
|
u = 1/2xi [ Sig - Sig^dag + 1 Tr Sigdag]
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2018-01-14 21:58:47 +00:00
|
|
|
xi = sqrt(Det)/2;
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2018-01-14 21:58:47 +00:00
|
|
|
Write a= u h in SU(2); a has pauli decomp a_j;
|
2016-07-08 15:40:11 +01:00
|
|
|
|
2018-01-14 21:58:47 +00:00
|
|
|
Note: Product b' xi is unvariant because scaling Sigma leaves
|
|
|
|
normalised vector "u" fixed; Can rescale Sigma so b' = 1.
|
2016-07-08 15:40:11 +01:00
|
|
|
*/
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2015-06-16 14:17:11 +01:00
|
|
|
////////////////////////////////////////////////////////
|
|
|
|
// Real part of Pauli decomposition
|
|
|
|
// Note a subgroup can project to zero in cold start
|
|
|
|
////////////////////////////////////////////////////////
|
2016-07-08 15:40:11 +01:00
|
|
|
su2Extract(udet, u, V, su2_subgroup);
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2015-06-16 14:17:11 +01:00
|
|
|
//////////////////////////////////////////////////////
|
|
|
|
// Normalising this vector if possible; else identity
|
|
|
|
//////////////////////////////////////////////////////
|
2016-07-08 15:40:11 +01:00
|
|
|
LatticeComplex xi(grid);
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2015-06-16 14:17:11 +01:00
|
|
|
LatticeSU2Matrix lident(grid);
|
2016-07-08 15:40:11 +01:00
|
|
|
|
|
|
|
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;
|
2015-06-16 14:17:11 +01:00
|
|
|
|
|
|
|
LatticeComplex cone(grid);
|
|
|
|
LatticeReal adet(grid);
|
|
|
|
adet = abs(toReal(udet));
|
2016-07-08 15:40:11 +01:00
|
|
|
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);
|
2015-06-16 14:17:11 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
xi = 0.5 * sqrt(udet); // 4xi^2 = Det [ Sig - Sig^dag + 1 Tr Sigdag]
|
|
|
|
u = 0.5 * u *
|
2018-01-14 21:58:47 +00:00
|
|
|
pow(xi, -1.0); // u = 1/2xi [ Sig - Sig^dag + 1 Tr Sigdag]
|
2015-06-16 14:17:11 +01:00
|
|
|
|
|
|
|
// Debug test for sanity
|
2016-07-08 15:40:11 +01:00
|
|
|
uinv = adj(u);
|
|
|
|
b = u * uinv - 1.0;
|
|
|
|
assert(norm2(b) < 1.0e-4);
|
|
|
|
|
|
|
|
/*
|
2018-01-14 21:58:47 +00:00
|
|
|
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.
|
2016-07-08 15:40:11 +01:00
|
|
|
*/
|
2015-06-16 14:17:11 +01:00
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////
|
|
|
|
// count the number of sites by picking "1"'s out of hat
|
|
|
|
/////////////////////////////////////////////////////////
|
2016-07-08 15:40:11 +01:00
|
|
|
Integer hit = 0;
|
2015-06-16 14:17:11 +01:00
|
|
|
LatticeReal rtmp(grid);
|
2016-07-08 15:40:11 +01:00
|
|
|
rtmp = where(wheremask, rones, rzeros);
|
2015-06-16 14:17:11 +01:00
|
|
|
RealD numSites = sum(rtmp);
|
|
|
|
RealD numAccepted;
|
2016-07-08 15:40:11 +01:00
|
|
|
LatticeInteger Accepted(grid);
|
2018-01-27 23:47:38 +00:00
|
|
|
Accepted = Zero();
|
2015-06-16 14:17:11 +01:00
|
|
|
LatticeInteger newlyAccepted(grid);
|
2016-07-08 15:40:11 +01:00
|
|
|
|
|
|
|
std::vector<LatticeReal> xr(4, grid);
|
|
|
|
std::vector<LatticeReal> a(4, grid);
|
|
|
|
LatticeReal d(grid);
|
2018-01-27 23:47:38 +00:00
|
|
|
d = Zero();
|
2015-06-16 14:17:11 +01:00
|
|
|
LatticeReal alpha(grid);
|
|
|
|
|
2015-07-23 17:31:13 +01:00
|
|
|
// std::cout<<GridLogMessage<<"xi "<<xi <<std::endl;
|
2016-07-08 15:40:11 +01:00
|
|
|
alpha = toReal(2.0 * xi);
|
2015-06-16 14:17:11 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
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]);
|
2015-06-16 14:17:11 +01:00
|
|
|
|
|
|
|
// B. Set X = - ln R/alpha, X' = -ln R'/alpha
|
2016-07-08 15:40:11 +01:00
|
|
|
xr[1] = -log(xr[1]) / alpha;
|
|
|
|
xr[2] = -log(xr[2]) / alpha;
|
2015-06-16 14:17:11 +01:00
|
|
|
|
|
|
|
// C. Set C = cos^2(2piR'')
|
2016-07-08 15:40:11 +01:00
|
|
|
xr[3] = cos(xr[3] * twopi);
|
|
|
|
xr[3] = xr[3] * xr[3];
|
2015-06-16 14:17:11 +01:00
|
|
|
|
|
|
|
LatticeReal xrsq(grid);
|
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
// D. Set A = XC;
|
|
|
|
// E. Let d = X'+A;
|
|
|
|
xrsq = xr[2] + xr[1] * xr[3];
|
2015-06-16 14:17:11 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
d = where(Accepted, d, xr[2] + xr[1] * xr[3]);
|
2015-06-16 14:17:11 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
// 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);
|
2018-01-27 23:47:38 +00:00
|
|
|
izero = Zero();
|
2016-07-08 15:40:11 +01:00
|
|
|
|
|
|
|
newlyAccepted = where(xrsq < thresh, ione, izero);
|
|
|
|
Accepted = where(newlyAccepted, newlyAccepted, Accepted);
|
|
|
|
Accepted = where(wheremask, Accepted, izero);
|
2015-06-16 14:17:11 +01:00
|
|
|
|
|
|
|
// FIXME need an iSum for integer to avoid overload on return type??
|
2016-07-08 15:40:11 +01:00
|
|
|
rtmp = where(Accepted, rones, rzeros);
|
2015-06-16 14:17:11 +01:00
|
|
|
numAccepted = sum(rtmp);
|
|
|
|
|
|
|
|
hit++;
|
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
} while ((numAccepted < numSites) && (hit < nheatbath));
|
2015-06-16 14:17:11 +01:00
|
|
|
|
|
|
|
// G. Set a0 = 1 - d;
|
2018-01-27 23:47:38 +00:00
|
|
|
a[0] = Zero();
|
2016-07-08 15:40:11 +01:00
|
|
|
a[0] = where(wheremask, 1.0 - d, a[0]);
|
2015-06-16 14:17:11 +01:00
|
|
|
|
|
|
|
//////////////////////////////////////////
|
|
|
|
// ii) generate a_i uniform on two sphere radius (1-a0^2)^0.5
|
|
|
|
//////////////////////////////////////////
|
|
|
|
|
|
|
|
LatticeReal a123mag(grid);
|
2016-07-08 15:40:11 +01:00
|
|
|
a123mag = sqrt(abs(1.0 - a[0] * a[0]));
|
|
|
|
|
|
|
|
LatticeReal cos_theta(grid);
|
|
|
|
LatticeReal sin_theta(grid);
|
|
|
|
LatticeReal phi(grid);
|
2015-06-16 14:17:11 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
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));
|
2015-06-16 14:17:11 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
a[1] = a123mag * sin_theta * cos(phi);
|
|
|
|
a[2] = a123mag * sin_theta * sin(phi);
|
|
|
|
a[3] = a123mag * cos_theta;
|
2015-06-16 14:17:11 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
ua = toComplex(a[0]) * ident + toComplex(a[1]) * pauli1 +
|
2018-01-14 21:58:47 +00:00
|
|
|
toComplex(a[2]) * pauli2 + toComplex(a[3]) * pauli3;
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2015-06-16 14:17:11 +01:00
|
|
|
b = 1.0;
|
2016-07-08 15:40:11 +01:00
|
|
|
b = where(wheremask, uinv * ua, b);
|
|
|
|
su2Insert(b, V, su2_subgroup);
|
2015-06-16 14:17:11 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
// mask the assignment back based on Accptance
|
|
|
|
link = where(Accepted, V * link, link);
|
2015-06-16 14:17:11 +01:00
|
|
|
|
|
|
|
//////////////////////////////
|
|
|
|
// Debug Checks
|
|
|
|
// SU2 check
|
2016-07-08 15:40:11 +01:00
|
|
|
LatticeSU2Matrix check(grid); // rotated matrix after hb
|
2018-01-27 23:47:38 +00:00
|
|
|
u = Zero();
|
2015-06-16 14:17:11 +01:00
|
|
|
check = ua * adj(ua) - 1.0;
|
2016-07-08 15:40:11 +01:00
|
|
|
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);
|
2015-06-16 14:17:11 +01:00
|
|
|
|
|
|
|
LatticeMatrix Vcheck(grid);
|
2018-01-27 23:47:38 +00:00
|
|
|
Vcheck = Zero();
|
2016-07-08 15:40:11 +01:00
|
|
|
Vcheck = where(Accepted, V * adj(V) - 1.0, Vcheck);
|
2015-07-23 17:31:13 +01:00
|
|
|
// std::cout<<GridLogMessage << "SU3 check " <<norm2(Vcheck)<<std::endl;
|
2016-07-08 15:40:11 +01:00
|
|
|
assert(norm2(Vcheck) < 1.0e-4);
|
|
|
|
|
2015-06-16 14:17:11 +01:00
|
|
|
// Verify the link stays in SU(3)
|
2015-07-23 17:31:13 +01:00
|
|
|
// std::cout<<GridLogMessage <<"Checking the modified link"<<std::endl;
|
2016-07-08 15:40:11 +01:00
|
|
|
Vcheck = link * adj(link) - 1.0;
|
|
|
|
assert(norm2(Vcheck) < 1.0e-4);
|
2015-06-16 14:17:11 +01:00
|
|
|
/////////////////////////////////
|
2015-06-14 01:28:54 +01:00
|
|
|
}
|
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
static void printGenerators(void) {
|
2016-07-12 13:36:10 +01:00
|
|
|
for (int gen = 0; gen < AdjointDimension; gen++) {
|
2015-06-14 01:28:54 +01:00
|
|
|
Matrix ta;
|
2016-07-08 15:40:11 +01:00
|
|
|
generator(gen, ta);
|
|
|
|
std::cout << GridLogMessage << "Nc = " << ncolour << " t_" << gen
|
|
|
|
<< std::endl;
|
|
|
|
std::cout << GridLogMessage << ta << std::endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void testGenerators(void) {
|
2015-06-14 01:28:54 +01:00
|
|
|
Matrix ta;
|
|
|
|
Matrix tb;
|
2016-07-12 13:36:10 +01:00
|
|
|
std::cout << GridLogMessage
|
|
|
|
<< "Fundamental - Checking trace ta tb is 0.5 delta_ab"
|
2016-07-08 15:40:11 +01:00
|
|
|
<< std::endl;
|
2016-07-12 13:36:10 +01:00
|
|
|
for (int a = 0; a < AdjointDimension; a++) {
|
|
|
|
for (int b = 0; b < AdjointDimension; b++) {
|
2016-07-08 15:40:11 +01:00
|
|
|
generator(a, ta);
|
|
|
|
generator(b, tb);
|
|
|
|
Complex tr = TensorRemove(trace(ta * tb));
|
2016-07-12 13:36:10 +01:00
|
|
|
std::cout << GridLogMessage << "(" << a << "," << b << ") = " << tr
|
|
|
|
<< std::endl;
|
2016-07-08 15:40:11 +01:00
|
|
|
if (a == b) assert(abs(tr - Complex(0.5)) < 1.0e-6);
|
|
|
|
if (a != b) assert(abs(tr) < 1.0e-6);
|
2015-06-14 01:28:54 +01:00
|
|
|
}
|
2016-07-08 15:40:11 +01:00
|
|
|
std::cout << GridLogMessage << std::endl;
|
|
|
|
}
|
2016-07-12 13:36:10 +01:00
|
|
|
std::cout << GridLogMessage << "Fundamental - Checking if hermitian"
|
|
|
|
<< std::endl;
|
|
|
|
for (int a = 0; a < AdjointDimension; a++) {
|
2016-07-08 15:40:11 +01:00
|
|
|
generator(a, ta);
|
|
|
|
std::cout << GridLogMessage << a << std::endl;
|
2016-07-12 13:36:10 +01:00
|
|
|
assert(norm2(ta - adj(ta)) < 1.0e-6);
|
2016-07-08 15:40:11 +01:00
|
|
|
}
|
|
|
|
std::cout << GridLogMessage << std::endl;
|
|
|
|
|
2016-07-12 13:36:10 +01:00
|
|
|
std::cout << GridLogMessage << "Fundamental - Checking if traceless"
|
|
|
|
<< std::endl;
|
|
|
|
for (int a = 0; a < AdjointDimension; a++) {
|
2016-07-08 15:40:11 +01:00
|
|
|
generator(a, ta);
|
|
|
|
Complex tr = TensorRemove(trace(ta));
|
|
|
|
std::cout << GridLogMessage << a << " " << std::endl;
|
|
|
|
assert(abs(tr) < 1.0e-6);
|
2015-06-14 01:28:54 +01:00
|
|
|
}
|
2016-07-08 15:40:11 +01:00
|
|
|
std::cout << GridLogMessage << std::endl;
|
2015-06-14 01:28:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// reunitarise??
|
2016-07-08 15:40:11 +01:00
|
|
|
template <typename LatticeMatrixType>
|
|
|
|
static void LieRandomize(GridParallelRNG &pRNG, LatticeMatrixType &out,
|
|
|
|
double scale = 1.0) {
|
2018-01-27 00:04:12 +00:00
|
|
|
GridBase *grid = out.Grid();
|
2016-07-08 15:40:11 +01:00
|
|
|
|
2016-07-06 23:01:08 +01:00
|
|
|
typedef typename LatticeMatrixType::vector_type vector_type;
|
|
|
|
typedef typename LatticeMatrixType::scalar_type scalar_type;
|
2016-07-08 15:40:11 +01:00
|
|
|
|
2016-07-06 23:01:08 +01:00
|
|
|
typedef iSinglet<vector_type> vTComplexType;
|
2016-07-08 15:40:11 +01:00
|
|
|
|
2016-07-06 23:01:08 +01:00
|
|
|
typedef Lattice<vTComplexType> LatticeComplexType;
|
2016-07-08 15:40:11 +01:00
|
|
|
typedef typename GridTypeMapper<
|
2018-01-14 21:58:47 +00:00
|
|
|
typename LatticeMatrixType::vector_object>::scalar_object MatrixType;
|
2016-07-08 15:40:11 +01:00
|
|
|
|
|
|
|
LatticeComplexType ca(grid);
|
|
|
|
LatticeMatrixType lie(grid);
|
|
|
|
LatticeMatrixType la(grid);
|
|
|
|
ComplexD ci(0.0, scale);
|
|
|
|
ComplexD cone(1.0, 0.0);
|
2016-07-06 23:01:08 +01:00
|
|
|
MatrixType ta;
|
2015-06-20 22:22:56 +01:00
|
|
|
|
2018-01-27 23:47:38 +00:00
|
|
|
lie = Zero();
|
2016-07-12 13:36:10 +01:00
|
|
|
for (int a = 0; a < AdjointDimension; a++) {
|
2016-07-08 15:40:11 +01:00
|
|
|
random(pRNG, ca);
|
2015-10-01 00:02:44 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
ca = (ca + conjugate(ca)) * 0.5;
|
2015-10-01 00:02:44 +01:00
|
|
|
ca = ca - 0.5;
|
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
generator(a, ta);
|
2015-06-20 22:22:56 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
la = ci * ca * ta;
|
2015-06-20 22:22:56 +01:00
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
lie = lie + la; // e^{i la ta}
|
2015-06-20 22:22:56 +01:00
|
|
|
}
|
2016-07-08 15:40:11 +01:00
|
|
|
taExp(lie, out);
|
2015-06-20 22:22:56 +01:00
|
|
|
}
|
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
static void GaussianFundamentalLieAlgebraMatrix(GridParallelRNG &pRNG,
|
|
|
|
LatticeMatrix &out,
|
|
|
|
Real scale = 1.0) {
|
2018-01-27 00:04:12 +00:00
|
|
|
GridBase *grid = out.Grid();
|
2016-07-08 15:40:11 +01:00
|
|
|
LatticeReal ca(grid);
|
|
|
|
LatticeMatrix la(grid);
|
|
|
|
Complex ci(0.0, scale);
|
2015-07-03 08:51:41 +01:00
|
|
|
Matrix ta;
|
|
|
|
|
2018-01-27 23:47:38 +00:00
|
|
|
out = Zero();
|
2016-07-12 13:36:10 +01:00
|
|
|
for (int a = 0; a < AdjointDimension; a++) {
|
2016-07-08 15:40:11 +01:00
|
|
|
gaussian(pRNG, ca);
|
|
|
|
generator(a, ta);
|
2016-08-30 11:31:25 +01:00
|
|
|
la = toComplex(ca) * ta;
|
2016-07-08 15:40:11 +01:00
|
|
|
out += la;
|
2015-07-03 08:51:41 +01:00
|
|
|
}
|
2016-08-30 11:31:25 +01:00
|
|
|
out *= ci;
|
2016-07-08 15:40:11 +01:00
|
|
|
}
|
|
|
|
|
2016-07-28 16:44:41 +01:00
|
|
|
static void FundamentalLieAlgebraMatrix(const LatticeAlgebraVector &h,
|
2016-07-12 13:36:10 +01:00
|
|
|
LatticeMatrix &out,
|
2016-07-08 15:40:11 +01:00
|
|
|
Real scale = 1.0) {
|
2016-07-12 13:36:10 +01:00
|
|
|
conformable(h, out);
|
2018-01-27 00:04:12 +00:00
|
|
|
GridBase *grid = out.Grid();
|
2016-07-08 15:40:11 +01:00
|
|
|
LatticeMatrix la(grid);
|
|
|
|
Matrix ta;
|
2015-07-06 04:58:49 +01:00
|
|
|
|
2018-01-27 23:47:38 +00:00
|
|
|
out = Zero();
|
2016-07-12 13:36:10 +01:00
|
|
|
for (int a = 0; a < AdjointDimension; a++) {
|
2016-07-08 15:40:11 +01:00
|
|
|
generator(a, ta);
|
2016-07-28 16:44:41 +01:00
|
|
|
la = peekColour(h, a) * timesI(ta) * scale;
|
2016-07-08 15:40:11 +01:00
|
|
|
out += la;
|
|
|
|
}
|
2015-07-03 08:51:41 +01:00
|
|
|
}
|
2018-01-14 21:58:47 +00:00
|
|
|
/*
|
|
|
|
add GaugeTrans
|
|
|
|
*/
|
2016-10-25 14:21:48 +01:00
|
|
|
|
2018-01-14 21:58:47 +00:00
|
|
|
template<typename GaugeField,typename GaugeMat>
|
2016-10-25 14:21:48 +01:00
|
|
|
static void GaugeTransform( GaugeField &Umu, GaugeMat &g){
|
2018-01-27 00:04:12 +00:00
|
|
|
GridBase *grid = Umu.Grid();
|
|
|
|
conformable(grid,g.Grid());
|
2016-10-25 14:21:48 +01:00
|
|
|
|
|
|
|
GaugeMat U(grid);
|
|
|
|
GaugeMat ag(grid); ag = adj(g);
|
|
|
|
|
|
|
|
for(int mu=0;mu<Nd;mu++){
|
|
|
|
U= PeekIndex<LorentzIndex>(Umu,mu);
|
|
|
|
U = g*U*Cshift(ag, mu, 1);
|
|
|
|
PokeIndex<LorentzIndex>(Umu,U,mu);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
template<typename GaugeMat>
|
2018-01-14 21:58:47 +00:00
|
|
|
static void GaugeTransform( std::vector<GaugeMat> &U, GaugeMat &g){
|
2018-01-27 00:04:12 +00:00
|
|
|
GridBase *grid = g.Grid();
|
2016-10-25 14:21:48 +01:00
|
|
|
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){
|
|
|
|
LieRandomize(pRNG,g,1.0);
|
|
|
|
GaugeTransform(Umu,g);
|
|
|
|
}
|
2015-07-03 08:51:41 +01:00
|
|
|
|
2016-08-08 16:54:22 +01:00
|
|
|
// 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);
|
2018-01-27 23:47:38 +00:00
|
|
|
h_out = Zero();
|
2016-08-08 16:54:22 +01:00
|
|
|
Matrix Ta;
|
|
|
|
|
|
|
|
for (int a = 0; a < AdjointDimension; a++) {
|
|
|
|
generator(a, Ta);
|
2017-06-24 23:03:39 +01:00
|
|
|
pokeColour(h_out, - 2.0 * (trace(timesI(Ta) * in)) * scale, a);
|
2016-08-08 16:54:22 +01:00
|
|
|
}
|
|
|
|
}
|
2016-07-08 16:14:16 +01:00
|
|
|
|
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
template <typename GaugeField>
|
|
|
|
static void HotConfiguration(GridParallelRNG &pRNG, GaugeField &out) {
|
2016-07-06 23:01:08 +01:00
|
|
|
typedef typename GaugeField::vector_type vector_type;
|
|
|
|
typedef iSUnMatrix<vector_type> vMatrixType;
|
|
|
|
typedef Lattice<vMatrixType> LatticeMatrixType;
|
2016-07-08 15:40:11 +01:00
|
|
|
|
2018-01-27 00:04:12 +00:00
|
|
|
LatticeMatrixType Umu(out.Grid());
|
2016-07-08 15:40:11 +01:00
|
|
|
for (int mu = 0; mu < Nd; mu++) {
|
|
|
|
LieRandomize(pRNG, Umu, 1.0);
|
|
|
|
PokeIndex<LorentzIndex>(out, Umu, mu);
|
2015-06-20 22:22:56 +01:00
|
|
|
}
|
|
|
|
}
|
2016-08-31 00:27:53 +01:00
|
|
|
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;
|
|
|
|
|
2018-01-27 00:04:12 +00:00
|
|
|
LatticeMatrixType Umu(out.Grid());
|
2015-06-20 22:22:56 +01:00
|
|
|
for(int mu=0;mu<Nd;mu++){
|
|
|
|
LieRandomize(pRNG,Umu,0.01);
|
2016-03-16 09:30:40 +00:00
|
|
|
PokeIndex<LorentzIndex>(out,Umu,mu);
|
2015-06-20 22:22:56 +01:00
|
|
|
}
|
|
|
|
}
|
2016-08-31 00:27:53 +01:00
|
|
|
template<typename GaugeField>
|
2017-12-05 11:36:31 +00:00
|
|
|
static void ColdConfiguration(GaugeField &out){
|
2016-08-31 00:27:53 +01:00
|
|
|
typedef typename GaugeField::vector_type vector_type;
|
|
|
|
typedef iSUnMatrix<vector_type> vMatrixType;
|
|
|
|
typedef Lattice<vMatrixType> LatticeMatrixType;
|
|
|
|
|
2018-01-27 00:04:12 +00:00
|
|
|
LatticeMatrixType Umu(out.Grid());
|
2015-06-20 22:22:56 +01:00
|
|
|
Umu=1.0;
|
|
|
|
for(int mu=0;mu<Nd;mu++){
|
2016-03-16 09:30:40 +00:00
|
|
|
PokeIndex<LorentzIndex>(out,Umu,mu);
|
2015-06-20 22:22:56 +01:00
|
|
|
}
|
|
|
|
}
|
2017-12-05 11:36:31 +00:00
|
|
|
template<typename GaugeField>
|
|
|
|
static void ColdConfiguration(GridParallelRNG &pRNG,GaugeField &out){
|
|
|
|
ColdConfiguration(out);
|
|
|
|
}
|
2015-06-14 01:28:54 +01:00
|
|
|
|
2016-08-31 00:27:53 +01:00
|
|
|
template<typename LatticeMatrixType>
|
|
|
|
static void taProj( const LatticeMatrixType &in, LatticeMatrixType &out){
|
2015-06-14 01:28:54 +01:00
|
|
|
out = Ta(in);
|
|
|
|
}
|
2016-07-08 15:40:11 +01:00
|
|
|
template <typename LatticeMatrixType>
|
|
|
|
static void taExp(const LatticeMatrixType &x, LatticeMatrixType &ex) {
|
|
|
|
typedef typename LatticeMatrixType::scalar_type ComplexType;
|
|
|
|
|
2018-01-27 00:04:12 +00:00
|
|
|
LatticeMatrixType xn(x.Grid());
|
2015-06-14 01:28:54 +01:00
|
|
|
RealD nfac = 1.0;
|
2015-06-20 22:22:56 +01:00
|
|
|
|
|
|
|
xn = x;
|
2016-07-08 15:40:11 +01:00
|
|
|
ex = xn + ComplexType(1.0); // 1+x
|
2015-06-14 01:28:54 +01:00
|
|
|
|
|
|
|
// Do a 12th order exponentiation
|
2016-07-08 15:40:11 +01:00
|
|
|
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!....
|
2015-06-14 01:28:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-07-08 15:40:11 +01:00
|
|
|
typedef SU<2> SU2;
|
|
|
|
typedef SU<3> SU3;
|
|
|
|
typedef SU<4> SU4;
|
|
|
|
typedef SU<5> SU5;
|
2016-07-13 17:51:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
typedef SU<Nc> FundamentalMatrices;
|
|
|
|
|
2018-01-14 21:58:47 +00:00
|
|
|
NAMESPACE_END(Grid);
|
2015-06-14 01:28:54 +01:00
|
|
|
#endif
|