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