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

fermiqcd_fermi_actions.h

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00033 class FermiCloverActionSlow {
00034  public:
00035   static void mul_Q(fermi_field &psi_out, 
00036                     fermi_field &psi_in, 
00037                     gauge_field &U, 
00038                     coefficients &coeff,
00039                     int parity=EVENODD) {
00040 
00041     if(psi_in.nspin!=4) error("fermiqcd_fermi_algorithms/mul_Q_ONE: nspin!=4");
00042     if(psi_in.nc!=U.nc) error("fermiqcd_fermi_algorithms/mul_Q_ONE: gauge and spinor have different nc");
00043     if(parity!=EVENODD) error("parity must be EVENODD here");
00044     
00045     register int   ndim=psi_in.lattice().ndim;
00046     register int   nspin=psi_in.nspin;
00047     register int   nc=psi_in.nc;
00048     register mdp_real kappa_t=0;
00049     register mdp_real kappa_s=0;
00050     register mdp_real r_t;
00051     register mdp_real r_s;
00052     register mdp_real cSW;
00053     register mdp_real c_E;
00054     register mdp_real c_B;
00055     register mdp_real rsign;
00056 
00057     if(coeff.has_key("kappa")) kappa_s=kappa_t=coeff["kappa"];
00058     if(coeff.has_key("kappa_t")) kappa_t=coeff["kappa_t"];
00059     if(coeff.has_key("kappa_s")) kappa_s=coeff["kappa_s"];
00060     if(kappa_t==0) error("kappa_t=0 or undeclared");
00061     if(kappa_s==0) error("kappa_s=0 or undeclared");
00062     if(coeff.has_key("r_t")) r_t=coeff["r_t"];       else r_t=1;
00063     if(coeff.has_key("r_s")) r_s=coeff["r_s"];       else r_s=1;
00064     if(coeff.has_key("c_{sw}")) cSW=coeff["c_{sw}"]; else cSW=0;
00065     if(coeff.has_key("c_E")) c_E=coeff["c_E"];       else c_E=1;
00066     if(coeff.has_key("c_B")) c_B=coeff["c_B"];       else c_B=1;
00067     if(coeff.has_key("sign")) rsign=coeff["sign"];   else rsign=+1;
00068 
00069     site           x(psi_in.lattice());
00070     register int   a,mu,nu;
00071     
00072     mdp_matrix psi_up(nspin,nc);
00073     mdp_matrix psi_dw(nspin,nc);
00074     mdp_matrix psi_lo(nspin,nc);
00075     
00076     // =================================================================
00077     //  The signs are now in accord with the definitions of
00078     //  MacKenzie et al. hep-lat/9604004
00079     //    and are in agreement with  
00080     //  Heatlie et al., Nucl.Phys. B352 (1991) 266
00081     //    care here:
00082     //    my definition of sigma is sigma_munu=i/2[gamma_mu,gamma_nu]
00083     //    an extra phase when compared with Heatlie         
00084     // ================================================================= 
00085     
00086     psi_out=psi_in; 
00087     forallsites(x) {
00088       for(mu=0; mu<ndim; mu++) {
00089         for(a=0; a<nspin; a++) {
00090           psi_up(a)=U(x,mu)*psi_in(x+mu,a);
00091           psi_dw(a)=hermitian(U(x-mu,mu))*psi_in(x-mu,a);
00092         }
00093         if(mu==0) psi_out(x)-=(kappa_t)*((r_t-Gamma[mu]*rsign)*psi_up+
00094                                          (r_t+Gamma[mu]*rsign)*psi_dw);
00095         else      psi_out(x)-=(kappa_s)*((r_s-Gamma[mu]*rsign)*psi_up+
00096                                          (r_s+Gamma[mu]*rsign)*psi_dw);
00097       }
00098       
00099       if(cSW!=0)
00100         for(mu=0; mu<ndim-1; mu++)
00101           for(nu=mu+1; nu<ndim; nu++) {
00102             for(a=0; a<nspin; a++) 
00103               psi_lo(a)=U.em(x,mu,nu)*psi_in(x,a);
00104             if(mu==0) {
00105               psi_out(x)+=(kappa_s*cSW*c_E*I)*(Sigma[mu][nu]*psi_lo);
00106             } else {
00107               psi_out(x)+=(kappa_s*cSW*c_B*I)*(Sigma[mu][nu]*psi_lo);
00108             }
00109           }
00110     }
00111   }
00112 };
00113 
00133 class FermiCloverActionFast {
00134  public:
00135   static void mul_Q(fermi_field &psi_out, 
00136                     fermi_field &psi_in, 
00137                     gauge_field &U, 
00138                     coefficients &coeff,
00139                     int parity=EVENODD) {
00140     
00141     
00142     if(psi_in.nspin!=4) error("fermiqcd_fermi_algorithms/mul_Q_TWO: nspin!=4");
00143     if(psi_in.nc!=U.nc) error("fermiqcd_fermi_algorithms/mul_Q_TWO: gauge and spinor have different nc");
00144     if(parity!=EVENODD) error("parity must be EVENODD here");
00145 
00146     register int   ndim=psi_in.lattice().ndim;
00147     register int   nspin=psi_in.nspin;
00148     register int   nc=psi_in.nc;
00149     register mdp_real kappa_t=0;
00150     register mdp_real kappa_s=0;
00151     register mdp_real r_t;
00152     register mdp_real r_s;
00153     register mdp_real cSW;
00154     register mdp_real c_E;
00155     register mdp_real c_B;
00156     register mdp_real rsign;
00157 
00158     if(coeff.has_key("kappa")) kappa_s=kappa_t=coeff["kappa"];
00159     if(coeff.has_key("kappa_t")) kappa_t=coeff["kappa_t"];
00160     if(coeff.has_key("kappa_s")) kappa_s=coeff["kappa_s"];
00161     if(kappa_t==0) error("kappa_t=0 or undeclared");
00162     if(kappa_s==0) error("kappa_s=0 or undeclared");
00163     if(coeff.has_key("r_t")) r_t=coeff["r_t"];       else r_t=1;
00164     if(coeff.has_key("r_s")) r_s=coeff["r_s"];       else r_s=1;
00165     if(coeff.has_key("c_{sw}")) cSW=coeff["c_{sw}"]; else cSW=0;
00166     if(coeff.has_key("c_E")) c_E=coeff["c_E"];       else c_E=1;
00167     if(coeff.has_key("c_B")) c_B=coeff["c_B"];       else c_B=1;
00168     if(coeff.has_key("sign")) rsign=coeff["sign"];   else rsign=+1;
00169     
00170     site           x(psi_in.lattice());
00171     register int   i,j,a,mu,nu,inc,anc,bnc;
00172     mdp_real         coeff_kappa=0;
00173     mdp_real         coeff_sum=0;
00174     mdp_complex        coeff_dif=0;
00175     mdp_complex        coeff_clover=0;
00176     mdp_complex        psi_up, psi_dw, psi_loc;
00177     mdp_complex        *psi_tmp=new mdp_complex[nspin*nc]; 
00178     mdp_complex        *Fem,   *Fpsi_in;
00179     mdp_complex        *FU_up, *Fpsi_in_up;
00180     mdp_complex        *FU_dw, *Fpsi_in_dw;
00181     mdp_complex        *FHU_dw=new mdp_complex[nc*nc];
00182     
00183     // =================================================================
00184     //  The signs are now in accord with the definitions of
00185     //  MacKenzie et al. hep-lat/9604004
00186     //    and are in agreement with  
00187     //  Heatlie et al., Nucl.Phys. B352 (1991) 266
00188     //    care here:
00189     //    my definition of sigma is 
00190     //      Sigma[mu][nu]=iI2*[Gamma[mu],Gamma[nu]]
00191     //    an extra phase when compared with Heatlie         
00192     // ================================================================= 
00193     
00194     psi_out=psi_in;
00195     
00196     forallsites(x) {
00197       for(a=0; a<nspin; a++) 
00198         for(i=0; i<nc; i++) {
00199           psi_tmp[anc=a*nc+i]=0;
00200         }
00201       for(mu=0; mu<ndim; mu++) { 
00202         if(mu==0) {
00203           coeff_kappa=kappa_t;
00204           coeff_sum=coeff_kappa*r_t;
00205         } else {
00206           coeff_kappa=kappa_s;
00207           coeff_sum=coeff_kappa*r_s;
00208         }
00209         FU_up=&U(x,mu,0,0);
00210         FU_dw=&U(x-mu,mu,0,0);
00211         for(i=0; i<nc; i++) 
00212           for(j=0; j<nc; j++) 
00213             FHU_dw[i*nc+j]=conj(FU_dw[j*nc+i]);
00214         for(a=0; a<nspin; a++) {
00215           anc=a*nc;
00216           Fpsi_in_up=&psi_in(x+mu,a,0);
00217           Fpsi_in_dw=&psi_in(x-mu,a,0);
00218           bnc=Gamma_idx[mu][a]*nc;
00219           coeff_dif=coeff_kappa*Gamma_val[mu][a]*rsign;
00220           for(i=0; i<nc; i++) {
00221             inc=i*nc;
00222             psi_up= FU_up[inc]*Fpsi_in_up[0];
00223             psi_dw=FHU_dw[inc]*Fpsi_in_dw[0];
00224             for(j=1; j<nc; j++) {
00225               psi_up+= FU_up[inc+j]*Fpsi_in_up[j];
00226               psi_dw+=FHU_dw[inc+j]*Fpsi_in_dw[j];
00227             }
00228             psi_tmp[anc+i]-=coeff_sum*(psi_dw+psi_up);
00229             psi_tmp[bnc+i]-=coeff_dif*(psi_dw-psi_up);
00230           }
00231         }
00232       }
00233       if(cSW!=0) {
00234         for(mu=0; mu<ndim-1; mu++)
00235           for(nu=mu+1; nu<ndim; nu++)
00236             for(a=0; a<nspin; a++) {
00237               Fem=&(U.em(x,mu,nu,0,0));
00238               bnc=Sigma_idx[mu][nu][a]*nc;
00239               Fpsi_in=&psi_in(x,a,0);
00240               if(mu==0) coeff_clover=(kappa_s*cSW*c_E*I)*Sigma_val[mu][nu][a]; 
00241               else      coeff_clover=(kappa_s*cSW*c_B*I)*Sigma_val[mu][nu][a];
00242               for(i=0; i<nc; i++) {
00243                 inc=i*nc;
00244                 psi_loc=Fem[inc]*Fpsi_in[0];
00245                 for(j=1; j<nc; j++)
00246                   psi_loc+=Fem[inc+j]*Fpsi_in[j];
00247                 psi_tmp[bnc+i]+=coeff_clover*psi_loc;
00248               }
00249             }
00250       }
00251       for(a=0;a<nspin; a++) 
00252         for(i=0; i<nc; i++) 
00253           psi_out(x,a,i)+=psi_tmp[anc=a*nc+i];
00254     }
00255     delete[] psi_tmp;
00256     delete[] FHU_dw;
00257   }
00258 };
00259 

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