Grid 0.7.0
CayleyFermion5Dssp.h
Go to the documentation of this file.
1/*************************************************************************************
2
3 Grid physics library, www.github.com/paboyle/Grid
4
5 Source file: ./lib/qcd/action/fermion/CayleyFermion5D.cc
6
7 Copyright (C) 2015
8
9Author: Peter Boyle <pabobyle@ph.ed.ac.uk>
10Author: Peter Boyle <paboyle@ph.ed.ac.uk>
11Author: Peter Boyle <peterboyle@Peters-MacBook-Pro-2.local>
12Author: paboyle <paboyle@ph.ed.ac.uk>
13
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation; either version 2 of the License, or
17 (at your option) any later version.
18
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
23
24 You should have received a copy of the GNU General Public License along
25 with this program; if not, write to the Free Software Foundation, Inc.,
26 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27
28 See the full license in the file "LICENSE" in the top level distribution directory
29*************************************************************************************/
30/* END LEGAL */
31
34
35
37
38// Pminus fowards
39// Pplus backwards
40template<class Impl>
41void CayleyFermion5D<Impl>::M5D(const FermionField &psi,
42 const FermionField &phi,
43 FermionField &chi,
44 Vector<Coeff_t> &lower,
45 Vector<Coeff_t> &diag,
46 Vector<Coeff_t> &upper)
47{
48 Coeff_t one(1.0);
49 int Ls=this->Ls;
50 for(int s=0;s<Ls;s++){
51 if ( s==0 ) {
52 axpby_ssp_pminus(chi,diag[s],phi,upper[s],psi,s,s+1);
53 axpby_ssp_pplus (chi,one,chi,lower[s],psi,s,Ls-1);
54 } else if ( s==(Ls-1)) {
55 axpby_ssp_pminus(chi,diag[s],phi,upper[s],psi,s,0);
56 axpby_ssp_pplus (chi,one,chi,lower[s],psi,s,s-1);
57 } else {
58 axpby_ssp_pminus(chi,diag[s],phi,upper[s],psi,s,s+1);
59 axpby_ssp_pplus(chi,one,chi,lower[s],psi,s,s-1);
60 }
61 }
62}
63template<class Impl>
64void CayleyFermion5D<Impl>::M5Ddag(const FermionField &psi,
65 const FermionField &phi,
66 FermionField &chi,
67 Vector<Coeff_t> &lower,
68 Vector<Coeff_t> &diag,
69 Vector<Coeff_t> &upper)
70{
71 Coeff_t one(1.0);
72 int Ls=this->Ls;
73 for(int s=0;s<Ls;s++){
74 if ( s==0 ) {
75 axpby_ssp_pplus (chi,diag[s],phi,upper[s],psi,s,s+1);
76 axpby_ssp_pminus(chi,one,chi,lower[s],psi,s,Ls-1);
77 } else if ( s==(Ls-1)) {
78 axpby_ssp_pplus (chi,diag[s],phi,upper[s],psi,s,0);
79 axpby_ssp_pminus(chi,one,chi,lower[s],psi,s,s-1);
80 } else {
81 axpby_ssp_pplus (chi,diag[s],phi,upper[s],psi,s,s+1);
82 axpby_ssp_pminus(chi,one,chi,lower[s],psi,s,s-1);
83 }
84 }
85}
86
87template<class Impl>
88void CayleyFermion5D<Impl>::MooeeInv (const FermionField &psi, FermionField &chi)
89{
90 Coeff_t one(1.0);
91 Coeff_t czero(0.0);
92 chi.Checkerboard()=psi.Checkerboard();
93 int Ls=this->Ls;
94 // Apply (L^{\prime})^{-1}
95 axpby_ssp (chi,one,psi, czero,psi,0,0); // chi[0]=psi[0]
96 for (int s=1;s<Ls;s++){
97 axpby_ssp_pplus(chi,one,psi,-lee[s-1],chi,s,s-1);// recursion Psi[s] -lee P_+ chi[s-1]
98 }
99 // L_m^{-1}
100 for (int s=0;s<Ls-1;s++){ // Chi[ee] = 1 - sum[s<Ls-1] -leem[s]P_- chi
101 axpby_ssp_pminus(chi,one,chi,-leem[s],chi,Ls-1,s);
102 }
103 // U_m^{-1} D^{-1}
104 for (int s=0;s<Ls-1;s++){
105 // Chi[s] + 1/d chi[s]
106 axpby_ssp_pplus(chi,one/dee[s],chi,-ueem[s]/dee[Ls-1],chi,s,Ls-1);
107 }
108 axpby_ssp(chi,one/dee[Ls-1],chi,czero,chi,Ls-1,Ls-1); // Modest avoidable
109
110 // Apply U^{-1}
111 for (int s=Ls-2;s>=0;s--){
112 axpby_ssp_pminus (chi,one,chi,-uee[s],chi,s,s+1); // chi[Ls]
113 }
114}
115
116template<class Impl>
117void CayleyFermion5D<Impl>::MooeeInvDag (const FermionField &psi, FermionField &chi)
118{
119 Coeff_t one(1.0);
120 Coeff_t czero(0.0);
121 chi.Checkerboard()=psi.Checkerboard();
122 int Ls=this->Ls;
123 // Apply (U^{\prime})^{-dagger}
124 axpby_ssp (chi,one,psi, czero,psi,0,0); // chi[0]=psi[0]
125 for (int s=1;s<Ls;s++){
126 axpby_ssp_pminus(chi,one,psi,-conjugate(uee[s-1]),chi,s,s-1);
127 }
128 // U_m^{-\dagger}
129 for (int s=0;s<Ls-1;s++){
130 axpby_ssp_pplus(chi,one,chi,-conjugate(ueem[s]),chi,Ls-1,s);
131 }
132 // L_m^{-\dagger} D^{-dagger}
133 for (int s=0;s<Ls-1;s++){
134 axpby_ssp_pminus(chi,one/conjugate(dee[s]),chi,-conjugate(leem[s]/dee[Ls-1]),chi,s,Ls-1);
135 }
136 axpby_ssp(chi,one/conjugate(dee[Ls-1]),chi,czero,chi,Ls-1,Ls-1); // Modest avoidable
137
138 // Apply L^{-dagger}
139 for (int s=Ls-2;s>=0;s--){
140 axpby_ssp_pplus (chi,one,chi,-conjugate(lee[s]),chi,s,s+1); // chi[Ls]
141 }
142}
143
144
145#ifdef CAYLEY_DPERP_LINALG
146INSTANTIATE_DPERP(WilsonImplF);
147INSTANTIATE_DPERP(WilsonImplD);
148INSTANTIATE_DPERP(GparityWilsonImplF);
149INSTANTIATE_DPERP(GparityWilsonImplD);
150INSTANTIATE_DPERP(ZWilsonImplF);
151INSTANTIATE_DPERP(ZWilsonImplD);
152
153INSTANTIATE_DPERP(WilsonImplFH);
154INSTANTIATE_DPERP(WilsonImplDF);
155INSTANTIATE_DPERP(GparityWilsonImplFH);
156INSTANTIATE_DPERP(GparityWilsonImplDF);
157INSTANTIATE_DPERP(ZWilsonImplFH);
158INSTANTIATE_DPERP(ZWilsonImplDF);
159#endif
160
std::vector< T, uvmAllocator< T > > Vector
#define one
Definition BGQQPX.h:108
GparityWilsonImpl< vComplexF, FundamentalRepresentation, CoeffReal > GparityWilsonImplF
GparityWilsonImpl< vComplexD, FundamentalRepresentation, CoeffReal > GparityWilsonImplD
Lattice< vobj > conjugate(const Lattice< vobj > &lhs)
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)
Definition LinalgUtils.h:59
#define NAMESPACE_BEGIN(A)
Definition Namespace.h:35
#define NAMESPACE_END(A)
Definition Namespace.h:36
WilsonImpl< vComplexF, FundamentalRepresentation, CoeffReal > WilsonImplF
Definition WilsonImpl.h:243
WilsonImpl< vComplexD, FundamentalRepresentation, CoeffComplex > ZWilsonImplD
Definition WilsonImpl.h:249
WilsonImpl< vComplexD, FundamentalRepresentation, CoeffReal > WilsonImplD
Definition WilsonImpl.h:244
WilsonImpl< vComplexF, FundamentalRepresentation, CoeffComplex > ZWilsonImplF
Definition WilsonImpl.h:248
virtual void MooeeInvDag(const FermionField &in, FermionField &out)
virtual void M5Ddag(const FermionField &psi, FermionField &chi)
virtual void M5D(const FermionField &psi, FermionField &chi)
virtual void MooeeInv(const FermionField &in, FermionField &out)