Grid 0.7.0
EvenOddSchurDifferentiable.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/pseudofermion/EvenOddSchurDifferentiable.h
6
7 Copyright (C) 2015
8
9Author: Peter Boyle <paboyle@ph.ed.ac.uk>
10Author: Guido Cossu <guido.cossu@ed.ac.uk>
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License along
23 with this program; if not, write to the Free Software Foundation, Inc.,
24 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25
26 See the full license in the file "LICENSE" in the top level distribution directory
27*************************************************************************************/
28/* END LEGAL */
29#ifndef QCD_EVEN_ODD_SCHUR_DIFFERENTIABLE_H
30#define QCD_EVEN_ODD_SCHUR_DIFFERENTIABLE_H
31
33
34// Base even odd HMC on the normal Mee based schur decomposition.
35//
36// M = (Mee Meo) = (1 0 ) (Mee 0 ) (1 Mee^{-1} Meo)
37// (Moe Moo) (Moe Mee^-1 1 ) (0 Moo-Moe Mee^-1 Meo) (0 1 )
38//
39// Determinant is det of middle factor
40// This assumes Mee is indept of U.
41//
42template<class Impl>
43class SchurDifferentiableOperator : public SchurDiagMooeeOperator<FermionOperator<Impl>,typename Impl::FermionField>
44{
45public:
47
49
51
52 void MpcDeriv(GaugeField &Force,const FermionField &U,const FermionField &V) {
53
54 GridBase *fgrid = this->_Mat.FermionGrid();
55 GridBase *fcbgrid = this->_Mat.FermionRedBlackGrid();
56
57 FermionField tmp1(fcbgrid);
58 FermionField tmp2(fcbgrid);
59
60 conformable(fcbgrid,U.Grid());
61 conformable(fcbgrid,V.Grid());
62
63 // Assert the checkerboard?? or code for either
64 assert(U.Checkerboard()==Odd);
65 assert(V.Checkerboard()==U.Checkerboard());
66
67 // NOTE Guido: WE DO NOT WANT TO USE THE ucbgrid GRID FOR THE FORCE
68 // it is not conformable with the HMC force field
69 // Case: Ls vectorised fields
70 // INHERIT FROM THE Force field instead
71 GridRedBlackCartesian* forcecb = new GridRedBlackCartesian(Force.Grid());
72 GaugeField ForceO(forcecb);
73 GaugeField ForceE(forcecb);
74
75
76 // X^dag Der_oe MeeInv Meo Y
77 // Use Mooee as nontrivial but gauge field indept
78 this->_Mat.Meooe (V,tmp1); // odd->even -- implicit -0.5 factor to be applied
79 this->_Mat.MooeeInv(tmp1,tmp2); // even->even
80 this->_Mat.MoeDeriv(ForceO,U,tmp2,DaggerNo);
81 // Accumulate X^dag M_oe MeeInv Der_eo Y
82 this->_Mat.MeooeDag (U,tmp1); // even->odd -- implicit -0.5 factor to be applied
83 this->_Mat.MooeeInvDag(tmp1,tmp2); // even->even
84 this->_Mat.MeoDeriv(ForceE,tmp2,V,DaggerNo);
85
86 assert(ForceE.Checkerboard()==Even);
87 assert(ForceO.Checkerboard()==Odd);
88
89 setCheckerboard(Force,ForceE);
90 setCheckerboard(Force,ForceO);
91 Force=-Force;
92
93 delete forcecb;
94 }
95
96
97 void MpcDagDeriv(GaugeField &Force,const FermionField &U,const FermionField &V) {
98
99 GridBase *fgrid = this->_Mat.FermionGrid();
100 GridBase *fcbgrid = this->_Mat.FermionRedBlackGrid();
101
102 FermionField tmp1(fcbgrid);
103 FermionField tmp2(fcbgrid);
104
105 conformable(fcbgrid,U.Grid());
106 conformable(fcbgrid,V.Grid());
107
108 // Assert the checkerboard?? or code for either
109 assert(V.Checkerboard()==Odd);
110 assert(V.Checkerboard()==V.Checkerboard());
111
112 // NOTE Guido: WE DO NOT WANT TO USE THE ucbgrid GRID FOR THE FORCE
113 // it is not conformable with the HMC force field
114 // INHERIT FROM THE Force field instead
115 GridRedBlackCartesian* forcecb = new GridRedBlackCartesian(Force.Grid());
116 GaugeField ForceO(forcecb);
117 GaugeField ForceE(forcecb);
118
119 // X^dag Der_oe MeeInv Meo Y
120 // Use Mooee as nontrivial but gauge field indept
121 this->_Mat.MeooeDag (V,tmp1); // odd->even -- implicit -0.5 factor to be applied
122 this->_Mat.MooeeInvDag(tmp1,tmp2); // even->even
123 this->_Mat.MoeDeriv(ForceO,U,tmp2,DaggerYes);
124
125 // Accumulate X^dag M_oe MeeInv Der_eo Y
126 this->_Mat.Meooe (U,tmp1); // even->odd -- implicit -0.5 factor to be applied
127 this->_Mat.MooeeInv(tmp1,tmp2); // even->even
128 this->_Mat.MeoDeriv(ForceE,tmp2,V,DaggerYes);
129
130 assert(ForceE.Checkerboard()==Even);
131 assert(ForceO.Checkerboard()==Odd);
132
133 setCheckerboard(Force,ForceE);
134 setCheckerboard(Force,ForceO);
135 Force=-Force;
136
137 delete forcecb;
138 }
139
140};
141
143
144#endif
static const int Even
static const int Odd
void conformable(const Lattice< obj1 > &lhs, const Lattice< obj2 > &rhs)
void setCheckerboard(Lattice< vobj > &full, const Lattice< vobj > &half)
#define NAMESPACE_BEGIN(A)
Definition Namespace.h:35
#define NAMESPACE_END(A)
Definition Namespace.h:36
static constexpr int DaggerYes
Definition QCD.h:70
static constexpr int DaggerNo
Definition QCD.h:69
static INTERNAL_PRECISION U
Definition Zolotarev.cc:230
void MpcDagDeriv(GaugeField &Force, const FermionField &U, const FermionField &V)
void MpcDeriv(GaugeField &Force, const FermionField &U, const FermionField &V)