Grid 0.7.0
Reconstruct5Dprop.h
Go to the documentation of this file.
1 /*************************************************************************************
2
3 Grid physics library, www.github.com/paboyle/Grid
4
5 Source file: ./lib/algorithms/iterative/SchurRedBlack.h
6
7 Copyright (C) 2015
8
9Author: Peter Boyle <paboyle@ph.ed.ac.uk>
10
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License along
22 with this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24
25 See the full license in the file "LICENSE" in the top level distribution directory
26 *************************************************************************************/
27 /* END LEGAL */
28#pragma once
29
31
32template<class Field,class PVinverter> class Reconstruct5DfromPhysical {
33 private:
34 PVinverter & PauliVillarsSolver;
35 public:
36
38 // First cut works, 10 Oct 2018.
39 //
40 // Must form a plan to get this into production for Zmobius acceleration
41 // of the Mobius exact AMA corrections.
42 //
43 // TODO : understand absence of contact term in eqns in Hantao's thesis
44 // sol4 is contact term subtracted, but thesis & Brower's paper suggests not.
45 //
46 // Step 1: Localise PV inverse in a routine. [DONE]
47 // Step 2: Schur based PV inverse [DONE]
48 // Step 3: Fourier accelerated PV inverse [DONE]
49 //
51
52 Reconstruct5DfromPhysical(PVinverter &_PauliVillarsSolver)
53 : PauliVillarsSolver(_PauliVillarsSolver)
54 {
55 };
56
57
58 template<class Matrix>
59 void PV(Matrix &_Matrix,const Field &src,Field &sol)
60 {
61 RealD m = _Matrix.Mass();
62 _Matrix.SetMass(1.0);
63 _Matrix.M(src,sol);
64 _Matrix.SetMass(m);
65 }
66 template<class Matrix>
67 void PVdag(Matrix &_Matrix,const Field &src,Field &sol)
68 {
69 RealD m = _Matrix.Mass();
70 _Matrix.SetMass(1.0);
71 _Matrix.Mdag(src,sol);
72 _Matrix.SetMass(m);
73 }
74 template<class Matrix>
75 void operator() (Matrix & _Matrix,const Field &sol4,const Field &src4, Field &sol5){
76
77 int Ls = _Matrix.Ls;
78
79 Field psi4(_Matrix.GaugeGrid());
80 Field psi(_Matrix.FermionGrid());
81 Field A (_Matrix.FermionGrid());
82 Field B (_Matrix.FermionGrid());
83 Field c (_Matrix.FermionGrid());
84
85 typedef typename Matrix::Coeff_t Coeff_t;
86
87 std::cout << GridLogMessage<< " ************************************************" << std::endl;
88 std::cout << GridLogMessage<< " Reconstruct5Dprop: c.f. MADWF algorithm " << std::endl;
89 std::cout << GridLogMessage<< " ************************************************" << std::endl;
90
92 //Import source, include Dminus factors
94 _Matrix.ImportPhysicalFermionSource(src4,B);
95
97 // Set up c from src4
99 PauliVillarsSolver(_Matrix,B,A);
100 _Matrix.Pdag(A,c);
101
103 // Build Pdag PV^-1 Dm P [-sol4,c2,c3... cL]
105 psi4 = - sol4;
106 InsertSlice(psi4, psi, 0 , 0);
107 for (int s=1;s<Ls;s++) {
108 ExtractSlice(psi4,c,s,0);
109 InsertSlice(psi4,psi,s,0);
110 }
111
113 // Pdag PV^-1 Dm P
115 _Matrix.P(psi,B);
116 _Matrix.M(B,A);
117 PauliVillarsSolver(_Matrix,A,B);
118 _Matrix.Pdag(B,A);
119
121 // Reinsert surface prop
123 InsertSlice(sol4,A,0,0);
124
126 // Convert from y back to x
128 _Matrix.P(A,sol5);
129
130 }
131};
132
134
B
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)
GridLogger GridLogMessage(1, "Message", GridLogColours, "NORMAL")
#define NAMESPACE_BEGIN(A)
Definition Namespace.h:35
#define NAMESPACE_END(A)
Definition Namespace.h:36
double RealD
Definition Simd.h:61
void PVdag(Matrix &_Matrix, const Field &src, Field &sol)
void PV(Matrix &_Matrix, const Field &src, Field &sol)
void operator()(Matrix &_Matrix, const Field &sol4, const Field &src4, Field &sol5)
Reconstruct5DfromPhysical(PVinverter &_PauliVillarsSolver)