49 FourDimRedBlackGrid,_M5,p),
75 for(
int s=0;s<
Ls;s++){
85 for(
int s=0;s<
Ls;s++){
122 conformable(imported5d.Grid(),this->FermionGrid());
139 for(
int s=0;s<
Ls;s++){
151 for(
int s=0;s<
Ls;s++){
160 std::vector<Coeff_t> diag (
Ls,1.0);
162 std::vector<Coeff_t> lower(
Ls,-1.0); lower[0] =
mass_plus;
163 M5D(psi,chi,chi,lower,diag,upper);
169 std::vector<Coeff_t> diag =
bs;
170 std::vector<Coeff_t> upper=
cs;
171 std::vector<Coeff_t> lower=
cs;
174 M5D(psi,psi,Din,lower,diag,upper);
180 std::vector<Coeff_t> diag =
beo;
181 std::vector<Coeff_t> upper(
Ls);
182 std::vector<Coeff_t> lower(
Ls);
183 for(
int i=0;i<
Ls;i++) {
187 upper[Ls-1]=-mass_minus*upper[Ls-1];
188 lower[0] =-mass_plus*lower[0];
189 M5D(psi,psi,chi,lower,diag,upper);
195 std::vector<Coeff_t> diag =
bee;
196 std::vector<Coeff_t> upper(
Ls);
197 std::vector<Coeff_t> lower(
Ls);
198 for(
int i=0;i<
Ls;i++) {
202 upper[Ls-1]=-mass_minus*upper[Ls-1];
203 lower[0] =-mass_plus*lower[0];
204 M5D(psi,psi,chi,lower,diag,upper);
210 std::vector<Coeff_t> diag =
bee;
211 std::vector<Coeff_t> upper(
Ls);
212 std::vector<Coeff_t> lower(
Ls);
214 for (
int s=0;s<
Ls;s++){
217 upper[s] = -
cee[s+1] ;
219 }
else if ( s==(
Ls-1)) {
221 lower[s] = -
cee[s-1];
228 for (
int s=0;s<
Ls;s++){
233 M5Ddag(psi,psi,chi,lower,diag,upper);
240 std::vector<Coeff_t> diag(
Ls,1.0);
241 std::vector<Coeff_t> upper(
Ls,-1.0);
242 std::vector<Coeff_t> lower(
Ls,-1.0);
245 M5Ddag(psi,chi,chi,lower,diag,upper);
252 std::vector<Coeff_t> diag =
bs;
253 std::vector<Coeff_t> upper=
cs;
254 std::vector<Coeff_t> lower=
cs;
256 for (
int s=0;s<
Ls;s++){
260 }
else if ( s==(
Ls-1) ) {
271 M5Ddag(psi,psi,Din,lower,diag,upper);
279 Gamma::Algebra Gmu [] = {
280 Gamma::Algebra::GammaX,
281 Gamma::Algebra::GammaY,
282 Gamma::Algebra::GammaZ,
283 Gamma::Algebra::GammaT
285 std::vector<ComplexD> coeff(
Nd);
288 assert(
qmu.size()==
Nd);
290 for(
int mu=0;mu<
Nd;mu++){
291 coeff[mu] = ci*
qmu[mu];
292 if ( dag ) coeff[mu] =
conjugate(coeff[mu]);
295 chi = chi +
Gamma(Gmu[0])*psi*coeff[0];
296 for(
int mu=1;mu<
Nd;mu++){
297 chi = chi +
Gamma(Gmu[mu])*psi*coeff[mu];
305 FermionField Din(psi.Grid());
316 axpby(chi,1.0,1.0,chi,psi);
328 FermionField Din(psi.Grid());
339 axpby (chi,1.0,1.0,chi,psi);
348 if ( psi.Checkerboard() ==
Odd ) {
359 if ( psi.Checkerboard() ==
Odd ) {
370 FermionField
tmp(psi.Grid());
377 FermionField
tmp(psi.Grid());
386 FermionField Din(V.Grid());
401 FermionField Din(V.Grid());
416 FermionField Din(V.Grid());
433 std::vector<Coeff_t> gamma(this->Ls);
434 for(
int s=0;s<this->Ls;s++) gamma[s] = zdata->gamma[s];
441 std::vector<Coeff_t> gamma(this->Ls);
442 for(
int s=0;s<this->Ls;s++) gamma[s] = zdata->gamma[s];
454 assert(gamma.size()==
Ls);
489 for(
int i=0; i <
Ls; i++){
492 assert(
omega[i]!=Coeff_t(0.0));
493 bs[i] = 0.5*(bpc/
omega[i] + bmc);
494 cs[i] = 0.5*(bpc/
omega[i] - bmc);
505 for(
int i=0;i<
Ls;i++){
506 bee[i]=
as[i]*(
bs[i]*(4.0-this->
M5) +1.0);
507 assert(
bee[i]!=Coeff_t(0.0));
514 for(
int i=0;i<
Ls;i++){
528 for(
int i=0;i<
Ls;i++){
534 assert(
bee[i]!=Coeff_t(0.0));
535 assert(
bee[0]!=Coeff_t(0.0));
540 for(
int j=0;j<i;j++) {
541 assert(
bee[j+1]!=Coeff_t(0.0));
548 for(
int j=1;j<=i;j++)
ueem[i]*=
cee[j]/
bee[j];
561 for(
int j=0;j<
Ls-1;j++) {
562 assert(
bee[j] != Coeff_t(0.0));
565 dee[
Ls-1] += delta_d;
591 Gamma G5(Gamma::Algebra::Gamma5);
601 p_plus = p_plus + G5*p_plus;
602 p_minus= p_minus - G5*p_minus;
603 p=0.5*(p_plus+p_minus);
612 Gamma G5(Gamma::Algebra::Gamma5);
616 PropagatorField p_plus (this->
GaugeGrid());
617 PropagatorField p_minus(this->
GaugeGrid());
622 p_plus = p_plus + G5*p_plus;
623 p_minus= p_minus - G5*p_minus;
624 p=0.5*(p_plus+p_minus);
628#define Pp(Q) (0.5*(Q+g5*Q))
629#define Pm(Q) (0.5*(Q-g5*Q))
630#define Q_4d(Q) (Pm((Q)[0]) + Pp((Q)[Ls-1]))
631#define TopRowWithSource(Q) (phys_src + (1.0-mass)*Q_4d(Q))
635 PropagatorField &q_in_2,
636 PropagatorField &q_out,
637 PropagatorField &phys_src,
645 Gamma::Algebra Gmu [] = {
646 Gamma::Algebra::GammaX,
647 Gamma::Algebra::GammaY,
648 Gamma::Algebra::GammaZ,
649 Gamma::Algebra::GammaT,
650 Gamma::Algebra::Gamma5
656 if ( curr_type == Current::Axial ) sgn = -1.0;
660 std::vector<PropagatorField> L_Q(
Ls,UGrid);
661 std::vector<PropagatorField> R_Q(
Ls,UGrid);
662 for(
int s=0;s<
Ls;s++){
667 Gamma g5(Gamma::Algebra::Gamma5);
668 PropagatorField C(UGrid);
669 PropagatorField p5d(UGrid);
670 PropagatorField us_p5d(UGrid);
671 PropagatorField gp5d(UGrid);
672 PropagatorField gus_p5d(UGrid);
674 PropagatorField L_TmLsGq0(UGrid);
675 PropagatorField L_TmLsTmp(UGrid);
676 PropagatorField R_TmLsGq0(UGrid);
677 PropagatorField R_TmLsTmp(UGrid);
679 PropagatorField TermA(UGrid);
680 PropagatorField TermB(UGrid);
681 PropagatorField TermC(UGrid);
682 PropagatorField TermD(UGrid);
688 L_TmLsGq0 = (TermD - TermA + TermB);
689 L_TmLsTmp = (TermC - TermB + TermA);
696 R_TmLsGq0 = (TermD - TermA + TermB);
697 R_TmLsTmp = (TermC - TermB + TermA);
700 std::vector<PropagatorField> R_TmLsGq(
Ls,UGrid);
701 std::vector<PropagatorField> L_TmLsGq(
Ls,UGrid);
702 for(
int s=0;s<
Ls;s++){
703 R_TmLsGq[s] = (
Pm((R_Q)[(s)]) +
Pp((R_Q)[((s)-1+
Ls)%
Ls]));
704 L_TmLsGq[s] = (
Pm((L_Q)[(s)]) +
Pp((L_Q)[((s)-1+
Ls)%
Ls]));
710 PropagatorField
tmp(UGrid);
711 for(
int s=0;s<
Ls;s++){
720 auto bpc = 1.0/(b+c);
722 p5d =(b*
Pm(L_TmLsGq[
Ls-1])+ c*
Pp(L_TmLsGq[
Ls-1]) + b*
Pp(L_TmLsTmp) + c*
Pm(L_TmLsTmp ));
723 tmp =(b*
Pm(R_TmLsGq0) + c*
Pp(R_TmLsGq0 ) + b*
Pp(R_TmLsGq[1]) + c*
Pm(R_TmLsGq[1]));
724 }
else if (s ==
Ls-1) {
725 p5d =(b*
Pm(L_TmLsGq0) + c*
Pp(L_TmLsGq0 ) + b*
Pp(L_TmLsGq[1]) + c*
Pm(L_TmLsGq[1]));
726 tmp =(b*
Pm(R_TmLsGq[
Ls-1])+ c*
Pp(R_TmLsGq[
Ls-1]) + b*
Pp(R_TmLsTmp) + c*
Pm(R_TmLsTmp ));
728 p5d =(b*
Pm(L_TmLsGq[sr]) + c*
Pp(L_TmLsGq[sr])+ b*
Pp(L_TmLsGq[srp])+ c*
Pm(L_TmLsGq[srp]));
729 tmp =(b*
Pm(R_TmLsGq[s]) + c*
Pp(R_TmLsGq[s]) + b*
Pp(R_TmLsGq[sp ])+ c*
Pm(R_TmLsGq[sp]));
732 Impl::multLinkField(us_p5d,this->
Umu,
tmp,mu);
737 C = bpc*(
adj(gp5d)*us_p5d);
738 C-= bpc*(
adj(gp5d)*gus_p5d);
741 p5d =(b*
Pm(R_TmLsGq0) + c*
Pp(R_TmLsGq0 ) + b*
Pp(R_TmLsGq[1]) + c*
Pm(R_TmLsGq[1]));
742 tmp =(b*
Pm(L_TmLsGq[
Ls-1])+ c*
Pp(L_TmLsGq[
Ls-1]) + b*
Pp(L_TmLsTmp) + c*
Pm(L_TmLsTmp ));
743 }
else if (s ==
Ls-1) {
744 p5d =(b*
Pm(R_TmLsGq[
Ls-1])+ c*
Pp(R_TmLsGq[
Ls-1]) + b*
Pp(R_TmLsTmp) + c*
Pm(R_TmLsTmp ));
745 tmp =(b*
Pm(L_TmLsGq0) + c*
Pp(L_TmLsGq0 ) + b*
Pp(L_TmLsGq[1]) + c*
Pm(L_TmLsGq[1]));
747 p5d =(b*
Pm(R_TmLsGq[s]) + c*
Pp(R_TmLsGq[s]) + b*
Pp(R_TmLsGq[sp ])+ c*
Pm(R_TmLsGq[sp]));
748 tmp =(b*
Pm(L_TmLsGq[sr]) + c*
Pp(L_TmLsGq[sr]) + b*
Pp(L_TmLsGq[srp])+ c*
Pm(L_TmLsGq[srp]));
751 Impl::multLinkField(us_p5d,this->
Umu,
tmp,mu);
754 gus_p5d=g5*us_p5d*g5;
756 C-= bpc*(
adj(gus_p5d)*gp5d);
757 C-= bpc*(
adj(gus_p5d)*p5d);
759 if (s <
Ls/2) q_out += sgn*C;
768 PropagatorField &q_out,
769 PropagatorField &phys_src,
783 int tshift = (mu ==
Nd-1) ? 1 : 0;
790 Gamma::Algebra Gmu [] = {
791 Gamma::Algebra::GammaX,
792 Gamma::Algebra::GammaY,
793 Gamma::Algebra::GammaZ,
794 Gamma::Algebra::GammaT
798 PropagatorField L_Q(UGrid);
799 PropagatorField R_Q(UGrid);
801 PropagatorField
tmp(UGrid);
802 PropagatorField Utmp(UGrid);
803 PropagatorField zz (UGrid); zz=0.0;
805 for (
int s=0;s<
Ls;s++) {
807 RealD G_s = (curr_type == Current::Axial ) ? ((s <
Ls/2) ? -1 : 1) : 1;
812 Impl::multLinkField(Utmp,this->
Umu,
tmp,mu);
813 tmp = G_s*( Utmp*ph - gmu*Utmp*ph );
814 tmp = where((lcoor>=tmin),
tmp,zz);
815 tmp = where((lcoor<=tmax),
tmp,zz);
820 Impl::multLinkField(Utmp,this->
Umu,
tmp,mu+
Nd);
821 tmp = -G_s*( Utmp + gmu*Utmp );
822 tmp = where((lcoor>=tmin+tshift),
tmp,zz);
823 tmp = where((lcoor<=tmax+tshift),
tmp,zz);
830 int tshift = (mu ==
Nd-1) ? 1 : 0;
835 Gamma::Algebra Gmu [] = {
836 Gamma::Algebra::GammaX,
837 Gamma::Algebra::GammaY,
838 Gamma::Algebra::GammaZ,
839 Gamma::Algebra::GammaT,
840 Gamma::Algebra::Gamma5
843 Gamma g5(Gamma::Algebra::Gamma5);
849 std::vector<PropagatorField> R_Q(
Ls,UGrid);
850 PropagatorField L_Q(UGrid);
851 PropagatorField
tmp(UGrid);
852 PropagatorField Utmp(UGrid);
854 PropagatorField zz (UGrid); zz=0.0;
857 for(
int s=0;s<
Ls;s++){
861 PropagatorField R_TmLsGq0(UGrid);
862 PropagatorField R_TmLsTmp(UGrid);
864 PropagatorField TermA(UGrid);
865 PropagatorField TermB(UGrid);
866 PropagatorField TermC(UGrid);
867 PropagatorField TermD(UGrid);
874 R_TmLsGq0 = (TermD - TermA + TermB);
875 R_TmLsTmp = (TermC - TermB + TermA);
878 std::vector<PropagatorField> R_TmLsGq(
Ls,UGrid);
879 for(
int s=0;s<
Ls;s++){
880 R_TmLsGq[s] = (
Pm((R_Q)[(s)]) +
Pp((R_Q)[((s)-1+
Ls)%
Ls]));
883 std::vector<RealD> G_s(
Ls,1.0);
885 if ( curr_type == Current::Axial ) {
886 for(
int s=0;s<
Ls/2;s++){
890 else if ( curr_type == Current::Tadpole ) {
893 if ( b == 1 && c == 0 ) {
897 std::cerr <<
"Error: Tadpole implementation currently unavailable for non-Shamir actions." << std::endl;
898 assert(b==1 && c==0);
902 for(
int s=0;s<
Ls;s++){
914 tmp =(b*
Pm(R_TmLsGq0) + c*
Pp(R_TmLsGq0 ) + b*
Pp(R_TmLsGq[1]) + c*
Pm(R_TmLsGq[1]));
915 }
else if (s ==
Ls-1) {
916 tmp =(b*
Pm(R_TmLsGq[
Ls-1])+ c*
Pp(R_TmLsGq[
Ls-1]) + b*
Pp(R_TmLsTmp) + c*
Pm(R_TmLsTmp ));
918 tmp =(b*
Pm(R_TmLsGq[s]) + c*
Pp(R_TmLsGq[s]) + b*
Pp(R_TmLsGq[sp ])+ c*
Pm(R_TmLsGq[sp]));
922 Impl::multLinkField(Utmp,this->
Umu,
tmp,mu);
923 tmp = sign*G_s[s]*( Utmp*ph - gmu*Utmp*ph );
924 tmp = where((lcoor>=tmin),
tmp,zz);
925 L_Q = where((lcoor<=tmax),
tmp,zz);
928 tmp =(b*
Pm(R_TmLsGq0) + c*
Pp(R_TmLsGq0 ) + b*
Pp(R_TmLsGq[1]) + c*
Pm(R_TmLsGq[1]));
929 }
else if (s ==
Ls-1) {
930 tmp =(b*
Pm(R_TmLsGq[
Ls-1])+ c*
Pp(R_TmLsGq[
Ls-1]) + b*
Pp(R_TmLsTmp) + c*
Pm(R_TmLsTmp ));
932 tmp =(b*
Pm(R_TmLsGq[s]) + c*
Pp(R_TmLsGq[s]) + b*
Pp(R_TmLsGq[sp])+ c*
Pm(R_TmLsGq[sp]));
936 Impl::multLinkField(Utmp,this->
Umu,
tmp,mu+
Nd);
937 tmp = -G_s[s]*( Utmp + gmu*Utmp );
939 if (tmax == LLt - 1 && tshift == 1){
941 tmp = where(((lcoor==t0) || (lcoor>=tmin+tshift)),
tmp,zz);
943 tmp = where((lcoor>=tmin+tshift),
tmp,zz);
945 L_Q += where((lcoor<=tmax+tshift),
tmp,zz);
953#undef TopRowWithSource
#define TopRowWithSource(Q)
auto Cshift(const Expression &expr, int dim, int shift) -> decltype(closure(expr))
const Coordinate & GridDefaultLatt(void)
void axpby(Lattice< vobj > &ret, sobj a, sobj b, const Lattice< vobj > &x, const Lattice< vobj > &y)
void LatticeCoordinate(Lattice< iobj > &l, int mu)
auto localInnerProduct(const Lattice< vobj > &lhs, const Lattice< vobj > &rhs) -> Lattice< typename vobj::tensor_reduced >
Lattice< vobj > conjugate(const Lattice< vobj > &lhs)
Lattice< vobj > adj(const Lattice< vobj > &lhs)
void InsertSlice(const Lattice< vobj > &lowDim, Lattice< vobj > &higherDim, int slice, int orthog)
void ExtractSlice(Lattice< vobj > &lowDim, const Lattice< vobj > &higherDim, int slice, int orthog)
void axpby_ssp_pplus(Lattice< vobj > &z, Coeff a, const Lattice< vobj > &x, Coeff b, const Lattice< vobj > &y, int s, int sp)
void axpby_ssp_pminus(Lattice< vobj > &z, Coeff a, const Lattice< vobj > &x, Coeff b, const Lattice< vobj > &y, int s, int sp)
void axpby_ssp(Lattice< vobj > &z, Coeff a, const Lattice< vobj > &x, Coeff b, const Lattice< vobj > &y, int s, int sp)
#define NAMESPACE_BEGIN(A)
static constexpr int DaggerYes
Lattice< vTInteger > LatticeInteger
static constexpr int DaggerNo
std::complex< RealD > ComplexD
static INTERNAL_PRECISION U
CayleyFermion5D(GaugeField &_Umu, GridCartesian &FiveDimGrid, GridRedBlackCartesian &FiveDimRedBlackGrid, GridCartesian &FourDimGrid, GridRedBlackCartesian &FourDimRedBlackGrid, RealD _mass, RealD _M5, const ImplParams &p=ImplParams())
void Meooe5D(const FermionField &in, FermionField &out)
virtual void SetCoefficientsInternal(RealD zolo_hi, std::vector< Coeff_t > &gamma, RealD b, RealD c)
std::vector< ComplexD > qmu
std::vector< Coeff_t > leem
virtual void Mdir(const FermionField &in, FermionField &out, int dir, int disp)
std::vector< Coeff_t > as
virtual void MeoDeriv(GaugeField &mat, const FermionField &U, const FermionField &V, int dag)
std::vector< Coeff_t > lee
deviceVector< Coeff_t > d_upper
virtual void SetCoefficientsZolotarev(RealD zolohi, Approx::zolotarev_data *zdata, RealD b, RealD c)
deviceVector< Coeff_t > d_uee
virtual void MoeDeriv(GaugeField &mat, const FermionField &U, const FermionField &V, int dag)
deviceVector< Coeff_t > d_dee
std::vector< Coeff_t > bee
std::vector< Coeff_t > dee
virtual void MDeriv(GaugeField &mat, const FermionField &U, const FermionField &V, int dag)
deviceVector< Coeff_t > d_diag
virtual void ExportPhysicalFermionSource(const FermionField &solution5d, FermionField &exported4d)
virtual void Mdag(const FermionField &in, FermionField &out)
std::vector< Coeff_t > cs
virtual void M5Ddag(const FermionField &psi, FermionField &chi)
virtual void Meo5D(const FermionField &psi, FermionField &chi)
virtual void ImportPhysicalFermionSource(const FermionField &input4d, FermionField &imported5d)
virtual void DminusDag(const FermionField &psi, FermionField &chi)
void addQmu(const FermionField &in, FermionField &out, int dag)
void ContractConservedCurrent(PropagatorField &q_in_1, PropagatorField &q_in_2, PropagatorField &q_out, PropagatorField &phys_src, Current curr_type, unsigned int mu)
virtual void MdirAll(const FermionField &in, std::vector< FermionField > &out)
virtual void Dminus(const FermionField &psi, FermionField &chi)
virtual void MeooeDag(const FermionField &in, FermionField &out)
std::vector< Coeff_t > beo
void P(const FermionField &psi, FermionField &chi)
std::vector< Coeff_t > bs
virtual void M(const FermionField &in, FermionField &out)
void MeooeDag5D(const FermionField &in, FermionField &out)
std::vector< Coeff_t > _gamma
std::vector< Coeff_t > aeo
void ContractJ5q(PropagatorField &q_in, ComplexField &J5q)
virtual void M5D(const FermionField &psi, FermionField &chi)
virtual void ExportPhysicalFermionSolution(const FermionField &solution5d, FermionField &exported4d)
deviceVector< Coeff_t > d_lower
virtual void SetCoefficientsTanh(Approx::zolotarev_data *zdata, RealD b, RealD c)
std::vector< Coeff_t > ceo
void SeqConservedCurrent(PropagatorField &q_in, PropagatorField &q_out, PropagatorField &phys_src, Current curr_type, unsigned int mu, unsigned int tmin, unsigned int tmax, ComplexField &lattice_cmplx)
deviceVector< Coeff_t > d_leem
virtual void Meooe(const FermionField &in, FermionField &out)
deviceVector< Coeff_t > d_lee
virtual void MooeeDag(const FermionField &in, FermionField &out)
std::vector< Coeff_t > ueem
virtual void ImportUnphysicalFermion(const FermionField &solution5d, FermionField &exported4d)
std::vector< Coeff_t > cee
void Pdag(const FermionField &psi, FermionField &chi)
std::vector< Coeff_t > omega
virtual void Mooee(const FermionField &in, FermionField &out)
deviceVector< Coeff_t > d_ueem
std::vector< Coeff_t > aee
std::vector< Coeff_t > uee
GridBase * GaugeGrid(void)
GridBase * FermionGrid(void)
virtual void DhopDerivEO(GaugeField &mat, const FermionField &U, const FermionField &V, int dag)
void DW(const FermionField &in, FermionField &out, int dag)
void DhopDir(const FermionField &in, FermionField &out, int dir, int disp)
void DhopDirAll(const FermionField &in, std::vector< FermionField > &out)
WilsonFermion5D(GaugeField &_Umu, GridCartesian &FiveDimGrid, GridRedBlackCartesian &FiveDimRedBlackGrid, GridCartesian &FourDimGrid, GridRedBlackCartesian &FourDimRedBlackGrid, double _M5, const ImplParams &p=ImplParams())
virtual void DhopDeriv(GaugeField &mat, const FermionField &U, const FermionField &V, int dag)
void DhopEO(const FermionField &in, FermionField &out, int dag)
virtual void DhopDerivOE(GaugeField &mat, const FermionField &U, const FermionField &V, int dag)
void DhopOE(const FermionField &in, FermionField &out, int dag)