CHROMA
seoprec_constdet_linop.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! @file
3  * @brief Preconditioned 4D Linop with Gauge Independent Even-Even part
4  */
5 
6 #ifndef __seoprec_constdet_linop_h__
7 #define __seoprec_constdet_linop_h__
8 
9 #include "seoprec_linop.h"
10 
11 using namespace QDP::Hints;
12 
13 namespace Chroma
14 {
15 
16 //----------------------------------------------------------------
17 //! Even-odd preconditioned linear operator
18 /*! @ingroup linop
19  *
20  * Support for even-odd preconditioned linear operators
21  * Given a matrix M written in block form:
22  *
23  * [ A D ]
24  * [ E,E E,O ]
25  * [ ]
26  * [ D A ]
27  * [ O,E O,O ]
28  *
29  * The preconditioning consists of factorizing as
30  *
31  *
32  * M_unprec = M_diag x M'
33  *
34  *
35  * M_diag = [ A_E,E 0 ]
36  * [ 0 A_O,O ]
37  *
38  * [ 1 M_E,O ]
39  * M' = [ ]
40  * [ M_O,E 1 ]
41  *
42  *
43  * M_E,O = A^{-1}_E,E D_E,O
44  * M_O,E = A^{-1}_O,O D_E,O
45  *
46  * We then do a schur precondition of M'
47  *
48  * as M' = L M R
49  *
50  *
51  * L = [ 1 0 ]
52  * [ ]
53  * [ M_O,E 1 ]
54  *
55  *
56  *
57  * R = [ 1 M_E,O ]
58  * [ ]
59  * [ 0 1 ]
60  *
61  *
62  * M = [ 1 0 ]
63  * [ ]
64  * [ 0 S ]
65  *
66  * where S = 1 - ( M_O,E )( M_E,O )
67  *
68  *
69  * L^{-1} = [ 1 0 ]
70  * [ ]
71  * [- M_O,E 1 ]
72  *
73  *
74  *
75  * R^{-1} = [ 1 - M_E,O ]
76  * [ ]
77  * [ 0 1 ]
78  *
79  *
80  *
81  * For props we need to solve:
82  *
83  * M x' = L^{-1} (M_diag)^{-1} b
84  *
85  * and then x = R^{-1} x' (backsubstitution)
86  *
87  * for HMC we have det(L)=1 det(R)=1
88  * det(M_diag) is handled by TraceLog/LogDet calls to clover
89  * and we pseudofermionize only the 'S' operators
90  *
91  *
92  * Structure: capture D_oe, D_eo, A_ee, A_oo, A^{-1}_oo and A^{-1}_ee
93  * as
94  * unprecEvenOddLinOp
95  * unprecOddEvenLinOp
96  * unprecEvenEvenLinOp
97  * unprecOddOddLinOp
98  * unprecOddOddInvLinOp
99  * unprecEvenEvenInvLinOp
100  *
101  * then we can write category defaults for:
102  *
103  * then
104  * evenOddLinOp is M_eo = A^{-1}_ee D_eo or h.c.
105  * oddEvenLinOp is M_oe = A^{-1}_oo D_oe or h.c.
106  *
107  * the so called Jacobi Operator:
108  * [ 1 M_eo ]
109  * [ M_oe 1 ]
110  *
111  * the Schur Operator: S = 1 - M_oe M_eo
112  *
113  * the Unprec Operator: diag( A_ee A_oo ) M_jacobi
114  *
115  * We can also write category default for the forces in terms
116  * of
117  * derivEvenOddLinOp
118  * and derivOddEvenLinOp
119  *
120  * Const-detness or log-det ness will depend on how the
121  * derivEvenOdd and derivOddEven operators are coded
122 
123  *
124  */
125  template<typename T, typename P, typename Q>
127  {
128  public:
129  //! Virtual destructor to help with cleanup;
131 
132  //! Return the fermion BC object for this linear operator
133  virtual const FermBC<T,P,Q>& getFermBC() const = 0;
134 
135  //! Apply the inverse of the even-even block onto a source std::vector
136  virtual void unprecEvenEvenInvLinOp(T& chi, const T& psi,
137  enum PlusMinus isign) const override = 0;
138 
139  //! Apply the inverse of the odd-odd block onto a source std::vector
140  virtual void unprecOddOddInvLinOp(T& chi, const T& psi,
141  enum PlusMinus isign) const override = 0;
142 
143  //! Apply the even-even block onto a source std::vector
144  /*! This does not need to be optimized */
145  virtual void unprecEvenEvenLinOp(T& chi, const T& psi,
146  enum PlusMinus isign) const override = 0;
147 
148  //! Apply the odd-odd block onto a source std::vector
149  /*! This does not need to be optimized */
150  virtual void unprecOddOddLinOp(T& chi, const T& psi,
151  enum PlusMinus isign) const override = 0;
152 
153  //! Apply the even-odd block onto a source std::vector
154  /*! This does not need to be optimized */
155  virtual void unprecEvenOddLinOp(T& chi, const T& psi,
156  enum PlusMinus isign) const override = 0;
157 
158  //! Apply the odd-even block onto a source std::vector
159  /*! This does not need to be optimized */
160  virtual void unprecOddEvenLinOp(T& chi, const T& psi,
161  enum PlusMinus isign) const override = 0;
162 
163  virtual void derivUnprecEvenOddLinOp(P& ds_u, const T& chi, const T& psi,
164  enum PlusMinus isign) const = 0;
165 
166  virtual void derivUnprecOddEvenLinOp(P& ds_u, const T& chi, const T& psi,
167  enum PlusMinus isign) const = 0;
168 
169  //! Apply the the even-odd block onto a source std::vector
170  virtual void derivEvenOddLinOp(P& ds_u, const T& chi, const T& psi,
171  enum PlusMinus isign) const override
172  {
173  ds_u.resize(Nd);
174  ds_u = zero;
175 
176  T tmp; moveToFastMemoryHint(tmp);
177  if( isign == PLUS ) {
178  unprecEvenEvenInvLinOp(tmp,chi,MINUS);
179  derivUnprecEvenOddLinOp(ds_u, tmp, psi, PLUS);
180  }
181  else {
182  unprecOddOddInvLinOp(tmp,psi,MINUS);
183  derivUnprecEvenOddLinOp(ds_u,chi, tmp, MINUS);
184 
185  }
186  getFermBC().zero(ds_u);
187  }
188 
189  //! Apply the the odd-even block onto a source std::vector
190  virtual void derivOddEvenLinOp(P& ds_u, const T& chi, const T& psi,
191  enum PlusMinus isign) const override
192  {
193  ds_u.resize(Nd);
194  ds_u = zero;
195 
196  T tmp; moveToFastMemoryHint(tmp);
197  if( isign == PLUS ) {
198  unprecOddOddInvLinOp(tmp,chi,MINUS);
199  derivUnprecOddEvenLinOp(ds_u, tmp, psi, PLUS);
200  }
201  else {
202  unprecEvenEvenLinOp(tmp,psi,MINUS);
203  derivUnprecEvenOddLinOp(ds_u,chi, tmp, MINUS);
204 
205  }
206  getFermBC().zero(ds_u);
207  }
208 
209 
210 
211  };
212 
213 
214 
215 }
216 #endif
Base class for all fermion action boundary conditions.
Definition: fermbc.h:20
Even-odd preconditioned linear operator.
virtual ~SymEvenOddPrecConstDetLinearOperator()
Virtual destructor to help with cleanup;.
virtual void derivUnprecOddEvenLinOp(P &ds_u, const T &chi, const T &psi, enum PlusMinus isign) const =0
virtual void unprecOddOddLinOp(T &chi, const T &psi, enum PlusMinus isign) const override=0
Apply the odd-odd block onto a source std::vector.
virtual void unprecOddEvenLinOp(T &chi, const T &psi, enum PlusMinus isign) const override=0
Apply the odd-even block onto a source std::vector.
virtual void unprecEvenEvenLinOp(T &chi, const T &psi, enum PlusMinus isign) const override=0
Apply the even-even block onto a source std::vector.
virtual void derivUnprecEvenOddLinOp(P &ds_u, const T &chi, const T &psi, enum PlusMinus isign) const =0
virtual void unprecOddOddInvLinOp(T &chi, const T &psi, enum PlusMinus isign) const override=0
Apply the inverse of the odd-odd block onto a source std::vector.
virtual void unprecEvenEvenInvLinOp(T &chi, const T &psi, enum PlusMinus isign) const override=0
Apply the inverse of the even-even block onto a source std::vector.
virtual void derivOddEvenLinOp(P &ds_u, const T &chi, const T &psi, enum PlusMinus isign) const override
Apply the the odd-even block onto a source std::vector.
virtual void unprecEvenOddLinOp(T &chi, const T &psi, enum PlusMinus isign) const override=0
Apply the even-odd block onto a source std::vector.
virtual void derivEvenOddLinOp(P &ds_u, const T &chi, const T &psi, enum PlusMinus isign) const override
Apply the the even-odd block onto a source std::vector.
virtual const FermBC< T, P, Q > & getFermBC() const =0
Return the fermion BC object for this linear operator.
Even-odd preconditioned linear operator.
Double tmp
Definition: meslate.cc:60
Nd
Definition: meslate.cc:74
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
LinOpSysSolverMGProtoClover::T T
@ MINUS
Definition: chromabase.h:45
@ PLUS
Definition: chromabase.h:45
Double zero
Definition: invbicg.cc:106
chi
Definition: pade_trln_w.cc:24
psi
Definition: pade_trln_w.cc:191
Base class for symmetric even-odd preconditioned 4D and 5D Linop.
multi1d< LatticeColorMatrix > P
Definition: t_clover.cc:13