Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

fermiqcd_staggered_actions.h

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00026 
00027 class StaggeredAsqtadActionSlow {
00028  public:
00029   static void mul_Q(staggered_field &chi_out,
00030                     staggered_field &chi_in,
00031                     gauge_field &U,
00032                     coefficients &coeff,
00033                     int parity=EVENODD) {
00034 
00035     int   ndim=U.ndim;
00036     mdp_real sign, two_mass;
00037     if(coeff.has_key("mass")) two_mass=2.0*coeff["mass"];
00038     else error("coefficient mass undefined");
00039     if(coeff.has_key("sign")) sign=coeff["sign"];
00040     else sign=1;
00041 
00042   
00043     int mu;
00044     site x(chi_in.lattice());
00045     site y(chi_in.lattice());
00046     static mdp_matrix dslash;
00047         
00048     if(two_mass!=0) 
00049       forallsitesofparity(x,parity)
00050         chi_out(x)=two_mass*chi_in(x);
00051     else 
00052       forallsitesofparity(x,parity)
00053         chi_out(x)=0;
00054     
00055     if(!U.long_links.allocated()) {
00056       // use non-naik improved action
00057       forallsitesofparity(x,parity) {
00058         for(mu=0; mu<ndim; mu++) {
00059           y=x+mu;             dslash =U(x,mu)*chi_in(y);
00060           y=x-mu;             dslash-=hermitian(U(y,mu))*chi_in(y);
00061           chi_out(x)+=(sign*chi_in.eta(x,mu))*dslash;
00062         }
00063       }
00064     } else {
00065       // use naik improved action
00066       forallsitesofparity(x,parity) {
00067         for(mu=0; mu<ndim; mu++) {
00068           y=x+mu;             dslash =U(x,mu)*chi_in(y);
00069           y=(y+mu)+mu;        dslash+=U.long_links(x,mu)*chi_in(y);
00070           y=x-mu;             dslash-=hermitian(U(y,mu))*chi_in(y);
00071           y=(y-mu)-mu;        dslash-=hermitian(U.long_links(y,mu))*chi_in(y);
00072           chi_out(x)+=sign*chi_in.eta(x,mu)*dslash;
00073         }
00074       }
00075     }
00076   }
00077 };
00078 
00091 class StaggeredAsqtadActionFast {
00092  public:
00093   static void mul_Q(staggered_field &chi_out,
00094                     staggered_field &chi_in,
00095                     gauge_field &U,
00096                     coefficients &coeff,
00097                     int   parity=EVENODD) {
00098     int   nc=U.nc;
00099     int   ndim=U.ndim;
00100     mdp_real sign, two_mass;
00101     if(coeff.has_key("mass")) two_mass=2.0*coeff["mass"];
00102     else error("coefficient mass undefined");
00103     if(coeff.has_key("sign")) sign=coeff["sign"];
00104     else sign=1;
00105 
00106     int i,j,mu;
00107     site x(chi_in.lattice());
00108     site x_up(chi_in.lattice());
00109     site x_dw(chi_in.lattice());
00110     mdp_complex phase;
00111     mdp_complex *FU_up;
00112     mdp_complex *FU_dw;
00113     mdp_complex *Fchi_up;
00114     mdp_complex *Fchi_dw;
00115 
00116     if(two_mass!=0)
00117       forallsitesofparity(x,parity)
00118         for(i=0; i<nc; i++)
00119           chi_out(x,i)=two_mass*chi_in(x,i);
00120     else
00121       forallsitesofparity(x,parity)
00122         for(i=0; i<nc; i++)
00123           chi_out(x,i)=0;
00124     
00125     if(nc==3) {
00126       // version optimized for su3
00127       forallsitesofparity(x,parity) {
00128         for(mu=0; mu<ndim; mu++) {
00129           x_up=x+mu;
00130           x_dw=x-mu;
00131           FU_up=&(U(x,mu,0,0));
00132           FU_dw=&(U(x_dw,mu,0,0));
00133           Fchi_up=&(chi_in(x_up,0));
00134           Fchi_dw=&(chi_in(x_dw,0));
00135           
00136           // the factors of 3 in the Naik term
00137           
00138           phase=(mdp_real) sign*chi_in.eta(x,mu);
00139           for(i=0; i<3; i++)
00140             chi_out(x,i)+=phase*
00141               (FU_up[3*i+0]*Fchi_up[0]+
00142                FU_up[3*i+1]*Fchi_up[1]+
00143                FU_up[3*i+2]*Fchi_up[2]-
00144                conj(FU_dw[3*0+i])*Fchi_dw[0]-
00145                conj(FU_dw[3*1+i])*Fchi_dw[1]-
00146                conj(FU_dw[3*2+i])*Fchi_dw[2]);
00147           
00148           // //////////////////////////////////////
00149           // The follwoing is called the Naik Term
00150           // ... for the Lepage improved action
00151           // //////////////////////////////////////
00152           // with this phase naik= -1/24*pow(u0,-2)
00153           // //////////////////////////////////////
00154           if(U.long_links.allocated()) {
00155             x_up=(x_up+mu)+mu;
00156             x_dw=(x_dw-mu)-mu;
00157             FU_up=&(U.long_links(x,mu,0,0));
00158             FU_dw=&(U.long_links(x_dw,mu,0,0));
00159             Fchi_up=&(chi_in(x_up,0));
00160             Fchi_dw=&(chi_in(x_dw,0));
00161             // check the factor phase
00162             for(i=0; i<3; i++)
00163               chi_out(x,i)+=phase*
00164                 (FU_up[3*i+0]*Fchi_up[0]+
00165                  FU_up[3*i+1]*Fchi_up[1]+
00166                  FU_up[3*i+2]*Fchi_up[2]-
00167                  conj(FU_dw[3*0+i])*Fchi_dw[0]-
00168                  conj(FU_dw[3*1+i])*Fchi_dw[1]-
00169                  conj(FU_dw[3*2+i])*Fchi_dw[2]);          
00170           }
00171         }
00172       }
00173     } else {
00174       // version non-optimized for su3
00175       forallsitesofparity(x,parity) {
00176         for(mu=0; mu<ndim; mu++) {
00177           x_up=x+mu;
00178           x_dw=x-mu;
00179           FU_up=&(U(x,mu,0,0));
00180           FU_dw=&(U(x_dw,mu,0,0));
00181           Fchi_up=&(chi_in(x_up,0));
00182           Fchi_dw=&(chi_in(x_dw,0));
00183           phase=(mdp_real) sign*chi_in.eta(x,mu);
00184           for(i=0; i<nc; i++)
00185             for(j=0; j<nc; j++) 
00186               chi_out(x,i)+=phase*
00187                 (FU_up[nc*i+j]*Fchi_up[j]-conj(FU_dw[nc*j+i])*Fchi_dw[j]);
00188           if(U.long_links.allocated()) {
00189             x_up=(x_up+mu)+mu;
00190             x_dw=(x_dw-mu)-mu;
00191             FU_up=&(U.long_links(x,mu,0,0));
00192             FU_dw=&(U.long_links(x_dw,mu,0,0));
00193             Fchi_up=&(chi_in(x_up,0));
00194             Fchi_dw=&(chi_in(x_dw,0));
00195             // check the factor phase
00196             for(i=0; i<nc; i++)
00197               for(j=0; j<nc; j++)
00198                 chi_out(x,i)+=phase*
00199                   (FU_up[3*i+j]*Fchi_up[j]-conj(FU_dw[3*j+i])*Fchi_dw[j]);
00200           }
00201         }
00202       }
00203     }
00204   }
00205 };
00206 

Generated on Sun Feb 27 15:12:19 2005 by  doxygen 1.4.1