diff --git a/Grid/qcd/utils/SUn.h b/Grid/qcd/utils/SUn.h index aaabc4d4..00cd7f40 100644 --- a/Grid/qcd/utils/SUn.h +++ b/Grid/qcd/utils/SUn.h @@ -34,6 +34,59 @@ directory NAMESPACE_BEGIN(Grid); +template +Lattice > > > Determinant(const Lattice > > > &Umu) +{ + GridBase *grid=Umu.Grid(); + auto lvol = grid->lSites(); + Lattice > > > 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 > > Us; + peekLocalSite(Us, Umu_v, lcoor); + for(int i=0;i +static void ProjectSUn(Lattice > > > &Umu) +{ + Umu = ProjectOnGroup(Umu); + auto det = Determinant(Umu); + + det = conjugate(det); + + for(int i=0;i(Umu,N-1,i); + element = element * det; + PokeIndex(Umu,element,Nc-1,i); + } +} +template +static void ProjectSUn(Lattice >,Nd> > &U) +{ + GridBase *grid=U.Grid(); + // Reunitarise + for(int mu=0;mu(U,mu); + Umu = ProjectOnGroup(Umu); + ProjectSUn(Umu); + PokeIndex(U,Umu,mu); + } +} + template class SU { public: @@ -741,8 +794,14 @@ public: typedef Lattice LatticeMatrixType; LatticeMatrixType Umu(out.Grid()); + LatticeMatrixType tmp(out.Grid()); for (int mu = 0; mu < Nd; mu++) { - LieRandomize(pRNG, Umu, 1.0); + // LieRandomize(pRNG, Umu, 1.0); + // PokeIndex(out, Umu, mu); + gaussian(pRNG,Umu); + tmp = Ta(Umu); + taExp(tmp,Umu); + ProjectSUn(Umu); PokeIndex(out, Umu, mu); } } @@ -798,30 +857,6 @@ public: } }; -template -LatticeComplexD Determinant(const Lattice > > > &Umu) -{ - GridBase *grid=Umu.Grid(); - auto lvol = grid->lSites(); - LatticeComplexD 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 > > Us; - peekLocalSite(Us, Umu_v, lcoor); - for(int i=0;i Lattice > > > Inverse(const Lattice > > > &Umu) { @@ -851,32 +886,6 @@ Lattice > > > Inverse(const Lattice -static void ProjectSUn(Lattice > > > &Umu) -{ - Umu = ProjectOnGroup(Umu); - auto det = Determinant(Umu); - - det = conjugate(det); - - for(int i=0;i(Umu,N-1,i); - element = element * det; - PokeIndex(Umu,element,Nc-1,i); - } -} -template -static void ProjectSUn(Lattice >,Nd> > &U) -{ - GridBase *grid=U.Grid(); - // Reunitarise - for(int mu=0;mu(U,mu); - Umu = ProjectOnGroup(Umu); - ProjectSUn(Umu); - PokeIndex(U,Umu,mu); - } -} // Explicit specialisation for SU(3). // Explicit specialisation for SU(3). static void