mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-04 05:54:32 +00:00 
			
		
		
		
	cleaning up requested by Ed
This commit is contained in:
		@@ -303,7 +303,6 @@ class GaugeGroup {
 | 
				
			|||||||
  template <typename LatticeMatrixType>
 | 
					  template <typename LatticeMatrixType>
 | 
				
			||||||
  static void taProj(const LatticeMatrixType &in, LatticeMatrixType &out) {
 | 
					  static void taProj(const LatticeMatrixType &in, LatticeMatrixType &out) {
 | 
				
			||||||
    taProj(in, out, group_name());
 | 
					    taProj(in, out, group_name());
 | 
				
			||||||
    //out = Ta(in);
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
  template <typename LatticeMatrixType>
 | 
					  template <typename LatticeMatrixType>
 | 
				
			||||||
@@ -334,32 +333,20 @@ class GaugeGroup {
 | 
				
			|||||||
      ProjectOnGaugeGroup(Umu, group_name());
 | 
					      ProjectOnGaugeGroup(Umu, group_name());
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    template <class vtype>
 | 
					  template <class vtype>
 | 
				
			||||||
    static void ProjectOnGaugeGroup(iScalar<vtype> &r) {
 | 
					  static void ProjectOnGaugeGroup(iScalar<vtype> &r) {
 | 
				
			||||||
      ProjectOnGaugeGroup(r, group_name());
 | 
					      ProjectOnGaugeGroup(r, group_name());
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    template <class vtype, int N>
 | 
					 | 
				
			||||||
    static void ProjectOnGaugeGroup(iVector<vtype,N> &r) {
 | 
					 | 
				
			||||||
      r = ProjectOnGaugeGroup(r, group_name());
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    template <class vtype,int N, typename std::enable_if< GridTypeMapper<vtype>::TensorLevel == 0 >::type * =nullptr>
 | 
					 | 
				
			||||||
    static void ProjectOnGaugeGroup(iMatrix<vtype,N> &arg) {
 | 
					 | 
				
			||||||
      arg = ProjectOnGaugeGroup(arg, group_name());
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
  template <int N>        // reunitarise, resimplectify...
 | 
					 | 
				
			||||||
  static void ProjectOnGaugeGroup(iVector<iScalar<iMatrix<vComplexD, N> >, Nd> &U) {
 | 
					 | 
				
			||||||
      ProjectOnGaugeGroup(U, group_name());
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
         
 | 
					
 | 
				
			||||||
  template <int N>        // reunitarise, resimplectify...
 | 
					  template <class vtype, int N>
 | 
				
			||||||
  static void ProjectOnGaugeGroup(iScalar<iScalar<iMatrix<vComplexD, N> > > &Umu) {
 | 
					  static void ProjectOnGaugeGroup(iVector<vtype,N> &r) {
 | 
				
			||||||
      ProjectOnGaugeGroup(Umu, group_name());
 | 
					      r = ProjectOnGaugeGroup(r, group_name());
 | 
				
			||||||
  }*/
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  template <class vtype,int N, typename std::enable_if< GridTypeMapper<vtype>::TensorLevel == 0 >::type * =nullptr>
 | 
				
			||||||
 | 
					  static void ProjectOnGaugeGroup(iMatrix<vtype,N> &arg) {
 | 
				
			||||||
 | 
					      arg = ProjectOnGaugeGroup(arg, group_name());
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  template <int N>       // reunitarise, resimplectify... previously ProjectSUn
 | 
					  template <int N>       // reunitarise, resimplectify... previously ProjectSUn
 | 
				
			||||||
  static void ProjectGn(Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > &Umu) {
 | 
					  static void ProjectGn(Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > &Umu) {
 | 
				
			||||||
@@ -413,7 +400,6 @@ LatticeComplexD Determinant(
 | 
				
			|||||||
  return ret;
 | 
					  return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
template <int N>
 | 
					template <int N>
 | 
				
			||||||
static void ProjectSUn(
 | 
					static void ProjectSUn(
 | 
				
			||||||
    Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > &Umu) {
 | 
					    Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > &Umu) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -538,24 +538,6 @@ static void ProjectOnGaugeGroup(iMatrix<vtype,N> &arg, GroupName::SU) {
 | 
				
			|||||||
  arg = ProjectOnGroup(arg);
 | 
					  arg = ProjectOnGroup(arg);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
template <int N>    // non-lattice objects
 | 
					 | 
				
			||||||
static void ProjectOnGaugeGroup(iScalar<iScalar<iMatrix<vComplexD, N> > >  &Umu, GroupName::SU) {
 | 
					 | 
				
			||||||
  Umu = ProjectOnGroup(Umu);
 | 
					 | 
				
			||||||
 }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
template <int N>
 | 
					 | 
				
			||||||
static void ProjectOnGaugeGroup(iVector<iScalar<iMatrix<vComplexD, N> >, Nd>  &U, GroupName::SU) {
 | 
					 | 
				
			||||||
  // Reunitarise
 | 
					 | 
				
			||||||
  for (int mu = 0; mu < Nd; mu++) {
 | 
					 | 
				
			||||||
    auto Umu = PeekIndex<LorentzIndex>(U, mu);
 | 
					 | 
				
			||||||
    Umu = ProjectOnGroup(Umu);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}*/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
template <typename LatticeMatrixType>
 | 
					template <typename LatticeMatrixType>
 | 
				
			||||||
static void taProj(const LatticeMatrixType &in, LatticeMatrixType &out, GroupName::SU) {
 | 
					static void taProj(const LatticeMatrixType &in, LatticeMatrixType &out, GroupName::SU) {
 | 
				
			||||||
  out = Ta(in);
 | 
					  out = Ta(in);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -282,21 +282,6 @@ static void ProjectOnGaugeGroup(iMatrix<vtype,N> &arg, GroupName::Sp) {
 | 
				
			|||||||
  arg = ProjectOnSpGroup(arg);
 | 
					  arg = ProjectOnSpGroup(arg);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
template <int N>    // non-lattice objects
 | 
					 | 
				
			||||||
static void ProjectOnGaugeGroup(iScalar<iScalar<iMatrix<vComplexD, N> > >  &Umu, GroupName::Sp) {
 | 
					 | 
				
			||||||
  Umu = ProjectOnSpGroup(Umu);
 | 
					 | 
				
			||||||
 }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
template <int N>
 | 
					 | 
				
			||||||
static void ProjectOnGaugeGroup(iVector<iScalar<iMatrix<vComplexD, N> >, Nd>  &U, GroupName::Sp) {
 | 
					 | 
				
			||||||
  // Reunitarise
 | 
					 | 
				
			||||||
  for (int mu = 0; mu < Nd; mu++) {
 | 
					 | 
				
			||||||
    auto Umu = PeekIndex<LorentzIndex>(U, mu);
 | 
					 | 
				
			||||||
    Umu = ProjectOnSpGroup(Umu);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}*/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
template <typename LatticeMatrixType>   
 | 
					template <typename LatticeMatrixType>   
 | 
				
			||||||
static void taProj(const LatticeMatrixType &in, LatticeMatrixType &out, GroupName::Sp) {
 | 
					static void taProj(const LatticeMatrixType &in, LatticeMatrixType &out, GroupName::Sp) {
 | 
				
			||||||
  out = SpTa(in);
 | 
					  out = SpTa(in);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -84,47 +84,44 @@ template<class vtype,int N> accelerator_inline iVector<vtype,N> SpTa(const iVect
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
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)
 | 
					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
 | 
					  // Generalises Ta to Sp2n
 | 
				
			||||||
    // Applies the following projections
 | 
					  // Applies the following projections
 | 
				
			||||||
    // P_{antihermitian} P_{antihermitian-Sp-algebra} P_{traceless}
 | 
					  // P_{antihermitian} P_{antihermitian-Sp-algebra} P_{traceless}
 | 
				
			||||||
    // where the ordering matters
 | 
					  // where the ordering matters
 | 
				
			||||||
    // P_{traceless} subtracts the trace
 | 
					  // 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-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
 | 
					  // P_{antihermitian} does in-adj(in) / 2
 | 
				
			||||||
    iMatrix<vtype,N> ret(arg);
 | 
					  iMatrix<vtype,N> ret(arg);
 | 
				
			||||||
    double factor = (1.0/(double)N);
 | 
					  double factor = (1.0/(double)N);
 | 
				
			||||||
    vtype nrm;
 | 
					  vtype nrm;
 | 
				
			||||||
    nrm = 0.5;
 | 
					  nrm = 0.5;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    ret = arg - (trace(arg)*factor);
 | 
					  ret = arg - (trace(arg)*factor);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    for(int c1=0;c1<N/2;c1++)
 | 
					  for(int c1=0;c1<N/2;c1++)
 | 
				
			||||||
    {
 | 
					  {
 | 
				
			||||||
        for(int c2=0;c2<N/2;c2++)
 | 
					      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] = 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]
 | 
					          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++)
 | 
					      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-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._internal[c1+N/2][c2] = conjugate(ret._internal[c1][c2-N/2]);   //  from upper blocks
 | 
				
			||||||
        }
 | 
					      }
 | 
				
			||||||
    }
 | 
					  }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    ret = (ret - adj(ret))*0.5;
 | 
					  ret = (ret - adj(ret))*0.5;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return ret;
 | 
					  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;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -47,7 +47,7 @@ using namespace Grid;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
int main(int argc, char** argv) {
 | 
					int main(int argc, char** argv) {
 | 
				
			||||||
  Grid_init(&argc, &argv);
 | 
					  Grid_init(&argc, &argv);
 | 
				
			||||||
    
 | 
					
 | 
				
			||||||
  std::vector<int> latt({4, 4, 4, 8});
 | 
					  std::vector<int> latt({4, 4, 4, 8});
 | 
				
			||||||
  GridCartesian* grid = SpaceTimeGrid::makeFourDimGrid(
 | 
					  GridCartesian* grid = SpaceTimeGrid::makeFourDimGrid(
 | 
				
			||||||
      latt, GridDefaultSimd(Nd, vComplex::Nsimd()), GridDefaultMpi());
 | 
					      latt, GridDefaultSimd(Nd, vComplex::Nsimd()), GridDefaultMpi());
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,7 +36,7 @@ using namespace Grid;
 | 
				
			|||||||
int main (int argc, char ** argv)
 | 
					int main (int argc, char ** argv)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  Grid_init(&argc,&argv);
 | 
					  Grid_init(&argc,&argv);
 | 
				
			||||||
    
 | 
					
 | 
				
			||||||
  std::vector<int> latt({8,8,8,8});
 | 
					  std::vector<int> latt({8,8,8,8});
 | 
				
			||||||
  GridCartesian * grid = SpaceTimeGrid::makeFourDimGrid(latt, 
 | 
					  GridCartesian * grid = SpaceTimeGrid::makeFourDimGrid(latt, 
 | 
				
			||||||
							GridDefaultSimd(Nd,vComplexD::Nsimd()),
 | 
												GridDefaultSimd(Nd,vComplexD::Nsimd()),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,14 +10,14 @@ int main(int argc, char** argv) {
 | 
				
			|||||||
  //latt, GridDefaultSimd(Nd, vComplex::Nsimd()), GridDefaultMpi());
 | 
					  //latt, GridDefaultSimd(Nd, vComplex::Nsimd()), GridDefaultMpi());
 | 
				
			||||||
  //GridRedBlackCartesian* rbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(grid);
 | 
					  //GridRedBlackCartesian* rbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(grid);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    std::cout << GridLogMessage << "*********************************************"
 | 
					  std::cout << GridLogMessage << "*********************************************"
 | 
				
			||||||
              << std::endl;
 | 
					              << std::endl;
 | 
				
			||||||
    std::cout << GridLogMessage << "* Generators for Sp(2)" << std::endl;
 | 
					  std::cout << GridLogMessage << "* Generators for Sp(2)" << std::endl;
 | 
				
			||||||
    std::cout << GridLogMessage << "*********************************************"
 | 
					  std::cout << GridLogMessage << "*********************************************"
 | 
				
			||||||
              << std::endl;
 | 
					              << std::endl;
 | 
				
			||||||
      
 | 
					      
 | 
				
			||||||
    Sp2::printGenerators();
 | 
					  Sp2::printGenerators();
 | 
				
			||||||
    Sp2::testGenerators();
 | 
					  Sp2::testGenerators();
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  std::cout << GridLogMessage << "*********************************************"
 | 
					  std::cout << GridLogMessage << "*********************************************"
 | 
				
			||||||
            << std::endl;
 | 
					            << std::endl;
 | 
				
			||||||
@@ -46,6 +46,5 @@ int main(int argc, char** argv) {
 | 
				
			|||||||
  Sp8::printGenerators();
 | 
					  Sp8::printGenerators();
 | 
				
			||||||
  Sp8::testGenerators(); 
 | 
					  Sp8::testGenerators(); 
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    
 | 
					 | 
				
			||||||
  Grid_finalize();
 | 
					  Grid_finalize();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user