CHROMA
hyp_smear.cc
Go to the documentation of this file.
1 // $Id: hyp_smear.cc,v 3.1 2006-08-11 16:13:30 edwards Exp $
2 /*! \file
3  * \brief Hyp-smearing of the gauge configuration
4  */
5 
6 #include "chromabase.h"
7 #include "meas/smear/hyp_smear.h"
8 #include "util/gauge/sun_proj.h"
9 
10 namespace Chroma
11 {
12  //! Construct the "hyp-smeared" links of Anna Hasenfratz
13  /*!
14  * \ingroup smear
15  *
16  * Construct the "hyp-smeared" links of Anna Hasenfratz, with
17  * staple coefficients alpha1, alpha2 and alpha3
18  *
19  * Arguments:
20  *
21  * \param u gauge field (Read)
22  * \param u_hyp "hyp-smeared" gauge field (Write)
23  * \param alpha1 staple coefficient "1" (Read)
24  * \param alpha2 staple coefficient "2" (Read)
25  * \param alpha3 staple coefficient "3" (Read)
26  * \param BlkAccu accuracy in SU(Nc) projection (Read)
27  * \param BlkMax max number of iterations in SU(Nc) projection (Read)
28  */
29 
30  void Hyp_Smear(const multi1d<LatticeColorMatrix>& u,
31  multi1d<LatticeColorMatrix>& u_hyp,
32  const Real& alpha1, const Real& alpha2, const Real& alpha3,
33  const Real& BlkAccu, int BlkMax)
34  {
35  multi1d<LatticeColorMatrix> u_lv1(Nd*(Nd-1));
36  multi1d<LatticeColorMatrix> u_lv2(Nd*(Nd-1));
37  LatticeColorMatrix u_tmp;
38  LatticeColorMatrix tmp_1;
39  Real ftmp1;
40  Real ftmp2;
41  int rho;
42  int sigma;
43  int ii;
44  int jj;
45  int kk;
46 
47  START_CODE();
48 
49  if (Nd > 4)
50  QDP_error_exit("Hyp-smearing only implemented for Nd<=4",Nd);
51 
52 
53  /*
54  * Construct "level 1" smeared links in mu-direction with
55  * staples only in one orthogonal direction, nu
56  */
57  ftmp1 = 1.0 - alpha3;
58  ftmp2 = alpha3 / 2;
59  ii = -1;
60  for(int mu = 0; mu < Nd; ++mu)
61  {
62  for(int nu = 0; nu < Nd; ++nu)
63  {
64  if(nu == mu) continue;
65 
66  ii++;
67  /*
68  * Forward staple
69  *
70  * u_tmp(x) = u(x,nu)*u(x+nu,mu)*u_dag(x+mu,nu)
71  */
72  u_tmp = u[nu] * shift(u[mu],FORWARD,nu) * adj(shift(u[nu],FORWARD,mu));
73 
74  /*
75  * Backward staple
76  *
77  * u_tmp(x) += u_dag(x-nu,nu)*u(x-nu,mu)*u(x-nu+mu,nu)
78  */
79  LatticeColorMatrix u_nu_tmp = shift(u[nu],FORWARD,mu);
80  u_tmp += shift(adj(u[nu]) * u[mu] * u_nu_tmp,BACKWARD,nu);
81 
82  /*
83  * Unprojected level 1 link
84  */
85  tmp_1 = ftmp1*u[mu] + ftmp2*u_tmp;
86  u_tmp = adj(tmp_1);
87 
88  /*
89  * Project onto SU(Nc)
90  */
91  if (Nd == 2)
92  {
93  u_hyp[mu] = u[mu];
94  sun_proj(u_tmp, u_hyp[mu], BlkAccu, BlkMax);
95  }
96  else
97  {
98  u_lv1[ii] = u[mu];
99  sun_proj(u_tmp, u_lv1[ii], BlkAccu, BlkMax);
100  }
101  }
102  }
103 
104  if (Nd == 3)
105  {
106  /*
107  * Construct hyp-smeared links in mu-direction with
108  * "level 1" staples in the orthogonal direction, nu,
109  * and the "level 1" links decorated in the 3-th orthogonal direction
110  */
111  ftmp1 = 1.0 - alpha2;
112  ftmp2 = alpha2 / 4;
113  for(int mu = 0; mu < Nd; ++mu)
114  {
115  u_tmp = 0;
116  for(int nu = 0; nu < Nd; ++nu)
117  {
118  if(nu == mu) continue;
119 
120  /* 3-th orthogonal direction: rho */
121  for(jj = 0; jj < Nd; ++jj)
122  {
123  if(jj != mu && jj != nu) rho = jj;
124  }
125  jj = (Nd-1)*mu + rho;
126  if(rho > mu ) jj--;
127  kk = (Nd-1)*nu + rho;
128  if(rho > nu ) kk--;
129 
130  /*
131  * Forward staple
132  *
133  * u_tmp(x) += u_lv1(x,kk)*u_lv1(x+nu,jj)*u_lv1_dag(x+mu,kk)
134  */
135  u_tmp += u_lv1[kk] * shift(u_lv1[jj],FORWARD,nu) * adj(shift(u_lv1[kk],FORWARD,mu));
136 
137  /*
138  * Backward staple
139  *
140  * u_tmp(x) += u_lv1_dag(x-nu,kk)*u_lv1(x-nu,jj)*u_lv1(x-nu+mu,kk)
141  */
142  LatticeColorMatrix u_lv1_tmp = shift(u_lv1[kk],FORWARD,mu);
143  u_tmp += shift(adj(u_lv1[kk]) * u_lv1[jj] * u_lv1_tmp , BACKWARD,nu);
144  }
145 
146  /*
147  * Unprojected hyp-smeared link
148  */
149  tmp_1 = ftmp1*u[mu] + ftmp2*u_tmp;
150  u_tmp = adj(tmp_1);
151 
152  /*
153  * Project onto SU(Nc)
154  */
155  u_hyp[mu] = u[mu];
156  sun_proj(u_tmp, u_hyp[mu], BlkAccu, BlkMax);
157  }
158  }
159  else if (Nd == 4)
160  {
161  /*
162  * Construct "level 2" smeared links in mu-direction with
163  * "level 1" staples not in the orthogonal direction, nu,
164  * and the "level 1" links decorated in the 4-th orthogonal direction
165  */
166  ftmp1 = 1.0 - alpha2;
167  ftmp2 = alpha2 / 4;
168  ii = -1;
169  for(int mu = 0; mu < Nd; ++mu)
170  {
171  for(int nu = 0; nu < Nd; ++nu)
172  {
173  if(nu == mu) continue;
174 
175  ii++;
176  u_tmp = 0;
177  for(rho = 0; rho < Nd; ++rho)
178  {
179  if(rho == mu || rho == nu) continue;
180 
181  /* 4-th orthogonal direction: sigma */
182  for(jj = 0; jj < Nd; ++jj)
183  {
184  if(jj != mu && jj != nu && jj != rho) sigma = jj;
185  }
186  jj = (Nd-1)*mu + sigma;
187  if(sigma > mu ) jj--;
188  kk = (Nd-1)*rho + sigma;
189  if(sigma > rho ) kk--;
190 
191  /*
192  * Forward staple
193  *
194  * u_tmp(x) += u_lv1(x,kk)*u_lv1(x+rho,jj)*u_lv1_dag(x+mu,kk)
195  */
196  u_tmp += u_lv1[kk] * shift(u_lv1[jj],FORWARD,rho) * adj(shift(u_lv1[kk],FORWARD,mu));
197 
198  /*
199  * Backward staple
200  *
201  * u_tmp(x) += u_lv1_dag(x-rho,kk)*u_lv1(x-rho,jj)*u_lv1(x-rho+mu,kk)
202  */
203  LatticeColorMatrix u_lv1_tmp = shift(u_lv1[kk],FORWARD,mu);
204  u_tmp += shift(adj(u_lv1[kk]) * u_lv1[jj] * u_lv1_tmp , BACKWARD,rho);
205  }
206 
207  /*
208  * Unprojected level 2 link
209  */
210  tmp_1 = ftmp1*u[mu] + ftmp2*u_tmp;
211  u_tmp = adj(tmp_1);
212 
213  /*
214  * Project onto SU(Nc)
215  */
216  u_lv2[ii] = u[mu];
217  sun_proj(u_tmp, u_lv2[ii], BlkAccu, BlkMax);
218  }
219  }
220 
221  /*
222  * Construct hyp-smeared links in mu-direction with
223  * "level 2" staples in the orthogonal direction, nu,
224  * and the "level 2" links not decorated in the mu and nu directions
225  */
226  ftmp1 = 1.0 - alpha1;
227  ftmp2 = alpha1 / 6;
228  for(int mu = 0; mu < Nd; ++mu)
229  {
230  u_tmp = 0;
231  for(int nu = 0; nu < Nd; ++nu)
232  {
233  if(nu == mu) continue;
234 
235  jj = (Nd-1)*mu + nu;
236  if(nu > mu ) jj--;
237  kk = (Nd-1)*nu + mu;
238  if(mu > nu ) kk--;
239 
240  /*
241  * Forward staple
242  *
243  * u_tmp(x) += u_lv2(x,kk)*u_lv2(x+nu,jj)*u_lv2_dag(x+mu,kk)
244  */
245  u_tmp += u_lv2[kk] * shift(u_lv2[jj],FORWARD,nu) * adj(shift(u_lv2[kk],FORWARD,mu));
246 
247  /*
248  * Backward staple
249  *
250  * u_tmp(x) += u_lv2_dag(x-nu,kk)*u_lv2(x-nu,jj)*u_lv2(x-nu+mu,kk)
251  */
252  LatticeColorMatrix u_lv2_tmp = shift(u_lv2[kk],FORWARD,mu);
253  u_tmp += shift(adj(u_lv2[kk]) * u_lv2[jj] * u_lv2_tmp , BACKWARD,nu);
254  }
255 
256  /*
257  * Unprojected hyp-smeared link
258  */
259  tmp_1 = ftmp1*u[mu] + ftmp2*u_tmp;
260  u_tmp = adj(tmp_1);
261 
262  /*
263  * Project onto SU(Nc)
264  */
265  u_hyp[mu] = u[mu];
266  sun_proj(u_tmp, u_hyp[mu], BlkAccu, BlkMax);
267  }
268  }
269 
270  END_CODE();
271  }
272 
273 } // ENd namespace Chroma
Primary include file for CHROMA library code.
int mu
Definition: cool.cc:24
int nu
Definition: cool.cc:25
void Hyp_Smear(const multi1d< LatticeColorMatrix > &u, multi1d< LatticeColorMatrix > &u_hyp, const Real &alpha1, const Real &alpha2, const Real &alpha3, const Real &BlkAccu, int BlkMax)
Construct the "hyp-smeared" links of Anna Hasenfratz.
Definition: hyp_smear.cc:30
Hyp smear a gauge field.
LatticeColorMatrix tmp_1
Definition: meslate.cc:50
Nd
Definition: meslate.cc:74
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
QDP_error_exit("too many BiCG iterations", n_count, rsd_sq, cp, c, re_rvr, im_rvr, re_a, im_a, re_b, im_b)
static multi1d< LatticeColorMatrix > u
void sun_proj(const LatticeColorMatrix &w, LatticeColorMatrix &v, const Real &BlkAccu, int BlkMax)
Definition: sun_proj.cc:101
START_CODE()
#define FORWARD
Definition: primitives.h:82
#define BACKWARD
Definition: primitives.h:83
Project a complex Nc x Nc matrix W onto SU(Nc) by maximizing Tr(VW)
Double ftmp1
Definition: topol.cc:29
Double ftmp2
Definition: topol.cc:30