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

fermiqcd_sdwf_algorithms.h

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 const double MDP_SDWF_SGN=1.0;
00014 
00015 void project(staggered_field &psi, sdwf_field &chi, gauge_field &U) {
00016   site x(chi.lattice());
00017   site y(chi.lattice());
00018   int L5=chi.L5;
00019   mdp_real phase;
00020   forallsites(x) {
00021     phase=chi.chiral_phase(x);
00022     y=chi.chiral_shift(x);
00023     psi(x)=
00024       0.5*chi(x,0)-(MDP_SDWF_SGN*0.5*phase)*(U.swirls(x)*chi(y,0))+
00025       0.5*chi(x,L5-1)+(MDP_SDWF_SGN*0.5*phase)*(U.swirls(x)*chi(y,L5-1));
00026   }
00027 }
00028 
00029 void project(staggered_field &psi, sdwf_field &chi, gauge_field &U, 
00030              int sign, int L) {
00031   site x(chi.lattice());
00032   site y(chi.lattice());
00033   mdp_real phase;
00034   forallsites(x) {
00035     phase=chi.chiral_phase(x);
00036     y=chi.chiral_shift(x);
00037     psi(x)=
00038       0.5*chi(x,L)-(0.5*phase*sign)*(U.swirls(x)*chi(y,L));
00039   }
00040 }
00041 
00042 void project(sdwf_field &chi, staggered_field &psi, gauge_field &U) {
00043   site x(chi.lattice());
00044   site y(chi.lattice());
00045   mdp_real phase;
00046   forallsites(x) {
00047     phase=chi.chiral_phase(x);
00048     y=chi.chiral_shift(x);
00049     chi(x,0)=
00050       0.5*psi(x)-(MDP_SDWF_SGN*0.5*phase)*(U.swirls(x)*psi(y));
00051     chi(x,chi.L5-1)=
00052       0.5*psi(x)+(MDP_SDWF_SGN*0.5*phase)*(U.swirls(x)*psi(y));
00053   }
00054 }
00055 
00056 
00057 // ////////////////////////////////////////////////
00058 // choice of the default sdwf action
00059 // only one available at the moment
00060 // ////////////////////////////////////////////////
00061 
00062 void (*default_sdwf_action)(sdwf_field &,
00063                             sdwf_field &,
00064                             gauge_field &, 
00065                             coefficients &, 
00066                             int) = SDWFActionSlow::mul_Q;
00067 
00068 void mul_Q(sdwf_field &psi_out,
00069            sdwf_field &psi_in,
00070            gauge_field &U, 
00071            coefficients &coeff,
00072            int parity=EVENODD) {
00073   (*default_sdwf_action)(psi_out, psi_in, U, coeff, parity);
00074 }
00075 
00076 // ////////////////////////////////////////////////
00077 // choice of the default inversion method
00078 // ////////////////////////////////////////////////
00079 
00080 inversion_stats (*default_sdwf_inverter)(sdwf_field &, 
00081                                                  sdwf_field &,
00082                                                  gauge_field &, 
00083                                                  coefficients &, 
00084                                                  mdp_real, mdp_real,int) 
00085      =BiConjugateGradientStabilizedInverter<sdwf_field,gauge_field>;
00086 
00087 inversion_stats mul_invQ(sdwf_field &psi_out, 
00088                          sdwf_field &psi_in, 
00089                          gauge_field &U, 
00090                          coefficients &coeff, 
00091                          mdp_real absolute_precision=sdwf_inversion_precision,
00092                          mdp_real relative_precision=0,
00093                          int max_steps=2000) {
00094   return (*default_sdwf_inverter)(psi_out, psi_in, U, coeff, absolute_precision, relative_precision, max_steps);
00095 }
00096 
00097 void compute_swirls_field(gauge_field &U) {
00098   int i,j,k,nc=U.nc;
00099   mdp_matrix A;
00100   U.swirls.allocate_mdp_matrix_field(U.lattice(), nc, nc);
00101   site x(U.lattice()), y(U.lattice());
00102   forallsites(x) if(x(0) % 2 == 0) {
00103     U.swirls(x)=0;
00104     // for(k=0; k<mdp_permutations(4); k++) { this gave some problems
00105     y=x;
00106     A=mdp_identity(nc);
00107     for(k=0; k<1; k++) {
00108       //  k=(int) ((float) mdp_permutations(4)*Random.plain());
00109       for(i=0; i<U.ndim; i++) {
00110         j=mdp_permutation(4,k,i);
00111         if(y(j)%2==0) {
00112           A=A*U(y,+1,j);
00113           y=y+j;
00114         } else {
00115           A=A*U(y,-1,j);
00116           y=y-j;
00117         }
00118       }
00119       U.swirls(x)+=A;
00120     }
00121     U.swirls(x)=U.swirls(x)/mdp_complex(1,0); // care here with 1
00122   }
00123   forallsites(x) if(x(0) % 2 == 1) {
00124     y=x;
00125     for(i=0; i<U.ndim; i++)
00126       if(y(i)%2==0)y=y+i;
00127       else         y=y-i;
00128     U.swirls(x)=inv(U.swirls(y));
00129   }
00130 }

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