CHROMA
t_preccfz_opt.cc
Go to the documentation of this file.
1 
2 #include <iostream>
3 #include <cstdio>
4 
5 #include "chroma.h"
7 
8 using namespace Chroma;
9 
10 
11 int main(int argc, char **argv)
12 {
13  // Put the machine into a known state
14  Chroma::initialize(&argc, &argv);
15 
16  // Setup the layout
17  const int foo[] = {2,2,2,2};
18  multi1d<int> nrow(Nd);
19  nrow = foo; // Use only Nd elements
20  Layout::setLattSize(nrow);
21  Layout::create();
22 
23  XMLFileWriter xml("t_preccfz_opt.xml");
24  push(xml, "t_preccfz_opt");
25 
26  multi1d<LatticeColorMatrix> u(Nd);
27  for(int m=0; m < u.size(); ++m)
28  gaussian(u[m]);
29 
30  // Create a FermBC with only periodic BC. Note the handle is on an abstract type.
31  Handle<FermBC< multi1d<LatticeFermion> > > fbc_a(new PeriodicFermBC< multi1d<LatticeFermion> >);
32 
33  // DWDslash class can be optimised
34 
36  p.Mass =Real(0.06);
37  p.RatPolyDeg=6;
38  p.approximation_type=COEFF_TYPE_ZOLOTAREV;
39  p.OverMass = Real(1.4);
40  p.ApproxMin = 0.66;
41  p.ApproxMax = 6.4635;
42 
44 
45  // We have two cases.
47 
48  multi1d<Real> alpha;
49  multi1d<Real> beta;
50  Real scale_factor;
51 
52  const OverlapConnectState& ov_state =
53  dynamic_cast<const OverlapConnectState&>(*state);
54 
55  S_pdwf.init(scale_factor, alpha, beta, ov_state);
56 
57  // Compare linops
58  int N5 = S_pdwf.size();
59  {
60  bool isLastZeroP = ( p.RatPolyDeg % 2 == 0 ) ? true : false;
61 
63  p.Mass,
64  p.OverMass,
65  N5,
66  scale_factor,
67  alpha,
68  beta,
69  isLastZeroP);
70 
72  p.Mass,
73  p.OverMass,
74  N5,
75  scale_factor,
76  alpha,
77  beta,
78  isLastZeroP);
79 
80  multi1d<LatticeFermion> chi5a(N5), chi5b(N5), psi5(N5), tmp1(N5);
81  for(int m=0; m < N5; ++m)
82  {
83  gaussian(psi5[m]);
84  }
85  chi5a = chi5b = zero;
86 
87  D_qdp(chi5a, psi5, PLUS);
88  D_opt(chi5b, psi5, PLUS);
89 
90 // push(xml,"Plus");
91 // write(xml,"chi5a",chi5a);
92 // write(xml,"chi5b",chi5b);
93 // pop(xml);
94 
95  tmp1 = chi5a;
96  tmp1 -= chi5b;
97 
98  QDPIO::cout << "Test eo-prec and opt eo-prec CFZ linop PLUS" << std::endl
99  << "|qCFZ|^2 = " << norm2(chi5a) << std::endl
100  << "|oCFZ|^2 = " << norm2(chi5b) << std::endl
101  << "|qCFZ - oCFZ|^2 = " << norm2(tmp1) << std::endl;
102 
103  D_qdp(chi5a, psi5, MINUS);
104  D_opt(chi5b, psi5, MINUS);
105 
106 // push(xml,"Minus");
107 // write(xml,"chi5a",chi5a);
108 // write(xml,"chi5b",chi5b);
109 // pop(xml);
110 
111  tmp1 = chi5a;
112  tmp1 -= chi5b;
113 
114  QDPIO::cout << "Test eo-prec and opt eo-prec CFZ linop MINUS" << std::endl
115  << "|qCFZ|^2 = " << norm2(chi5a) << std::endl
116  << "|oCFZ|^2 = " << norm2(chi5b) << std::endl
117  << "|qCFZ - oCFZ|^2 = " << norm2(tmp1) << std::endl;
118  }
119 
120  QDPIO::cout << "\n\n\nDone" << std::endl;
121 
122  pop(xml);
123 
124  // Time to bolt
126 
127  exit(0);
128 }
Primary include file for CHROMA in application codes.
5D continued fraction overlap action (Borici,Wenger, Edwards)
void init(Real &scale_fac, multi1d< Real > &alpha, multi1d< Real > &beta) const
Helper in construction.
virtual FermState< T, P, Q > * createState(const Q &q) const
Given links (coordinates Q) create the state needed for the linear operators.
Definition: fermact.h:59
Class for counted reference semantics.
Definition: handle.h:33
Optimized Even-odd prec. 5D continued fraction linop.
Overlap connection state.
Definition: overlap_state.h:26
Concrete class for all fermionic actions with trivial boundary conditions.
@ COEFF_TYPE_ZOLOTAREV
static int m[4]
Definition: make_seeds.cc:16
Nd
Definition: meslate.cc:74
static const LatticeInteger & beta(const int dim)
Definition: stag_phases_s.h:47
static const LatticeInteger & alpha(const int dim)
Definition: stag_phases_s.h:43
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
gaussian(aux)
static multi1d< LatticeColorMatrix > u
push(xml_out,"Condensates")
void initialize(int *argc, char ***argv)
Chroma initialisation routine.
Definition: chroma_init.cc:114
@ MINUS
Definition: chromabase.h:45
@ PLUS
Definition: chromabase.h:45
void finalize(void)
Chroma finalization routine.
Definition: chroma_init.cc:308
pop(xml_out)
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
Definition: pbg5p_w.cc:28
Double zero
Definition: invbicg.cc:106
int main(int argc, char **argv)