mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-10-31 03:54:33 +00:00 
			
		
		
		
	Stout smearing compiles (untested)
This commit is contained in:
		
							
								
								
									
										13
									
								
								configure
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										13
									
								
								configure
									
									
									
									
										vendored
									
									
								
							| @@ -2569,7 +2569,7 @@ test -n "$target_alias" && | ||||
|     NONENONEs,x,x, && | ||||
|   program_prefix=${target_alias}- | ||||
|  | ||||
| am__api_version='1.14' | ||||
| am__api_version='1.15' | ||||
|  | ||||
| # Find a good install program.  We prefer a C program (faster), | ||||
| # so one script is as good as another.  But avoid the broken or | ||||
| @@ -2741,8 +2741,8 @@ test "$program_suffix" != NONE && | ||||
| ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' | ||||
| program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` | ||||
|  | ||||
| # expand $ac_aux_dir to an absolute path | ||||
| am_aux_dir=`cd $ac_aux_dir && pwd` | ||||
| # Expand $ac_aux_dir to an absolute path. | ||||
| am_aux_dir=`cd "$ac_aux_dir" && pwd` | ||||
|  | ||||
| if test x"${MISSING+set}" != xset; then | ||||
|   case $am_aux_dir in | ||||
| @@ -2761,7 +2761,7 @@ else | ||||
| $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} | ||||
| fi | ||||
|  | ||||
| if test x"${install_sh}" != xset; then | ||||
| if test x"${install_sh+set}" != xset; then | ||||
|   case $am_aux_dir in | ||||
|   *\ * | *\	*) | ||||
|     install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; | ||||
| @@ -3089,8 +3089,8 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} | ||||
| # <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> | ||||
| mkdir_p='$(MKDIR_P)' | ||||
|  | ||||
| # We need awk for the "check" target.  The system "awk" is bad on | ||||
| # some platforms. | ||||
| # We need awk for the "check" target (and possibly the TAP driver).  The | ||||
| # system "awk" is bad on some platforms. | ||||
| # Always define AMTAR for backward compatibility.  Yes, it's still used | ||||
| # in the wild :-(  We should find a proper way to deprecate it ... | ||||
| AMTAR='$${TAR-tar}' | ||||
| @@ -3149,6 +3149,7 @@ END | ||||
| fi | ||||
|  | ||||
|  | ||||
|  | ||||
| ac_config_headers="$ac_config_headers lib/Config.h" | ||||
|  | ||||
| # Check whether --enable-silent-rules was given. | ||||
|   | ||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -195,30 +195,33 @@ inline void CBFromExpression( int &cb,const LatticeTrinaryExpression<Op,T1,T2,T3 | ||||
| // Unary operators and funcs | ||||
| //////////////////////////////////////////// | ||||
| #define GridUnopClass(name,ret)\ | ||||
| template <class arg> struct name\ | ||||
| {\ | ||||
|   static auto inline func(const arg a)-> decltype(ret) { return ret; } \ | ||||
| }; | ||||
|   template <class arg> struct name		\ | ||||
|     {								       \ | ||||
|       static auto inline func(const arg a)-> decltype(ret) { return ret; } \ | ||||
|     }; | ||||
|   | ||||
| GridUnopClass(UnarySub,-a); | ||||
| GridUnopClass(UnaryNot,Not(a)); | ||||
| GridUnopClass(UnaryAdj,adj(a)); | ||||
| GridUnopClass(UnaryConj,conjugate(a)); | ||||
| GridUnopClass(UnaryTrace,trace(a)); | ||||
| GridUnopClass(UnaryTranspose,transpose(a)); | ||||
| GridUnopClass(UnaryTa,Ta(a)); | ||||
| GridUnopClass(UnaryProjectOnGroup,ProjectOnGroup(a)); | ||||
| GridUnopClass(UnaryReal,real(a)); | ||||
| GridUnopClass(UnaryImag,imag(a)); | ||||
| GridUnopClass(UnaryToReal,toReal(a)); | ||||
| GridUnopClass(UnaryToComplex,toComplex(a)); | ||||
| GridUnopClass(UnaryAbs,abs(a)); | ||||
| GridUnopClass(UnarySqrt,sqrt(a)); | ||||
| GridUnopClass(UnaryRsqrt,rsqrt(a)); | ||||
| GridUnopClass(UnarySin,sin(a)); | ||||
| GridUnopClass(UnaryCos,cos(a)); | ||||
| GridUnopClass(UnaryLog,log(a)); | ||||
| GridUnopClass(UnaryExp,exp(a)); | ||||
|  GridUnopClass(UnarySub,-a); | ||||
|  GridUnopClass(UnaryNot,Not(a)); | ||||
|  GridUnopClass(UnaryAdj,adj(a)); | ||||
|  GridUnopClass(UnaryConj,conjugate(a)); | ||||
|  GridUnopClass(UnaryTrace,trace(a)); | ||||
|  GridUnopClass(UnaryTranspose,transpose(a)); | ||||
|  GridUnopClass(UnaryTa,Ta(a)); | ||||
|  GridUnopClass(UnaryProjectOnGroup,ProjectOnGroup(a)); | ||||
|  GridUnopClass(UnaryReal,real(a)); | ||||
|  GridUnopClass(UnaryImag,imag(a)); | ||||
|  GridUnopClass(UnaryToReal,toReal(a)); | ||||
|  GridUnopClass(UnaryToComplex,toComplex(a)); | ||||
|  GridUnopClass(UnaryTimesI,timesI(a)); | ||||
|  GridUnopClass(UnaryAbs,abs(a)); | ||||
|  GridUnopClass(UnarySqrt,sqrt(a)); | ||||
|  GridUnopClass(UnaryRsqrt,rsqrt(a)); | ||||
|  GridUnopClass(UnarySin,sin(a)); | ||||
|  GridUnopClass(UnaryCos,cos(a)); | ||||
|  GridUnopClass(UnaryAsin,sin(a)); | ||||
|  GridUnopClass(UnaryAcos,cos(a)); | ||||
|  GridUnopClass(UnaryLog,log(a)); | ||||
|  GridUnopClass(UnaryExp,exp(a)); | ||||
|   | ||||
| //////////////////////////////////////////// | ||||
| // Binary operators | ||||
| @@ -325,11 +328,14 @@ GRID_DEF_UNOP(real,UnaryReal); | ||||
| GRID_DEF_UNOP(imag,UnaryImag); | ||||
| GRID_DEF_UNOP(toReal,UnaryToReal); | ||||
| GRID_DEF_UNOP(toComplex,UnaryToComplex); | ||||
| GRID_DEF_UNOP(timesI,UnaryTimesI); | ||||
| GRID_DEF_UNOP(abs  ,UnaryAbs); //abs overloaded in cmath C++98; DON'T do the abs-fabs-dabs-labs thing | ||||
| GRID_DEF_UNOP(sqrt ,UnarySqrt); | ||||
| GRID_DEF_UNOP(rsqrt,UnaryRsqrt); | ||||
| GRID_DEF_UNOP(sin  ,UnarySin); | ||||
| GRID_DEF_UNOP(cos  ,UnaryCos); | ||||
| GRID_DEF_UNOP(asin  ,UnaryAsin); | ||||
| GRID_DEF_UNOP(acos  ,UnaryAcos); | ||||
| GRID_DEF_UNOP(log  ,UnaryLog); | ||||
| GRID_DEF_UNOP(exp  ,UnaryExp); | ||||
|  | ||||
|   | ||||
| @@ -462,5 +462,6 @@ namespace QCD { | ||||
| #include <qcd/hmc/integrators/Integrator_algorithm.h> | ||||
| #include <qcd/hmc/HMC.h> | ||||
|  | ||||
| #include <qcd/smearing/Smearing.h> | ||||
|  | ||||
| #endif | ||||
|   | ||||
| @@ -60,6 +60,15 @@ template<class Gimpl> class WilsonLoops; | ||||
|       typedef Lattice<SiteGaugeLink>                GaugeLinkField; // bit ugly naming; polarised gauge field, lorentz... all ugly | ||||
|       typedef Lattice<SiteGaugeField>                   GaugeField; | ||||
|  | ||||
|     // Move this elsewhere? | ||||
|     void AddGaugeLink(GaugeField& U, GaugeLinkField& W, int mu){  // U[mu] += W  | ||||
| PARALLEL_FOR_LOOP | ||||
|       for(auto ss=0;ss<U._grid->oSites();ss++){ | ||||
| 	U._odata[ss]._internal[mu] = U._odata[ss]._internal[mu] + W._odata[ss]._internal; | ||||
|         }   | ||||
|     } | ||||
|      | ||||
|        | ||||
|     }; | ||||
|  | ||||
|     // Composition with smeared link, bc's etc.. probably need multiple inheritance | ||||
|   | ||||
| @@ -5,146 +5,120 @@ | ||||
| #ifndef APE_SMEAR_ | ||||
| #define APE_SMEAR_ | ||||
|  | ||||
| /*!  @brief APE type smearing of link variables. */ | ||||
| namespace Grid { | ||||
|   namespace QCD { | ||||
|  | ||||
| template <class Gimpl>  | ||||
| class Smear_APE: public Smear<Gimpl>{ | ||||
| private: | ||||
|   const std::vector<double> rho;/*!< Array of weights */ | ||||
|  | ||||
|   //This member must be private - we do not want to control from outside  | ||||
|   std::vector<double> set_rho(const double)const { | ||||
|     std::vector<double> res; | ||||
|     /*!  @brief APE type smearing of link variables. */ | ||||
|     template <class Gimpl>  | ||||
|     class Smear_APE: public Smear<Gimpl>{ | ||||
|     private: | ||||
|       const std::vector<double> rho;/*!< Array of weights */ | ||||
|  | ||||
|     for(int mn=0; mn<Nd*Nd; ++mn) res.push_back(common_rho); | ||||
|     for(int mu=0; mu<Nd; ++mu) res[mu + mu*Nd] = 0.0; | ||||
|     return res; | ||||
|   } | ||||
|       //This member must be private - we do not want to control from outside  | ||||
|       std::vector<double> set_rho(const double common_rho)const { | ||||
| 	std::vector<double> res; | ||||
|      | ||||
| public: | ||||
|   INHERIT_GIMPL_TYPES(Gimpl) | ||||
|  | ||||
|   Smear_APE(const std::vector<double>& rho_):rho(rho_){} | ||||
|   Smear_APE(double rho_val):rho(set_rho(rho_val)){} | ||||
|   Smear_APE():rho(set_rho(1.0)){} | ||||
|   ~Smear_APE(){} | ||||
|  | ||||
|   void smear(GaugeField& u_smr, const GaugeField& U)const{ | ||||
|     double d_rho; | ||||
|     GaugeLinkField Cup, tmp_stpl; | ||||
|     WilsonLoops<Gimpl> WL; | ||||
|     u_smr = zero; | ||||
|  | ||||
|     for(int mu=0; mu<Nd; ++mu){ | ||||
|       Cup = zero; | ||||
|       for(int nu=0; nu<Nd; ++nu){ | ||||
| 	d_rho = rho[mu + Nd * nu]; | ||||
| 	WL.Staple(tmp_stpl, U, mu, nu); | ||||
| 	Cup += tmp_stpl*d_rho; | ||||
| 	for(int mn=0; mn<Nd*Nd; ++mn) res.push_back(common_rho); | ||||
| 	for(int mu=0; mu<Nd; ++mu) res[mu + mu*Nd] = 0.0; | ||||
| 	return res; | ||||
|       } | ||||
|       pokeLorentz(u_smr, Cup, mu); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   void derivative(GaugeField& SigmaTerm, | ||||
| 		  const GaugeField& iLambda, | ||||
| 		  const GaugeField& U)const{ | ||||
|  | ||||
|     /* | ||||
|     public: | ||||
|       // Defines the gauge field types | ||||
|       INHERIT_GIMPL_TYPES(Gimpl) | ||||
|  | ||||
|    | ||||
|     WilsonLoops<Gimpl> WL; | ||||
|     GaugeLinkField staple, u_tmp, iLambda_mu, iLambda_nu; | ||||
|     GaugeLinkField U_mu, U_nu; | ||||
|     GaugeLinkField sh_field ; | ||||
|     GaugeLinkField temp_Sigma; | ||||
|  | ||||
|     SU<N>::Matrix temp_mat, temp_mat2; | ||||
|     Real rho_munu, rho_numu; | ||||
|      | ||||
|     // to be completed  | ||||
|     int Nvol = CommonPrms::instance()->Nvol(); | ||||
|      | ||||
|     for(int mu = 0; mu < Nd; ++mu){ | ||||
|       U_mu       = PeekIndex<LorentzIndex>(      U, mu); | ||||
|       iLambda_mu = PeekIndex<LorentzIndex>(iLambda, mu); | ||||
|       // Constructors and destructors | ||||
|       Smear_APE(const std::vector<double>& rho_):rho(rho_){} | ||||
|       Smear_APE(double rho_val):rho(set_rho(rho_val)){} | ||||
|       Smear_APE():rho(set_rho(1.0)){} | ||||
|       ~Smear_APE(){} | ||||
|  | ||||
|  | ||||
|       for(int nu = 0; nu < Nd; ++nu){ | ||||
| 	if(nu==mu) continue; | ||||
| 	U_nu       = PeekIndex<LorentzIndex>(      U, nu); | ||||
| 	iLambda_nu = PeekIndex<LorentzIndex>(iLambda, nu); | ||||
|       void smear(GaugeField& u_smr, const GaugeField& U)const{ | ||||
| 	GridBase *grid = U._grid; | ||||
| 	double d_rho; | ||||
| 	GaugeLinkField Cup(grid), tmp_stpl(grid); | ||||
| 	WilsonLoops<Gimpl> WL; | ||||
| 	u_smr = zero; // probably unecessary | ||||
|  | ||||
| 	rho_munu = rho[mu + Nd * nu]; | ||||
| 	rho_numu = rho[nu + Nd * mu]; | ||||
| 	 | ||||
| 	WL.StapleUpper(staple, U, mu, nu); | ||||
| 	 | ||||
| 	temp_Sigma = adj(staple)*iLambda_nu; | ||||
| 	temp_Sigma *= - rho_numu; | ||||
| 	//-r_numu*U_nu(x+mu)*Udag_mu(x+nu)*Udag_nu(x)*Lambda_nu(x) | ||||
| 	SigmaTerm ................. | ||||
|  | ||||
| 	for (int site = 0; site < Nvol; ++site){ | ||||
| 	  temp_mat = mat_dag(staple,site) * mat(iLambda_nu,site); | ||||
| 	  temp_mat *= - rho_numu; | ||||
| 	  AddMat(SigmaTerm, temp_mat, site, mu); | ||||
| 	for(int mu=0; mu<Nd; ++mu){ | ||||
| 	  Cup = zero; | ||||
| 	  for(int nu=0; nu<Nd; ++nu){ | ||||
| 	    d_rho = rho[mu + Nd * nu]; | ||||
| 	    WL.Staple(tmp_stpl, U, mu, nu);  //nb staple conventions of IroIro and Grid differ by a dag | ||||
| 	    Cup += tmp_stpl*d_rho; | ||||
| 	  } | ||||
| 	  pokeLorentz(u_smr, adj(Cup), mu); // u_smr[mu] = Cup^dag | ||||
| 	} | ||||
| 	sh_field = shiftField(iLambda_nu, mu, Forward()); | ||||
| 	 | ||||
| 	for (int site = 0; site < Nvol; ++site){ | ||||
| 	  temp_mat = mat(sh_field,site) * mat_dag(staple,site); | ||||
| 	  temp_mat *= rho_numu; | ||||
| 	  AddMat(SigmaTerm, temp_mat, site, mu); | ||||
| 	}//r_numu*Lambda_nu(mu)*U_nu(x+mu)*Udag_mu(x+nu)*Udag_nu(x) | ||||
| 	 | ||||
| 	sh_field = shiftField(iLambda_mu, nu, Forward()); | ||||
| 	 | ||||
| 	for (int site = 0; site < Nvol; ++site){ | ||||
| 	  temp_mat = mat(U_nu,site) * mat(sh_field,site) * mat_dag(U_nu,site); | ||||
| 	  temp_mat = mat_dag(staple,site) * temp_mat; | ||||
| 	  temp_mat *= - rho_munu; | ||||
| 	  AddMat(SigmaTerm, temp_mat, site, mu); | ||||
| 	}//-r_munu*U_nu(x+mu)*Udag_mu(x+nu)*Lambda_mu(x+nu)*Udag_nu(x) | ||||
| 	 | ||||
| 	staple = 0.0; | ||||
| 	sh_field = shiftField(U_nu, mu, Forward()); | ||||
| 	 | ||||
| 	for (int site = 0; site < Nvol; ++site){ | ||||
| 	  temp_mat2 = mat_dag(sh_field,site) * mat_dag(U_mu,site); | ||||
| 	  temp_mat = temp_mat2  * mat(iLambda_mu,site) * mat(U_nu,site); | ||||
| 	  temp_mat *= - rho_munu; | ||||
| 	  AddMat(staple, temp_mat, site); | ||||
| 	  temp_mat = temp_mat2 * mat(iLambda_nu,site) * mat(U_nu,site); | ||||
| 	  temp_mat *= rho_numu; | ||||
| 	  AddMat(staple, temp_mat, site); | ||||
| 	}  | ||||
| 	 | ||||
| 	for (int site = 0; site < Nvol; ++site){ | ||||
| 	  temp_mat = mat_dag(U_nu,site) * mat(iLambda_nu,site); | ||||
| 	  SetMat(u_tmp, temp_mat, site); | ||||
| 	} | ||||
| 	 | ||||
| 	sh_field = shiftField(u_tmp, mu, Forward());  | ||||
| 	 | ||||
| 	for (int site = 0; site < Nvol; ++site){ | ||||
| 	  temp_mat = mat(sh_field,site) * mat_dag(U_mu,site) * mat(U_nu,site); | ||||
| 	  temp_mat *= - rho_numu; | ||||
| 	  AddMat(staple, temp_mat, site); | ||||
| 	}    | ||||
| 	 | ||||
| 	sh_field = shiftField(staple, nu, Backward()); | ||||
| 	 | ||||
| 	AddSlice(SigmaTerm, sh_field, mu); | ||||
|       } | ||||
|     } | ||||
|  | ||||
|     */ | ||||
|   } | ||||
|       void derivative(GaugeField& SigmaTerm, | ||||
| 		      const GaugeField& iLambda, | ||||
| 		      const GaugeField& U)const{ | ||||
|      | ||||
| 	// Reference  | ||||
| 	// Morningstar, Peardon, Phys.Rev.D69,054501(2004) | ||||
| 	// Equation 75 | ||||
|  | ||||
|     	GridBase *grid = U._grid; | ||||
| 	int vol = U._grid->gSites(); | ||||
| 	 | ||||
| 	WilsonLoops<Gimpl> WL; | ||||
| 	GaugeLinkField staple(grid), u_tmp(grid), iLambda_mu(grid), iLambda_nu(grid); | ||||
| 	GaugeLinkField U_mu(grid), U_nu(grid), sh_field(grid), temp_Sigma(grid); | ||||
| 	Real rho_munu, rho_numu; | ||||
|      | ||||
| 	for(int mu = 0; mu < Nd; ++mu){ | ||||
| 	  U_mu       = PeekIndex<LorentzIndex>(      U, mu); | ||||
| 	  iLambda_mu = PeekIndex<LorentzIndex>(iLambda, mu); | ||||
|        | ||||
| 	  for(int nu = 0; nu < Nd; ++nu){ | ||||
| 	    if(nu==mu) continue; | ||||
| 	    U_nu       = PeekIndex<LorentzIndex>(      U, nu); | ||||
| 	    iLambda_nu = PeekIndex<LorentzIndex>(iLambda, nu); | ||||
| 	 | ||||
| 	    rho_munu = rho[mu + Nd * nu]; | ||||
| 	    rho_numu = rho[nu + Nd * mu]; | ||||
| 	 | ||||
| 	    WL.StapleUpper(staple, U, mu, nu); | ||||
|  | ||||
| 	    temp_Sigma = -rho_numu*staple*iLambda_nu; | ||||
| 	    //-r_numu*U_nu(x+mu)*Udag_mu(x+nu)*Udag_nu(x)*Lambda_nu(x) | ||||
| 	    AddGaugeLink(SigmaTerm, temp_Sigma, mu); | ||||
|  | ||||
| 	    sh_field = Cshift(iLambda_nu, mu, 1);// general also for Gparity? | ||||
| 	 | ||||
| 	    temp_Sigma = rho_numu*sh_field*staple; | ||||
| 	    //r_numu*Lambda_nu(mu)*U_nu(x+mu)*Udag_mu(x+nu)*Udag_nu(x) | ||||
| 	    AddGaugeLink(SigmaTerm, temp_Sigma, mu); | ||||
|  | ||||
| 	    sh_field = Cshift(iLambda_mu, nu, 1); | ||||
|  | ||||
| 	    temp_Sigma = -rho_munu*staple*U_nu*sh_field*adj(U_nu); | ||||
| 	    //-r_munu*U_nu(x+mu)*Udag_mu(x+nu)*Lambda_mu(x+nu)*Udag_nu(x) | ||||
| 	    AddGaugeLink(SigmaTerm, temp_Sigma, mu); | ||||
|  | ||||
| 	    staple = zero; | ||||
| 	    sh_field = Cshift(U_nu, mu, 1); | ||||
|  | ||||
| 	    temp_Sigma = -rho_munu*adj(sh_field)*adj(U_mu)*iLambda_mu*U_nu; | ||||
| 	    temp_Sigma += rho_numu*adj(sh_field)*adj(U_mu)*iLambda_nu*U_nu; | ||||
|  | ||||
| 	    u_tmp = adj(U_nu)*iLambda_nu; | ||||
| 	    sh_field = Cshift(u_tmp, mu, 1); | ||||
| 	    temp_Sigma += -rho_numu*sh_field*adj(U_mu)*U_nu; | ||||
| 	    sh_field = Cshift(temp_Sigma, nu, -1); | ||||
| 	    AddGaugeLink(SigmaTerm, sh_field, mu); | ||||
| 	     | ||||
| 	  } | ||||
| 	} | ||||
|       } | ||||
|     }; | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| }; | ||||
|  | ||||
|   }// namespace QCD | ||||
| }//namespace Grid | ||||
| #endif   | ||||
|   | ||||
| @@ -22,7 +22,7 @@ namespace Grid { | ||||
|       It stores a list of smeared configurations. | ||||
|     */ | ||||
|     template <class Gimpl> | ||||
|     class GaugeConfiguration { | ||||
|     class SmearedConfiguration { | ||||
|     public: | ||||
|       INHERIT_GIMPL_TYPES(Gimpl) | ||||
|       private: | ||||
| @@ -58,7 +58,7 @@ namespace Grid { | ||||
| 				    links configuration */ | ||||
|        | ||||
|       /*! @brief Standard constructor */ | ||||
|       GaugeConfiguration(GridCartesian * UGrid, | ||||
|       SmearedConfiguration(GridCartesian * UGrid, | ||||
| 			 unsigned int Nsmear,  | ||||
| 			 Smear_Stout& Stout): | ||||
| 	smearingLevels(Nsmear), | ||||
| @@ -69,7 +69,7 @@ namespace Grid { | ||||
|       } | ||||
|        | ||||
|       /*! For just thin links */ | ||||
|       GaugeConfiguration(GridCartesian * UGrid): | ||||
|       SmearedConfiguration(GridCartesian * UGrid): | ||||
| 	smearingLevels(0), | ||||
| 	StoutSmearing(), | ||||
| 	SmearedSet(0), | ||||
|   | ||||
							
								
								
									
										9
									
								
								lib/qcd/smearing/Smearing.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								lib/qcd/smearing/Smearing.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| #ifndef GRID_QCD_SMEARING_H | ||||
| #define GRID_QCD_SMEARING_H | ||||
|  | ||||
| #include <qcd/smearing/BaseSmearing.h> | ||||
| #include <qcd/smearing/APEsmearing.h> | ||||
| #include <qcd/smearing/StoutSmearing.h> | ||||
|  | ||||
|  | ||||
| #endif | ||||
| @@ -5,28 +5,132 @@ | ||||
| #ifndef STOUT_SMEAR_ | ||||
| #define STOUT_SMEAR_ | ||||
|  | ||||
| /*!  @brief Stout smearing of link variable. */ | ||||
| template <class Gimpl>  | ||||
| class Smear_Stout: public Smear<Gimpl> { | ||||
| private: | ||||
|   const std::valarray<double> d_rho; | ||||
|   const Smear* SmearBase; | ||||
| namespace Grid { | ||||
|   namespace QCD { | ||||
|  | ||||
|   double func_xi0(double w) const; | ||||
| public: | ||||
|   INHERIT_GIMPL_TYPES(Gimpl) | ||||
|   Smear_Stout(Smear* base):SmearBase(base){} | ||||
|     /*!  @brief Stout smearing of link variable. */ | ||||
|     template <class Gimpl>  | ||||
|     class Smear_Stout: public Smear<Gimpl> { | ||||
|     private: | ||||
|       const std::vector<double> d_rho; | ||||
|       const Smear < Gimpl > * SmearBase; | ||||
|        | ||||
|   /*! Default constructor */ | ||||
|   Smear_Stout():SmearBase(new Smear_APE()){} | ||||
|       LatticeReal func_xi0(LatticeReal w) const{ | ||||
| 	// Define a function to do the check | ||||
| 	//if( w < 1e-4 ) std::cout << GridLogWarning << "[Smear_stout] w too small: "<< w <<"\n"; | ||||
| 	return  sin(w)/w; | ||||
|       } | ||||
|        | ||||
|   ~Smear_Stout(){} | ||||
|     public: | ||||
|       INHERIT_GIMPL_TYPES(Gimpl) | ||||
|        | ||||
|   void smear(GaugeField&,const GaugeField&) const; | ||||
|   void BaseSmear(GaugeField&, const GaugeField&) const; | ||||
|   void derivative(GaugeField&, const GaugeField&, const GaugeField&) const; | ||||
|   void exponentiate_iQ(GaugeField&, const GaugeField&) const; | ||||
|       Smear_Stout(Smear < Gimpl >* base):SmearBase(base){} | ||||
|        | ||||
| }; | ||||
|       /*! Default constructor */ | ||||
|       Smear_Stout():SmearBase(new Smear_APE < Gimpl > ()){} | ||||
|        | ||||
|       ~Smear_Stout(){} | ||||
|        | ||||
|       void smear(GaugeField& u_smr,const GaugeField& U) const{ | ||||
| 	long double timing; | ||||
| 	 | ||||
| 	GaugeField u_tmp1, q_mu; | ||||
| 	 | ||||
| 	std::cout<< GridLogDebug << "Stout smearing started\n"; | ||||
| 	 | ||||
| 	//Smear the configurations | ||||
| 	SmearBase->smear(u_tmp1, U); | ||||
| 	 | ||||
| 	q_mu = Ta(u_tmp1*adj(u_tmp1)); // q_mu = Ta(Omega_mu) | ||||
| 	 | ||||
| 	exponentiate_iQ(u_tmp1, q_mu); | ||||
|  | ||||
| 	u_smr = u_tmp1*U; | ||||
| 	 | ||||
| 	std::cout<< GridLogDebug << "Stout smearing completed\n"; | ||||
|       } | ||||
|       void derivative(GaugeField& SigmaTerm, | ||||
| 		      const GaugeField& iLambda, | ||||
| 		      const GaugeField& Gauge) const{ | ||||
| 	SmearBase->derivative(SigmaTerm, iLambda, Gauge); | ||||
|       } | ||||
|        | ||||
|        | ||||
|       void BaseSmear(GaugeField& C, | ||||
| 		     const GaugeField& U) const{ | ||||
| 	SmearBase->smear(C, U); | ||||
|       } | ||||
|        | ||||
|       void exponentiate_iQ(GaugeField& e_iQ, | ||||
| 			   const GaugeField& iQ) const{ | ||||
| 	// Put this outside  | ||||
| 	// only valid for SU(3) matrices | ||||
|  | ||||
| 	GridBase *grid = iQ._grid; | ||||
| 	Real one_over_three = 1.0/3.0; | ||||
| 	Real one_over_two = 1.0/2.0; | ||||
|  | ||||
| 	GaugeField unity; | ||||
| 	GaugeLinkField Umu(iQ._grid); | ||||
| 	Umu=1.0; | ||||
| 	for(int mu=0;mu<Nd;mu++){ | ||||
| 	  pokeLorentz(unity,Umu,mu); | ||||
| 	} | ||||
|  | ||||
| 	 | ||||
| 	GaugeField iQ2, iQ3; | ||||
| 	LatticeReal c0(grid), c1(grid), c0max(grid), u_val(grid), tmp(grid); | ||||
| 	LatticeReal w(grid), theta(grid), xi0(grid), u2(grid), w2(grid), cosw(grid); | ||||
| 	LatticeComplex fden(grid); | ||||
| 	LatticeComplex f0(grid), f1(grid), f2(grid), h0(grid), h1(grid), h2(grid); | ||||
| 	LatticeComplex e2iu(grid), emiu(grid), ixi0(grid), qt(grid); | ||||
|  | ||||
| 	iQ2 = iQ * iQ; | ||||
| 	iQ3 = iQ * iQ2; | ||||
|  | ||||
| 	c0    = - imag(trace(iQ3)) * one_over_three; | ||||
| 	c1    = - real(trace(iQ2)) * one_over_two; | ||||
| 	tmp   = c1 * one_over_three; | ||||
|     	c0max = 2.0 * pow(tmp, 1.5); | ||||
|  | ||||
| 	theta = acos(c0/c0max); | ||||
|  | ||||
| 	u_val = sqrt(tmp) * cos( theta * one_over_three); | ||||
| 	w     = sqrt(c1) * sin ( theta * one_over_three); | ||||
| 	xi0   = func_xi0(w); | ||||
| 	u2    = u_val * u_val; | ||||
| 	w2    = w * w; | ||||
| 	cosw  = cos(w); | ||||
|  | ||||
| 	ixi0  = timesI(toComplex(xi0)); | ||||
| 	emiu  = toComplex(cos(u_val)) - timesI(toComplex(u_val)); | ||||
| 	e2iu  = toComplex(cos(2.0*u_val)) + timesI(toComplex(2.0*u_val)); | ||||
| 	 | ||||
| 	h0    = e2iu * toComplex(u2 - w2) + emiu *( toComplex(8.0*u2*cosw) + | ||||
| 						    toComplex(2.0*u_val*(3.0*u2 + w2))*ixi0); | ||||
| 	 | ||||
| 	h1    = toComplex(2.0*u_val) * e2iu - emiu*( toComplex(2.0*u_val*cosw) - | ||||
| 						     toComplex(3.0*u2-w2)*ixi0); | ||||
| 	 | ||||
| 	h2    = e2iu - emiu * (toComplex(cosw) + toComplex(3.0*u_val)*ixi0); | ||||
|  | ||||
| 	 | ||||
| 	tmp   = 9.0*u2 - w2; | ||||
| 	fden  = toComplex(pow(tmp, -1.0)); | ||||
| 	f0    = h0 * fden; | ||||
| 	f1    = h1 * fden; | ||||
| 	f2    = h2 * fden; | ||||
|  | ||||
| 	 | ||||
| 	e_iQ = f0*unity + f1 * timesMinusI(iQ) - f2 * iQ2; | ||||
| 	 | ||||
| 	 | ||||
| 	 | ||||
|       }; | ||||
|        | ||||
|     }; | ||||
|  | ||||
|   } | ||||
| } | ||||
|  | ||||
| #endif   | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
|     /************************************************************************************* | ||||
| /************************************************************************************* | ||||
|  | ||||
|     Grid physics library, www.github.com/paboyle/Grid  | ||||
|  | ||||
| @@ -26,473 +26,469 @@ Author: paboyle <paboyle@ph.ed.ac.uk> | ||||
|     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 */ | ||||
| *************************************************************************************/ | ||||
| /*  END LEGAL */ | ||||
| #ifndef QCD_UTILS_WILSON_LOOPS_H | ||||
| #define QCD_UTILS_WILSON_LOOPS_H | ||||
| namespace Grid { | ||||
| namespace QCD { | ||||
|   namespace QCD { | ||||
|      | ||||
| // Common wilson loop observables | ||||
| template<class Gimpl> | ||||
| class WilsonLoops : public Gimpl { | ||||
| public: | ||||
|     // Common wilson loop observables | ||||
|     template<class Gimpl> | ||||
|       class WilsonLoops : public Gimpl { | ||||
|     public: | ||||
|        | ||||
|   INHERIT_GIMPL_TYPES(Gimpl); | ||||
|       INHERIT_GIMPL_TYPES(Gimpl); | ||||
|        | ||||
|   typedef typename Gimpl::GaugeLinkField GaugeMat; | ||||
|   typedef typename Gimpl::GaugeField     GaugeLorentz; | ||||
|       typedef typename Gimpl::GaugeLinkField GaugeMat; | ||||
|       typedef typename Gimpl::GaugeField     GaugeLorentz; | ||||
|        | ||||
|   ////////////////////////////////////////////////// | ||||
|   // directed plaquette oriented in mu,nu plane | ||||
|   ////////////////////////////////////////////////// | ||||
|   static void dirPlaquette(GaugeMat &plaq,const std::vector<GaugeMat> &U, const int mu, const int nu) | ||||
|   { | ||||
|     // Annoyingly, must use either scope resolution to find dependent base class,  | ||||
|     // or this-> ; there is no "this" in a static method. This forces explicit Gimpl scope | ||||
|     // resolution throughout the usage in this file, and rather defeats the purpose of deriving | ||||
|     // from Gimpl. | ||||
|     plaq= Gimpl::CovShiftBackward(U[mu],mu, | ||||
| 	  Gimpl::CovShiftBackward(U[nu],nu, | ||||
|           Gimpl::CovShiftForward (U[mu],mu,U[nu]))); | ||||
|   } | ||||
|   ////////////////////////////////////////////////// | ||||
|   // trace of directed plaquette oriented in mu,nu plane | ||||
|   ////////////////////////////////////////////////// | ||||
|   static void traceDirPlaquette(LatticeComplex &plaq, const std::vector<GaugeMat> &U, const int mu, const int nu) | ||||
|   { | ||||
|     GaugeMat sp(U[0]._grid); | ||||
|     dirPlaquette(sp,U,mu,nu); | ||||
|     plaq=trace(sp); | ||||
|   } | ||||
|   ////////////////////////////////////////////////// | ||||
|   // sum over all planes of plaquette | ||||
|   ////////////////////////////////////////////////// | ||||
|   static void sitePlaquette(LatticeComplex &Plaq,const std::vector<GaugeMat> &U) | ||||
|   { | ||||
|     LatticeComplex sitePlaq(U[0]._grid); | ||||
|     Plaq=zero; | ||||
|     for(int mu=1;mu<Nd;mu++){ | ||||
|       for(int nu=0;nu<mu;nu++){ | ||||
| 	traceDirPlaquette(sitePlaq,U,mu,nu); | ||||
| 	Plaq = Plaq + sitePlaq; | ||||
|       ////////////////////////////////////////////////// | ||||
|       // directed plaquette oriented in mu,nu plane | ||||
|       ////////////////////////////////////////////////// | ||||
|       static void dirPlaquette(GaugeMat &plaq,const std::vector<GaugeMat> &U, const int mu, const int nu) | ||||
|       { | ||||
| 	// Annoyingly, must use either scope resolution to find dependent base class,  | ||||
| 	// or this-> ; there is no "this" in a static method. This forces explicit Gimpl scope | ||||
| 	// resolution throughout the usage in this file, and rather defeats the purpose of deriving | ||||
| 	// from Gimpl. | ||||
| 	plaq= Gimpl::CovShiftBackward(U[mu],mu, | ||||
| 				      Gimpl::CovShiftBackward(U[nu],nu, | ||||
| 							      Gimpl::CovShiftForward (U[mu],mu,U[nu]))); | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|   ////////////////////////////////////////////////// | ||||
|   // sum over all x,y,z,t and over all planes of plaquette | ||||
|   ////////////////////////////////////////////////// | ||||
|   static RealD sumPlaquette(const GaugeLorentz &Umu){ | ||||
|     std::vector<GaugeMat> U(4,Umu._grid); | ||||
|  | ||||
|     for(int mu=0;mu<Nd;mu++){ | ||||
|       U[mu] = PeekIndex<LorentzIndex>(Umu,mu); | ||||
|     } | ||||
|  | ||||
|     LatticeComplex Plaq(Umu._grid); | ||||
|      | ||||
|     sitePlaquette(Plaq,U); | ||||
|      | ||||
|     TComplex Tp = sum(Plaq); | ||||
|     Complex p  = TensorRemove(Tp); | ||||
|     return p.real(); | ||||
|   } | ||||
|   ////////////////////////////////////////////////// | ||||
|   // average over all x,y,z,t and over all planes of plaquette | ||||
|   ////////////////////////////////////////////////// | ||||
|   static RealD avgPlaquette(const GaugeLorentz &Umu){ | ||||
|  | ||||
|     RealD sumplaq = sumPlaquette(Umu); | ||||
|      | ||||
|     double vol = Umu._grid->gSites(); | ||||
|      | ||||
|     double faces = (1.0*Nd*(Nd-1))/2.0; | ||||
|      | ||||
|     return sumplaq/vol/faces/Nc; // Nd , Nc dependent... FIXME | ||||
|   } | ||||
|   static RealD linkTrace(const GaugeLorentz &Umu){ | ||||
|     std::vector<GaugeMat> U(4,Umu._grid); | ||||
|  | ||||
|     LatticeComplex Tr(Umu._grid); Tr=zero; | ||||
|     for(int mu=0;mu<Nd;mu++){ | ||||
|       U[mu] = PeekIndex<LorentzIndex>(Umu,mu); | ||||
|       Tr = Tr+trace(U[mu]); | ||||
|     } | ||||
|      | ||||
|     TComplex Tp = sum(Tr); | ||||
|     Complex p  = TensorRemove(Tp); | ||||
|  | ||||
|     double vol = Umu._grid->gSites(); | ||||
|  | ||||
|     return p.real()/vol/4.0/3.0; | ||||
|   }; | ||||
|   ////////////////////////////////////////////////// | ||||
|   // the sum over all staples on each site | ||||
|   ////////////////////////////////////////////////// | ||||
|   static void Staple(GaugeMat &staple,const GaugeLorentz &Umu,int mu){ | ||||
|  | ||||
|     GridBase *grid = Umu._grid; | ||||
|  | ||||
|     std::vector<GaugeMat> U(4,grid); | ||||
|     for(int d=0;d<Nd;d++){ | ||||
|       U[d] = PeekIndex<LorentzIndex>(Umu,d); | ||||
|     } | ||||
|     staple = zero; | ||||
|     GaugeMat tmp(grid); | ||||
|  | ||||
|      | ||||
|     for(int nu=0;nu<Nd;nu++){ | ||||
|  | ||||
|       if(nu != mu) { | ||||
|  | ||||
|       // mu | ||||
|       // ^ | ||||
|       // |__>  nu | ||||
|  | ||||
|       //    __  | ||||
|       //      | | ||||
|       //    __| | ||||
|       // | ||||
|  | ||||
| 	staple+=Gimpl::ShiftStaple( | ||||
| 	        Gimpl::CovShiftForward (U[nu],nu,  | ||||
| 		Gimpl::CovShiftBackward(U[mu],mu, | ||||
| 		Gimpl::CovShiftIdentityBackward(U[nu],nu))),mu); | ||||
|  | ||||
|       //  __  | ||||
|       // |    | ||||
|       // |__  | ||||
|       // | ||||
|       // | ||||
| 	staple+=Gimpl::ShiftStaple(   | ||||
|                 Gimpl::CovShiftBackward(U[nu],nu,		  		   | ||||
| 		Gimpl::CovShiftBackward(U[mu],mu,U[nu])),mu); | ||||
|       ////////////////////////////////////////////////// | ||||
|       // trace of directed plaquette oriented in mu,nu plane | ||||
|       ////////////////////////////////////////////////// | ||||
|       static void traceDirPlaquette(LatticeComplex &plaq, const std::vector<GaugeMat> &U, const int mu, const int nu) | ||||
|       { | ||||
| 	GaugeMat sp(U[0]._grid); | ||||
| 	dirPlaquette(sp,U,mu,nu); | ||||
| 	plaq=trace(sp); | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|       ////////////////////////////////////////////////// | ||||
|       // sum over all planes of plaquette | ||||
|       ////////////////////////////////////////////////// | ||||
|       static void sitePlaquette(LatticeComplex &Plaq,const std::vector<GaugeMat> &U) | ||||
|       { | ||||
| 	LatticeComplex sitePlaq(U[0]._grid); | ||||
| 	Plaq=zero; | ||||
| 	for(int mu=1;mu<Nd;mu++){ | ||||
| 	  for(int nu=0;nu<mu;nu++){ | ||||
| 	    traceDirPlaquette(sitePlaq,U,mu,nu); | ||||
| 	    Plaq = Plaq + sitePlaq; | ||||
| 	  } | ||||
| 	} | ||||
|       } | ||||
|       ////////////////////////////////////////////////// | ||||
|       // sum over all x,y,z,t and over all planes of plaquette | ||||
|       ////////////////////////////////////////////////// | ||||
|       static RealD sumPlaquette(const GaugeLorentz &Umu){ | ||||
| 	std::vector<GaugeMat> U(4,Umu._grid); | ||||
| 	 | ||||
|   ////////////////////////////////////////////////// | ||||
|   // the sum over all staples on each site in direction mu,nu | ||||
|   ////////////////////////////////////////////////// | ||||
|   static void Staple(GaugeMat &staple,const GaugeLorentz &Umu,int mu, in nu){ | ||||
| 	for(int mu=0;mu<Nd;mu++){ | ||||
| 	  U[mu] = PeekIndex<LorentzIndex>(Umu,mu); | ||||
| 	} | ||||
| 	 | ||||
|     GridBase *grid = Umu._grid; | ||||
| 	LatticeComplex Plaq(Umu._grid); | ||||
| 	 | ||||
|     std::vector<GaugeMat> U(4,grid); | ||||
|     for(int d=0;d<Nd;d++){ | ||||
|       U[d] = PeekIndex<LorentzIndex>(Umu,d); | ||||
|     } | ||||
|     staple = zero; | ||||
|     GaugeMat tmp(grid); | ||||
| 	sitePlaquette(Plaq,U); | ||||
| 	 | ||||
| 	TComplex Tp = sum(Plaq); | ||||
| 	Complex p  = TensorRemove(Tp); | ||||
| 	return p.real(); | ||||
|       } | ||||
|       ////////////////////////////////////////////////// | ||||
|       // average over all x,y,z,t and over all planes of plaquette | ||||
|       ////////////////////////////////////////////////// | ||||
|       static RealD avgPlaquette(const GaugeLorentz &Umu){ | ||||
| 	 | ||||
| 	RealD sumplaq = sumPlaquette(Umu); | ||||
| 	 | ||||
| 	double vol = Umu._grid->gSites(); | ||||
| 	 | ||||
| 	double faces = (1.0*Nd*(Nd-1))/2.0; | ||||
| 	 | ||||
| 	return sumplaq/vol/faces/Nc; // Nd , Nc dependent... FIXME | ||||
|       } | ||||
|       static RealD linkTrace(const GaugeLorentz &Umu){ | ||||
| 	std::vector<GaugeMat> U(4,Umu._grid); | ||||
| 	 | ||||
| 	LatticeComplex Tr(Umu._grid); Tr=zero; | ||||
| 	for(int mu=0;mu<Nd;mu++){ | ||||
| 	  U[mu] = PeekIndex<LorentzIndex>(Umu,mu); | ||||
| 	  Tr = Tr+trace(U[mu]); | ||||
| 	} | ||||
| 	 | ||||
| 	TComplex Tp = sum(Tr); | ||||
| 	Complex p  = TensorRemove(Tp); | ||||
| 	 | ||||
| 	double vol = Umu._grid->gSites(); | ||||
| 	 | ||||
| 	return p.real()/vol/4.0/3.0; | ||||
|       }; | ||||
|       ////////////////////////////////////////////////// | ||||
|       // the sum over all staples on each site | ||||
|       ////////////////////////////////////////////////// | ||||
|       static void Staple(GaugeMat &staple,const GaugeLorentz &Umu,int mu){ | ||||
| 	 | ||||
| 	GridBase *grid = Umu._grid; | ||||
| 	 | ||||
| 	std::vector<GaugeMat> U(4,grid); | ||||
| 	for(int d=0;d<Nd;d++){ | ||||
| 	  U[d] = PeekIndex<LorentzIndex>(Umu,d); | ||||
| 	} | ||||
| 	staple = zero; | ||||
| 		 | ||||
| 	 | ||||
|     if(nu != mu) { | ||||
| 	for(int nu=0;nu<Nd;nu++){ | ||||
| 	   | ||||
|       // mu | ||||
|       // ^ | ||||
|       // |__>  nu | ||||
| 	  if(nu != mu) { | ||||
| 	     | ||||
|       //    __  | ||||
|       //      | | ||||
|       //    __| | ||||
|       // | ||||
| 	    // mu | ||||
| 	    // ^ | ||||
| 	    // |__>  nu | ||||
| 	     | ||||
| 	staple+=Gimpl::ShiftStaple( | ||||
| 	        Gimpl::CovShiftForward (U[nu],nu,  | ||||
| 		Gimpl::CovShiftBackward(U[mu],mu, | ||||
| 		Gimpl::CovShiftIdentityBackward(U[nu],nu))),mu); | ||||
| 	    //    __  | ||||
| 	    //      | | ||||
| 	    //    __| | ||||
| 	    // | ||||
| 	     | ||||
|       //  __  | ||||
|       // |    | ||||
|       // |__  | ||||
|       // | ||||
|       // | ||||
| 	staple+=Gimpl::ShiftStaple(   | ||||
|                 Gimpl::CovShiftBackward(U[nu],nu,		  		   | ||||
| 		Gimpl::CovShiftBackward(U[mu],mu,U[nu])),mu); | ||||
| 	    staple+=Gimpl::ShiftStaple(Gimpl::CovShiftForward (U[nu],nu,  | ||||
| 							       Gimpl::CovShiftBackward(U[mu],mu, | ||||
| 										       Gimpl::CovShiftIdentityBackward(U[nu],nu))),mu); | ||||
| 	     | ||||
|     } | ||||
|   } | ||||
| 	    //  __  | ||||
| 	    // |    | ||||
| 	    // |__  | ||||
| 	    // | ||||
| 	    // | ||||
| 	    staple+=Gimpl::ShiftStaple(Gimpl::CovShiftBackward(U[nu],nu,		  		   | ||||
| 							       Gimpl::CovShiftBackward(U[mu],mu,U[nu])),mu); | ||||
| 	  } | ||||
| 	} | ||||
|       } | ||||
|        | ||||
|       ////////////////////////////////////////////////// | ||||
|       // the sum over all staples on each site in direction mu,nu | ||||
|       ////////////////////////////////////////////////// | ||||
|       static void Staple(GaugeMat &staple,const GaugeLorentz &Umu,int mu, int nu){ | ||||
|  | ||||
| 	GridBase *grid = Umu._grid; | ||||
| 	 | ||||
| 	std::vector<GaugeMat> U(4,grid); | ||||
| 	for(int d=0;d<Nd;d++){ | ||||
| 	  U[d] = PeekIndex<LorentzIndex>(Umu,d); | ||||
| 	} | ||||
| 	staple = zero; | ||||
| 	 | ||||
| 	 | ||||
|   ////////////////////////////////////////////////// | ||||
|   // the sum over all staples on each site in direction mu,nu, upper part | ||||
|   ////////////////////////////////////////////////// | ||||
|   static void StapleUpper(GaugeMat &staple,const GaugeLorentz &Umu,int mu, in nu){ | ||||
| 	if(nu != mu) { | ||||
| 	   | ||||
|     GridBase *grid = Umu._grid; | ||||
| 	  // mu | ||||
| 	  // ^ | ||||
| 	  // |__>  nu | ||||
| 	   | ||||
|     std::vector<GaugeMat> U(4,grid); | ||||
|     for(int d=0;d<Nd;d++){ | ||||
|       U[d] = PeekIndex<LorentzIndex>(Umu,d); | ||||
|     } | ||||
|     staple = zero; | ||||
|     GaugeMat tmp(grid); | ||||
| 	  //    __  | ||||
| 	  //      | | ||||
| 	  //    __| | ||||
| 	  // | ||||
|  | ||||
| 	  staple+=Gimpl::ShiftStaple( | ||||
| 				     Gimpl::CovShiftForward (U[nu],nu,  | ||||
| 							     Gimpl::CovShiftBackward(U[mu],mu, | ||||
| 										     Gimpl::CovShiftIdentityBackward(U[nu],nu))),mu); | ||||
|  | ||||
| 	  //  __  | ||||
| 	  // |    | ||||
| 	  // |__  | ||||
| 	  // | ||||
| 	  // | ||||
| 	  staple+=Gimpl::ShiftStaple(   | ||||
| 				     Gimpl::CovShiftBackward(U[nu],nu,		  		   | ||||
| 							     Gimpl::CovShiftBackward(U[mu],mu,U[nu])),mu); | ||||
|        | ||||
| 	} | ||||
|       } | ||||
|  | ||||
|  | ||||
|     if(nu != mu) { | ||||
|       ////////////////////////////////////////////////// | ||||
|       // the sum over all staples on each site in direction mu,nu, upper part | ||||
|       ////////////////////////////////////////////////// | ||||
|       static void StapleUpper(GaugeMat &staple,const GaugeLorentz &Umu,int mu, int nu){ | ||||
|  | ||||
|       // mu | ||||
|       // ^ | ||||
|       // |__>  nu | ||||
| 	GridBase *grid = Umu._grid; | ||||
|  | ||||
|       //    __  | ||||
|       //      | | ||||
|       //    __| | ||||
|       // | ||||
| 	std::vector<GaugeMat> U(4,grid); | ||||
| 	for(int d=0;d<Nd;d++){ | ||||
| 	  U[d] = PeekIndex<LorentzIndex>(Umu,d); | ||||
| 	} | ||||
| 	staple = zero; | ||||
|  | ||||
| 	staple+=Gimpl::ShiftStaple( | ||||
| 	        Gimpl::CovShiftForward (U[nu],nu,  | ||||
| 		Gimpl::CovShiftBackward(U[mu],mu, | ||||
| 		Gimpl::CovShiftIdentityBackward(U[nu],nu))),mu); | ||||
|  | ||||
|      } | ||||
|   } | ||||
|      | ||||
| 	if(nu != mu) { | ||||
|        | ||||
| 	  // mu | ||||
| 	  // ^ | ||||
| 	  // |__>  nu | ||||
|        | ||||
| 	  //    __  | ||||
| 	  //      | | ||||
| 	  //    __| | ||||
| 	  // | ||||
|  | ||||
| 	  staple+=Gimpl::ShiftStaple( | ||||
| 				     Gimpl::CovShiftForward (U[nu],nu,  | ||||
| 							     Gimpl::CovShiftBackward(U[mu],mu, | ||||
| 										     Gimpl::CovShiftIdentityBackward(U[nu],nu))),mu); | ||||
|  | ||||
| 	} | ||||
|       } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|   ////////////////////////////////////////////////////// | ||||
|   // Similar to above for rectangle is required | ||||
|   ////////////////////////////////////////////////////// | ||||
|   static void dirRectangle(GaugeMat &rect,const std::vector<GaugeMat> &U, const int mu, const int nu) | ||||
|   { | ||||
|     rect =  Gimpl::CovShiftForward(U[mu],mu,Gimpl::CovShiftForward(U[mu],mu,U[nu]))* // ->->| | ||||
| 	adj(Gimpl::CovShiftForward(U[nu],nu,Gimpl::CovShiftForward(U[mu],mu,U[mu]))) ; | ||||
|     rect = rect +  | ||||
|       ////////////////////////////////////////////////////// | ||||
|       // Similar to above for rectangle is required | ||||
|       ////////////////////////////////////////////////////// | ||||
|       static void dirRectangle(GaugeMat &rect,const std::vector<GaugeMat> &U, const int mu, const int nu) | ||||
|       { | ||||
| 	rect =  Gimpl::CovShiftForward(U[mu],mu,Gimpl::CovShiftForward(U[mu],mu,U[nu]))* // ->->| | ||||
| 	  adj(Gimpl::CovShiftForward(U[nu],nu,Gimpl::CovShiftForward(U[mu],mu,U[mu]))) ; | ||||
| 	rect = rect +  | ||||
|           Gimpl::CovShiftForward(U[mu],mu,Gimpl::CovShiftForward(U[nu],nu,U[nu]))* // ->|| | ||||
|       adj(Gimpl::CovShiftForward(U[nu],nu,Gimpl::CovShiftForward(U[nu],nu,U[mu]))) ; | ||||
|   } | ||||
|   static void traceDirRectangle(LatticeComplex &rect, const std::vector<GaugeMat> &U, const int mu, const int nu) | ||||
|   { | ||||
|     GaugeMat sp(U[0]._grid); | ||||
|     dirRectangle(sp,U,mu,nu); | ||||
|     rect=trace(sp); | ||||
|   } | ||||
|   static void siteRectangle(LatticeComplex &Rect,const std::vector<GaugeMat> &U) | ||||
|   { | ||||
|     LatticeComplex siteRect(U[0]._grid); | ||||
|     Rect=zero; | ||||
|     for(int mu=1;mu<Nd;mu++){ | ||||
|       for(int nu=0;nu<mu;nu++){ | ||||
| 	traceDirRectangle(siteRect,U,mu,nu); | ||||
| 	Rect = Rect + siteRect; | ||||
| 	  adj(Gimpl::CovShiftForward(U[nu],nu,Gimpl::CovShiftForward(U[nu],nu,U[mu]))) ; | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|   ////////////////////////////////////////////////// | ||||
|   // sum over all x,y,z,t and over all planes of plaquette | ||||
|   ////////////////////////////////////////////////// | ||||
|   static RealD sumRectangle(const GaugeLorentz &Umu){ | ||||
|     std::vector<GaugeMat> U(4,Umu._grid); | ||||
|       static void traceDirRectangle(LatticeComplex &rect, const std::vector<GaugeMat> &U, const int mu, const int nu) | ||||
|       { | ||||
| 	GaugeMat sp(U[0]._grid); | ||||
| 	dirRectangle(sp,U,mu,nu); | ||||
| 	rect=trace(sp); | ||||
|       } | ||||
|       static void siteRectangle(LatticeComplex &Rect,const std::vector<GaugeMat> &U) | ||||
|       { | ||||
| 	LatticeComplex siteRect(U[0]._grid); | ||||
| 	Rect=zero; | ||||
| 	for(int mu=1;mu<Nd;mu++){ | ||||
| 	  for(int nu=0;nu<mu;nu++){ | ||||
| 	    traceDirRectangle(siteRect,U,mu,nu); | ||||
| 	    Rect = Rect + siteRect; | ||||
| 	  } | ||||
| 	} | ||||
|       } | ||||
|       ////////////////////////////////////////////////// | ||||
|       // sum over all x,y,z,t and over all planes of plaquette | ||||
|       ////////////////////////////////////////////////// | ||||
|       static RealD sumRectangle(const GaugeLorentz &Umu){ | ||||
| 	std::vector<GaugeMat> U(4,Umu._grid); | ||||
|  | ||||
|     for(int mu=0;mu<Nd;mu++){ | ||||
|       U[mu] = PeekIndex<LorentzIndex>(Umu,mu); | ||||
|     } | ||||
| 	for(int mu=0;mu<Nd;mu++){ | ||||
| 	  U[mu] = PeekIndex<LorentzIndex>(Umu,mu); | ||||
| 	} | ||||
|  | ||||
|     LatticeComplex Rect(Umu._grid); | ||||
| 	LatticeComplex Rect(Umu._grid); | ||||
|      | ||||
|     siteRectangle(Rect,U); | ||||
| 	siteRectangle(Rect,U); | ||||
|      | ||||
|     TComplex Tp = sum(Rect); | ||||
|     Complex p  = TensorRemove(Tp); | ||||
|     return p.real(); | ||||
|   } | ||||
|   ////////////////////////////////////////////////// | ||||
|   // average over all x,y,z,t and over all planes of plaquette | ||||
|   ////////////////////////////////////////////////// | ||||
|   static RealD avgRectangle(const GaugeLorentz &Umu){ | ||||
| 	TComplex Tp = sum(Rect); | ||||
| 	Complex p  = TensorRemove(Tp); | ||||
| 	return p.real(); | ||||
|       } | ||||
|       ////////////////////////////////////////////////// | ||||
|       // average over all x,y,z,t and over all planes of plaquette | ||||
|       ////////////////////////////////////////////////// | ||||
|       static RealD avgRectangle(const GaugeLorentz &Umu){ | ||||
|  | ||||
|     RealD sumrect = sumRectangle(Umu); | ||||
| 	RealD sumrect = sumRectangle(Umu); | ||||
|      | ||||
|     double vol = Umu._grid->gSites(); | ||||
| 	double vol = Umu._grid->gSites(); | ||||
|      | ||||
|     double faces = (1.0*Nd*(Nd-1)); // 2 distinct orientations summed | ||||
| 	double faces = (1.0*Nd*(Nd-1)); // 2 distinct orientations summed | ||||
|      | ||||
|     return sumrect/vol/faces/Nc; // Nd , Nc dependent... FIXME | ||||
|   } | ||||
| 	return sumrect/vol/faces/Nc; // Nd , Nc dependent... FIXME | ||||
|       } | ||||
|  | ||||
|   ////////////////////////////////////////////////// | ||||
|   // the sum over all staples on each site | ||||
|   ////////////////////////////////////////////////// | ||||
|   static void RectStapleDouble(GaugeMat &U2,const GaugeMat & U,int mu){ | ||||
|     U2 = U * Cshift(U,mu,1); | ||||
|   } | ||||
|       ////////////////////////////////////////////////// | ||||
|       // the sum over all staples on each site | ||||
|       ////////////////////////////////////////////////// | ||||
|       static void RectStapleDouble(GaugeMat &U2,const GaugeMat & U,int mu){ | ||||
| 	U2 = U * Cshift(U,mu,1); | ||||
|       } | ||||
|  | ||||
|   //////////////////////////////////////////////////////////////////////////// | ||||
|   // Hop by two optimisation strategy does not work nicely with Gparity. (could do, | ||||
|   // but need to track two deep where cross boundary and apply a conjugation). | ||||
|   // Must differentiate this in Gimpl, and use Gimpl::isPeriodicGaugeField to do so . | ||||
|   //////////////////////////////////////////////////////////////////////////// | ||||
|   static void RectStapleOptimised(GaugeMat &Stap,std::vector<GaugeMat> &U2,std::vector<GaugeMat> &U,int mu){ | ||||
|       //////////////////////////////////////////////////////////////////////////// | ||||
|       // Hop by two optimisation strategy does not work nicely with Gparity. (could do, | ||||
|       // but need to track two deep where cross boundary and apply a conjugation). | ||||
|       // Must differentiate this in Gimpl, and use Gimpl::isPeriodicGaugeField to do so . | ||||
|       //////////////////////////////////////////////////////////////////////////// | ||||
|       static void RectStapleOptimised(GaugeMat &Stap,std::vector<GaugeMat> &U2,std::vector<GaugeMat> &U,int mu){ | ||||
|  | ||||
|     Stap = zero; | ||||
| 	Stap = zero; | ||||
|  | ||||
|     GridBase *grid = U[0]._grid; | ||||
| 	GridBase *grid = U[0]._grid; | ||||
|  | ||||
|     GaugeMat Staple2x1 (grid); | ||||
|     GaugeMat tmp (grid); | ||||
| 	GaugeMat Staple2x1 (grid); | ||||
| 	GaugeMat tmp (grid); | ||||
|  | ||||
|     for(int nu=0;nu<Nd;nu++){ | ||||
|       if ( nu!=mu) { | ||||
| 	for(int nu=0;nu<Nd;nu++){ | ||||
| 	  if ( nu!=mu) { | ||||
|  | ||||
| 	// Up staple    ___ ___  | ||||
| 	//             |       | | ||||
| 	tmp = Cshift(adj(U[nu]),nu,-1);  | ||||
| 	tmp = adj(U2[mu])*tmp; | ||||
| 	tmp = Cshift(tmp,mu,-2); | ||||
| 	    // Up staple    ___ ___  | ||||
| 	    //             |       | | ||||
| 	    tmp = Cshift(adj(U[nu]),nu,-1);  | ||||
| 	    tmp = adj(U2[mu])*tmp; | ||||
| 	    tmp = Cshift(tmp,mu,-2); | ||||
|  | ||||
| 	Staple2x1 = Gimpl::CovShiftForward (U[nu],nu,tmp); | ||||
| 	    Staple2x1 = Gimpl::CovShiftForward (U[nu],nu,tmp); | ||||
|  | ||||
|  | ||||
| 	// Down staple | ||||
| 	//             |___ ___| | ||||
| 	// | ||||
| 	tmp = adj(U2[mu])*U[nu]; | ||||
| 	Staple2x1+= Gimpl::CovShiftBackward(U[nu],nu,Cshift(tmp,mu,-2)); | ||||
| 	    // Down staple | ||||
| 	    //             |___ ___| | ||||
| 	    // | ||||
| 	    tmp = adj(U2[mu])*U[nu]; | ||||
| 	    Staple2x1+= Gimpl::CovShiftBackward(U[nu],nu,Cshift(tmp,mu,-2)); | ||||
|  | ||||
|  | ||||
| 	//              ___ ___ | ||||
| 	//             |    ___| | ||||
| 	//             |___ ___| | ||||
| 	// | ||||
| 	    //              ___ ___ | ||||
| 	    //             |    ___| | ||||
| 	    //             |___ ___| | ||||
| 	    // | ||||
|  | ||||
| 	Stap+= Cshift(Gimpl::CovShiftForward (U[mu],mu,Staple2x1),mu,1); | ||||
| 	    Stap+= Cshift(Gimpl::CovShiftForward (U[mu],mu,Staple2x1),mu,1); | ||||
|  | ||||
| 	//              ___ ___ | ||||
| 	//             |___    | | ||||
| 	//             |___ ___| | ||||
| 	// | ||||
| 	    //              ___ ___ | ||||
| 	    //             |___    | | ||||
| 	    //             |___ ___| | ||||
| 	    // | ||||
|  | ||||
| 	//	tmp= Staple2x1* Cshift(U[mu],mu,-2); | ||||
| 	//	Stap+= Cshift(tmp,mu,1) ; | ||||
| 	Stap+= Cshift(Staple2x1,mu,1)*Cshift(U[mu],mu,-1); ; | ||||
| 	    //	tmp= Staple2x1* Cshift(U[mu],mu,-2); | ||||
| 	    //	Stap+= Cshift(tmp,mu,1) ; | ||||
| 	    Stap+= Cshift(Staple2x1,mu,1)*Cshift(U[mu],mu,-1); ; | ||||
|  | ||||
| 	//       --     | ||||
| 	//      |  |               | ||||
| 	//           | ||||
| 	//      |  |  | ||||
| 	    //       --     | ||||
| 	    //      |  |               | ||||
| 	    //           | ||||
| 	    //      |  |  | ||||
| 	 | ||||
| 	tmp = Cshift(adj(U2[nu]),nu,-2); | ||||
| 	tmp = Gimpl::CovShiftBackward(U[mu],mu,tmp); | ||||
| 	tmp = U2[nu]*Cshift(tmp,nu,2); | ||||
| 	Stap+= Cshift(tmp, mu, 1); | ||||
| 	    tmp = Cshift(adj(U2[nu]),nu,-2); | ||||
| 	    tmp = Gimpl::CovShiftBackward(U[mu],mu,tmp); | ||||
| 	    tmp = U2[nu]*Cshift(tmp,nu,2); | ||||
| 	    Stap+= Cshift(tmp, mu, 1); | ||||
|  | ||||
| 	//      |  |               | ||||
| 	//           | ||||
| 	//      |  |  | ||||
| 	//       --  | ||||
| 	    //      |  |               | ||||
| 	    //           | ||||
| 	    //      |  |  | ||||
| 	    //       --  | ||||
| 	 | ||||
| 	tmp = Gimpl::CovShiftBackward(U[mu],mu,U2[nu]); | ||||
| 	tmp = adj(U2[nu])*tmp; | ||||
| 	tmp = Cshift(tmp,nu,-2); | ||||
| 	Stap+=Cshift(tmp, mu, 1); | ||||
|     }} | ||||
| 	    tmp = Gimpl::CovShiftBackward(U[mu],mu,U2[nu]); | ||||
| 	    tmp = adj(U2[nu])*tmp; | ||||
| 	    tmp = Cshift(tmp,nu,-2); | ||||
| 	    Stap+=Cshift(tmp, mu, 1); | ||||
| 	  }} | ||||
|  | ||||
|  | ||||
|   } | ||||
|       } | ||||
|  | ||||
|   static void RectStaple(GaugeMat &Stap,const GaugeLorentz & Umu,int mu) | ||||
|   { | ||||
|     RectStapleUnoptimised(Stap,Umu,mu); | ||||
|   } | ||||
|   static void RectStaple(const GaugeLorentz & Umu,GaugeMat &Stap, | ||||
| 			 std::vector<GaugeMat> &U2, | ||||
| 			 std::vector<GaugeMat> &U, int mu) | ||||
|   { | ||||
|     if ( Gimpl::isPeriodicGaugeField() ){  | ||||
|       RectStapleOptimised(Stap,U2,U,mu); | ||||
|     } else { | ||||
|       RectStapleUnoptimised(Stap,Umu,mu); | ||||
|     } | ||||
|   } | ||||
|       static void RectStaple(GaugeMat &Stap,const GaugeLorentz & Umu,int mu) | ||||
|       { | ||||
| 	RectStapleUnoptimised(Stap,Umu,mu); | ||||
|       } | ||||
|       static void RectStaple(const GaugeLorentz & Umu,GaugeMat &Stap, | ||||
| 			     std::vector<GaugeMat> &U2, | ||||
| 			     std::vector<GaugeMat> &U, int mu) | ||||
|       { | ||||
| 	if ( Gimpl::isPeriodicGaugeField() ){  | ||||
| 	  RectStapleOptimised(Stap,U2,U,mu); | ||||
| 	} else { | ||||
| 	  RectStapleUnoptimised(Stap,Umu,mu); | ||||
| 	} | ||||
|       } | ||||
|  | ||||
|   static void RectStapleUnoptimised(GaugeMat &Stap,const GaugeLorentz &Umu,int mu){ | ||||
|     GridBase *grid = Umu._grid; | ||||
|       static void RectStapleUnoptimised(GaugeMat &Stap,const GaugeLorentz &Umu,int mu){ | ||||
| 	GridBase *grid = Umu._grid; | ||||
|  | ||||
|     std::vector<GaugeMat> U(4,grid); | ||||
|     for(int d=0;d<Nd;d++){ | ||||
|       U[d] = PeekIndex<LorentzIndex>(Umu,d); | ||||
|     } | ||||
| 	std::vector<GaugeMat> U(4,grid); | ||||
| 	for(int d=0;d<Nd;d++){ | ||||
| 	  U[d] = PeekIndex<LorentzIndex>(Umu,d); | ||||
| 	} | ||||
|  | ||||
|     Stap=zero; | ||||
| 	Stap=zero; | ||||
|  | ||||
|     for(int nu=0;nu<Nd;nu++){ | ||||
|       if ( nu!=mu) { | ||||
|     //           __ ___  | ||||
|     //          |    __ | | ||||
|     // | ||||
|     Stap+= Gimpl::ShiftStaple( | ||||
| 		  Gimpl::CovShiftForward (U[mu],mu, | ||||
| 		  Gimpl::CovShiftForward (U[nu],nu, | ||||
| 		  Gimpl::CovShiftBackward(U[mu],mu, | ||||
|                   Gimpl::CovShiftBackward(U[mu],mu, | ||||
| 		  Gimpl::CovShiftIdentityBackward(U[nu],nu))))) , mu); | ||||
| 	for(int nu=0;nu<Nd;nu++){ | ||||
| 	  if ( nu!=mu) { | ||||
| 	    //           __ ___  | ||||
| 	    //          |    __ | | ||||
| 	    // | ||||
| 	    Stap+= Gimpl::ShiftStaple( | ||||
| 				      Gimpl::CovShiftForward (U[mu],mu, | ||||
| 							      Gimpl::CovShiftForward (U[nu],nu, | ||||
| 										      Gimpl::CovShiftBackward(U[mu],mu, | ||||
| 													      Gimpl::CovShiftBackward(U[mu],mu, | ||||
| 																      Gimpl::CovShiftIdentityBackward(U[nu],nu))))) , mu); | ||||
|  | ||||
|     //              __  | ||||
|     //          |__ __ | | ||||
| 	    //              __  | ||||
| 	    //          |__ __ | | ||||
|  | ||||
|     Stap+= Gimpl::ShiftStaple( | ||||
|                   Gimpl::CovShiftForward (U[mu],mu, | ||||
| 		  Gimpl::CovShiftBackward(U[nu],nu, | ||||
| 		  Gimpl::CovShiftBackward(U[mu],mu, | ||||
|                   Gimpl::CovShiftBackward(U[mu],mu, U[nu])))) , mu); | ||||
| 	    Stap+= Gimpl::ShiftStaple( | ||||
| 				      Gimpl::CovShiftForward (U[mu],mu, | ||||
| 							      Gimpl::CovShiftBackward(U[nu],nu, | ||||
| 										      Gimpl::CovShiftBackward(U[mu],mu, | ||||
| 													      Gimpl::CovShiftBackward(U[mu],mu, U[nu])))) , mu); | ||||
|  | ||||
|     //           __  | ||||
|     //          |__ __ | | ||||
| 	    //           __  | ||||
| 	    //          |__ __ | | ||||
|  | ||||
|     Stap+= Gimpl::ShiftStaple( | ||||
| 		  Gimpl::CovShiftBackward(U[nu],nu, | ||||
| 		  Gimpl::CovShiftBackward(U[mu],mu, | ||||
| 		  Gimpl::CovShiftBackward(U[mu],mu, | ||||
| 		  Gimpl::CovShiftForward(U[nu],nu,U[mu])))) , mu); | ||||
| 	    Stap+= Gimpl::ShiftStaple( | ||||
| 				      Gimpl::CovShiftBackward(U[nu],nu, | ||||
| 							      Gimpl::CovShiftBackward(U[mu],mu, | ||||
| 										      Gimpl::CovShiftBackward(U[mu],mu, | ||||
| 													      Gimpl::CovShiftForward(U[nu],nu,U[mu])))) , mu); | ||||
|  | ||||
|     //           __ ___  | ||||
|     //          |__    | | ||||
| 	    //           __ ___  | ||||
| 	    //          |__    | | ||||
|  | ||||
|     Stap+= Gimpl::ShiftStaple( | ||||
| 		   Gimpl::CovShiftForward (U[nu],nu, | ||||
| 	           Gimpl::CovShiftBackward(U[mu],mu, | ||||
|                    Gimpl::CovShiftBackward(U[mu],mu, | ||||
|                    Gimpl::CovShiftBackward(U[nu],nu,U[mu])))) , mu); | ||||
| 	    Stap+= Gimpl::ShiftStaple( | ||||
| 				      Gimpl::CovShiftForward (U[nu],nu, | ||||
| 							      Gimpl::CovShiftBackward(U[mu],mu, | ||||
| 										      Gimpl::CovShiftBackward(U[mu],mu, | ||||
| 													      Gimpl::CovShiftBackward(U[nu],nu,U[mu])))) , mu); | ||||
|  | ||||
|      //       --     | ||||
|      //      |  |               | ||||
|      //           | ||||
|      //      |  |  | ||||
| 	    //       --     | ||||
| 	    //      |  |               | ||||
| 	    //           | ||||
| 	    //      |  |  | ||||
|       | ||||
|     Stap+= Gimpl::ShiftStaple( | ||||
| 		   Gimpl::CovShiftForward(U[nu],nu, | ||||
| 		   Gimpl::CovShiftForward(U[nu],nu, | ||||
|                    Gimpl::CovShiftBackward(U[mu],mu, | ||||
|                    Gimpl::CovShiftBackward(U[nu],nu, | ||||
| 		   Gimpl::CovShiftIdentityBackward(U[nu],nu))))) , mu); | ||||
| 	    Stap+= Gimpl::ShiftStaple( | ||||
| 				      Gimpl::CovShiftForward(U[nu],nu, | ||||
| 							     Gimpl::CovShiftForward(U[nu],nu, | ||||
| 										    Gimpl::CovShiftBackward(U[mu],mu, | ||||
| 													    Gimpl::CovShiftBackward(U[nu],nu, | ||||
| 																    Gimpl::CovShiftIdentityBackward(U[nu],nu))))) , mu); | ||||
|  | ||||
|  | ||||
|      //      |  |               | ||||
|      //           | ||||
|      //      |  |  | ||||
|      //       --  | ||||
| 	    //      |  |               | ||||
| 	    //           | ||||
| 	    //      |  |  | ||||
| 	    //       --  | ||||
|       | ||||
|     Stap+= Gimpl::ShiftStaple( | ||||
| 		   Gimpl::CovShiftBackward(U[nu],nu, | ||||
| 		   Gimpl::CovShiftBackward(U[nu],nu, | ||||
|                    Gimpl::CovShiftBackward(U[mu],mu, | ||||
|                    Gimpl::CovShiftForward (U[nu],nu,U[nu])))) , mu); | ||||
|     }} | ||||
|   } | ||||
| 	    Stap+= Gimpl::ShiftStaple( | ||||
| 				      Gimpl::CovShiftBackward(U[nu],nu, | ||||
| 							      Gimpl::CovShiftBackward(U[nu],nu, | ||||
| 										      Gimpl::CovShiftBackward(U[mu],mu, | ||||
| 													      Gimpl::CovShiftForward (U[nu],nu,U[nu])))) , mu); | ||||
| 	  }} | ||||
|       } | ||||
|  | ||||
|  | ||||
| }; | ||||
|     }; | ||||
|  | ||||
|  | ||||
|  typedef WilsonLoops<PeriodicGimplR> ColourWilsonLoops; | ||||
|  typedef WilsonLoops<PeriodicGimplR> U1WilsonLoops; | ||||
|  typedef WilsonLoops<PeriodicGimplR> SU2WilsonLoops; | ||||
|  typedef WilsonLoops<PeriodicGimplR> SU3WilsonLoops; | ||||
|     typedef WilsonLoops<PeriodicGimplR> ColourWilsonLoops; | ||||
|     typedef WilsonLoops<PeriodicGimplR> U1WilsonLoops; | ||||
|     typedef WilsonLoops<PeriodicGimplR> SU2WilsonLoops; | ||||
|     typedef WilsonLoops<PeriodicGimplR> SU3WilsonLoops; | ||||
|  | ||||
| }} | ||||
|   }} | ||||
|  | ||||
| #endif | ||||
|   | ||||
| @@ -517,6 +517,9 @@ namespace Grid { | ||||
|     return ret; | ||||
|   } | ||||
|  | ||||
|  | ||||
|  | ||||
|    | ||||
|   /////////////////////////////// | ||||
|   // Define available types | ||||
|   /////////////////////////////// | ||||
|   | ||||
| @@ -59,6 +59,18 @@ namespace Grid { | ||||
|     } | ||||
|   }; | ||||
|  | ||||
|   template<class scalar> struct AcosRealFunctor { | ||||
|     scalar operator()(const scalar &a)  const { | ||||
|       return acos(real(a)); | ||||
|     } | ||||
|   }; | ||||
|  | ||||
|   template<class scalar> struct AsinRealFunctor { | ||||
|     scalar operator()(const scalar &a)  const { | ||||
|       return asin(real(a)); | ||||
|     } | ||||
|   }; | ||||
|  | ||||
|   template<class scalar> struct LogRealFunctor { | ||||
|     scalar operator()(const scalar &a)  const { | ||||
|       return log(real(a)); | ||||
| @@ -146,6 +158,14 @@ namespace Grid { | ||||
|     return SimdApply(SinRealFunctor<S>(),r); | ||||
|   } | ||||
|   template < class S, class V >  | ||||
|   inline Grid_simd<S,V> acos(const Grid_simd<S,V> &r) { | ||||
|     return SimdApply(AcosRealFunctor<S>(),r); | ||||
|   } | ||||
|   template < class S, class V >  | ||||
|   inline Grid_simd<S,V> asin(const Grid_simd<S,V> &r) { | ||||
|     return SimdApply(AsinRealFunctor<S>(),r); | ||||
|   } | ||||
|   template < class S, class V >  | ||||
|   inline Grid_simd<S,V> log(const Grid_simd<S,V> &r) { | ||||
|     return SimdApply(LogRealFunctor<S>(),r); | ||||
|   } | ||||
|   | ||||
							
								
								
									
										4
									
								
								scripts/Make.inc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								scripts/Make.inc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
|  | ||||
| HFILES= | ||||
|  | ||||
| CCFILES= | ||||
| @@ -1,13 +1,5 @@ | ||||
|  | ||||
| bin_PROGRAMS = Test_GaugeAction Test_RectPlaq Test_cayley_cg Test_cayley_coarsen_support Test_cayley_even_odd Test_cayley_ldop_cr Test_cf_coarsen_support Test_cf_cr_unprec Test_cheby Test_contfrac_cg Test_contfrac_even_odd Test_contfrac_force Test_cshift Test_cshift_red_black Test_dwf_cg_prec Test_dwf_cg_schur Test_dwf_cg_unprec Test_dwf_cr_unprec Test_dwf_even_odd Test_dwf_force Test_dwf_fpgcr Test_dwf_gpforce Test_dwf_hdcr Test_dwf_lanczos Test_gamma Test_gp_rect_force Test_gparity Test_gpdwf_force Test_gpwilson_even_odd Test_hmc_EODWFRatio Test_hmc_EODWFRatio_Gparity Test_hmc_EOWilsonFermionGauge Test_hmc_EOWilsonRatio Test_hmc_GparityIwasakiGauge Test_hmc_GparityWilsonGauge Test_hmc_IwasakiGauge Test_hmc_RectGauge Test_hmc_WilsonFermionGauge Test_hmc_WilsonGauge Test_hmc_WilsonRatio Test_lie_generators Test_main Test_multishift_sqrt Test_nersc_io Test_partfrac_force Test_quenched_update Test_rect_force Test_remez Test_rhmc_EOWilson1p1 Test_rhmc_EOWilsonRatio Test_rhmc_Wilson1p1 Test_rhmc_WilsonRatio Test_rng Test_rng_fixed Test_serialisation Test_simd Test_stencil Test_synthetic_lanczos Test_wilson_cg_prec Test_wilson_cg_schur Test_wilson_cg_unprec Test_wilson_cr_unprec Test_wilson_even_odd Test_wilson_force Test_wilson_force_phiMdagMphi Test_wilson_force_phiMphi Test_wilson_tm_even_odd  | ||||
|  | ||||
|  | ||||
| Test_GaugeAction_SOURCES=Test_GaugeAction.cc | ||||
| Test_GaugeAction_LDADD=-lGrid | ||||
|  | ||||
|  | ||||
| Test_RectPlaq_SOURCES=Test_RectPlaq.cc | ||||
| Test_RectPlaq_LDADD=-lGrid | ||||
| bin_PROGRAMS = Test_cayley_cg Test_cayley_coarsen_support Test_cayley_even_odd Test_cayley_ldop_cr Test_cf_coarsen_support Test_cf_cr_unprec Test_cheby Test_contfrac_cg Test_contfrac_even_odd Test_contfrac_force Test_cshift Test_cshift_red_black Test_dwf_cg_prec Test_dwf_cg_schur Test_dwf_cg_unprec Test_dwf_cr_unprec Test_dwf_even_odd Test_dwf_force Test_dwf_fpgcr Test_dwf_gpforce Test_dwf_hdcr Test_dwf_lanczos Test_gamma Test_GaugeAction Test_gparity Test_gpdwf_force Test_gp_rect_force Test_gpwilson_even_odd Test_hmc_EODWFRatio Test_hmc_EODWFRatio_Gparity Test_hmc_EOWilsonFermionGauge Test_hmc_EOWilsonRatio Test_hmc_GparityIwasakiGauge Test_hmc_GparityWilsonGauge Test_hmc_IwasakiGauge Test_hmc_RectGauge Test_hmc_WilsonFermionGauge Test_hmc_WilsonGauge Test_hmc_WilsonRatio Test_lie_generators Test_main Test_multishift_sqrt Test_nersc_io Test_partfrac_force Test_quenched_update Test_rect_force Test_RectPlaq Test_remez Test_rhmc_EOWilson1p1 Test_rhmc_EOWilsonRatio Test_rhmc_Wilson1p1 Test_rhmc_WilsonRatio Test_rng Test_rng_fixed Test_serialisation Test_simd Test_stencil Test_synthetic_lanczos Test_wilson_cg_prec Test_wilson_cg_schur Test_wilson_cg_unprec Test_wilson_cr_unprec Test_wilson_even_odd Test_wilson_force Test_wilson_force_phiMdagMphi Test_wilson_force_phiMphi Test_wilson_tm_even_odd  | ||||
|  | ||||
|  | ||||
| Test_cayley_cg_SOURCES=Test_cayley_cg.cc | ||||
| @@ -102,8 +94,8 @@ Test_gamma_SOURCES=Test_gamma.cc | ||||
| Test_gamma_LDADD=-lGrid | ||||
|  | ||||
|  | ||||
| Test_gp_rect_force_SOURCES=Test_gp_rect_force.cc | ||||
| Test_gp_rect_force_LDADD=-lGrid | ||||
| Test_GaugeAction_SOURCES=Test_GaugeAction.cc | ||||
| Test_GaugeAction_LDADD=-lGrid | ||||
|  | ||||
|  | ||||
| Test_gparity_SOURCES=Test_gparity.cc | ||||
| @@ -114,6 +106,10 @@ Test_gpdwf_force_SOURCES=Test_gpdwf_force.cc | ||||
| Test_gpdwf_force_LDADD=-lGrid | ||||
|  | ||||
|  | ||||
| Test_gp_rect_force_SOURCES=Test_gp_rect_force.cc | ||||
| Test_gp_rect_force_LDADD=-lGrid | ||||
|  | ||||
|  | ||||
| Test_gpwilson_even_odd_SOURCES=Test_gpwilson_even_odd.cc | ||||
| Test_gpwilson_even_odd_LDADD=-lGrid | ||||
|  | ||||
| @@ -190,6 +186,10 @@ Test_rect_force_SOURCES=Test_rect_force.cc | ||||
| Test_rect_force_LDADD=-lGrid | ||||
|  | ||||
|  | ||||
| Test_RectPlaq_SOURCES=Test_RectPlaq.cc | ||||
| Test_RectPlaq_LDADD=-lGrid | ||||
|  | ||||
|  | ||||
| Test_remez_SOURCES=Test_remez.cc | ||||
| Test_remez_LDADD=-lGrid | ||||
|  | ||||
|   | ||||
| @@ -607,6 +607,11 @@ int main (int argc, char ** argv) | ||||
|  } // loop for omp | ||||
|  | ||||
|  | ||||
|  | ||||
|  // Testing Smearing routine compilation | ||||
|  Smear_APE< PeriodicGimplR > APEsmearing; // periodic gauge implemetation | ||||
|   | ||||
|   | ||||
|  std::cout<<GridLogMessage << sizeof(vComplexF) << std::endl; | ||||
|   | ||||
|  Grid_finalize(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user