30 LatticeFermion source;
31 LatticeFermion sol_unprec;
32 LatticeFermion sol_prec;
36 Double s_norm = sqrt(norm2(source));
37 Real factor = Real(1)/Real(s_norm);
45 std::cout <<
"QPROP Prec done" << std::endl << std::flush ;
49 LatticeFermion diff = sol_prec - sol_unprec;
50 Double norm_diff = sqrt(norm2(diff));
52 QDPIO::cout <<
"Prop Diff: " << norm_diff << std::endl;
53 push(xml_out, prefix);
56 write(xml_out,
"prop_diff", norm_diff);
64 const UnprecLinearOperator< LatticeFermion, multi1d<LatticeColorMatrix>, multi1d<LatticeColorMatrix> >& AU)
66 QDPIO::cout <<
"Check linops" << std::endl;
69 LatticeFermion tmpx, tmpy;
74 LatticeFermion tmp1,
tmp2;
75 QDPIO::cout <<
"AP plus" << std::endl;
76 QDPIO::cout <<
"Checking evenEvenInv(PLUS): " << std::endl;
77 AP.evenEvenLinOp(tmpx,
psi,
PLUS);
78 AP.evenEvenInvLinOp(tmpy, tmpx,
PLUS);
79 Double trivial_diff_plus = norm2(tmpy-
psi,even);
80 QDPIO::cout <<
" psi - EvenEvenInv*EvenEven psi: diff = " << trivial_diff_plus
81 <<
" norm2(psi) = " << Real(norm2(
psi,even)) << std::endl;
83 AP.unprecLinOp(tmp1,
psi,
PLUS);
86 QDPIO::cout <<
"AP minus" << std::endl;
87 QDPIO::cout <<
"Checking evenEvenInv(MINUS): " << std::endl;
89 AP.evenEvenInvLinOp(tmpy, tmpx,
MINUS);
90 Double trivial_diff_minus = norm2(tmpy-
psi,even);
91 QDPIO::cout <<
" psi - EvenEvenInv*EvenEven psi: diff = " << trivial_diff_minus
92 <<
" norm2(psi) = " << Real(norm2(
psi,even)) << std::endl;
97 LatticeFermion
tmp3, tmp4;
98 QDPIO::cout <<
"AU plus" << std::endl;
102 QDPIO::cout <<
"AU minus" << std::endl;
106 push(xml_out,prefix+
"LinOpInnerprods");
107 write(xml_out,
"trivial_diff_plus", trivial_diff_plus);
108 write(xml_out,
"nnP_plus", nnP_plus);
109 write(xml_out,
"nnU_plus", nnU_plus);
111 Double norm_diff_plus_e = norm2(tmp1-
tmp3,even);
112 Double norm_diff_plus_o = norm2(tmp1-
tmp3,odd);
113 norm_diff_plus += norm_diff_plus_e + norm_diff_plus_o;
114 QDPIO::cout <<
"PLUS, EVEN: Prec(Full) - Unprec: diff = " << norm_diff_plus_e << std::endl;
115 QDPIO::cout <<
"PLUS, ODD: Prec(Full) - Unprec: diff = " << norm_diff_plus_o << std::endl;
117 write(xml_out,
"norm_diff_plus", norm_diff_plus);
118 write(xml_out,
"norm_diff_plus_even", norm_diff_plus_e);
119 write(xml_out,
"norm_diff_plus_odd", norm_diff_plus_o);
121 write(xml_out,
"trivial_diff_minus", trivial_diff_minus);
122 write(xml_out,
"nnP_minus", nnP_minus);
123 write(xml_out,
"nnU_minus", nnU_minus);
125 Double norm_diff_minus_e = norm2(
tmp2-tmp4,even);
126 Double norm_diff_minus_o = norm2(
tmp2-tmp4, odd);
127 norm_diff_minus += norm_diff_minus_e + norm_diff_minus_o;
128 QDPIO::cout <<
"MINUS,EVEN: Prec(Full) - Unprec: diff = " << norm_diff_minus_e << std::endl;
129 QDPIO::cout <<
"MINUS,ODD: Prec(Full) - Unprec: diff = " << norm_diff_minus_o << std::endl;
131 write(xml_out,
"norm_diff_minus", norm_diff_minus);
132 write(xml_out,
"norm_diff_minus_even", norm_diff_minus_e);
133 write(xml_out,
"norm_diff_minus_odd", norm_diff_minus_o);
140 multi1d<LatticeColorMatrix>
142 multi1d<LatticeColorMatrix>,
143 multi1d<LatticeColorMatrix> >& AP,
144 const LatticeFermion&
chi,
const LatticeFermion&
psi,
153 multi1d<LatticeColorMatrix> ds_u, ds_1;
172 AP.evenOddLinOp(tmp1,
chi, msign);
173 AP.evenEvenInvLinOp(
tmp3, tmp1, msign);
178 AP.evenOddLinOp(tmp1,
chi, msign);
179 AP.evenEvenInvLinOp(
tmp3, tmp1, msign);
191 const UnprecLinearOperator< LatticeFermion, multi1d<LatticeColorMatrix>, multi1d<LatticeColorMatrix> >& AU)
193 QDPIO::cout <<
"Check derivs" << std::endl;
200 multi1d<LatticeColorMatrix> ds_1, ds_2;
201 QDPIO::cout <<
"AP plus" << std::endl;
203 Double nnP_plus = norm2(ds_1);
205 QDPIO::cout <<
"AP minus" << std::endl;
207 Double nnP_minus = norm2(ds_2);
209 for(
int m=0;
m <
Nd; ++
m)
210 norm_diff_prec += norm2(ds_1[
m]-ds_2[
m]);
212 multi1d<LatticeColorMatrix> ds_tmp;
215 Double norm_diff_check_prec_plus = norm2(ds_tmp);
219 Double norm_diff_check_prec_minus = norm2(ds_tmp);
221 multi1d<LatticeColorMatrix> ds_3, ds_4;
222 QDPIO::cout <<
"AU plus" << std::endl;
224 Double nnU_plus = norm2(ds_3);
226 QDPIO::cout <<
"AP minus" << std::endl;
228 Double nnU_minus = norm2(ds_4);
230 for(
int m=0;
m <
Nd; ++
m)
231 norm_diff_unprec += norm2(ds_3[
m]-ds_4[
m]);
233 push(xml_out,prefix+
"DerivInnerprods");
234 write(xml_out,
"norm_diff_check_prec_plus", norm_diff_check_prec_plus);
235 write(xml_out,
"norm_diff_check_prec_minus", norm_diff_check_prec_minus);
237 write(xml_out,
"nnP_plus", nnP_plus);
238 write(xml_out,
"nnU_plus", nnU_plus);
240 for(
int m=0;
m <
Nd; ++
m)
241 norm_diff_plus += norm2(ds_1[
m]-ds_3[
m]);
242 write(xml_out,
"norm_diff_plus", norm_diff_plus);
243 write(xml_out,
"norm_diff_prec", norm_diff_plus);
245 write(xml_out,
"nnP_minus", nnP_minus);
246 write(xml_out,
"nnU_minus", nnU_minus);
248 for(
int m=0;
m <
Nd; ++
m)
249 norm_diff_minus += norm2(ds_2[
m]-ds_4[
m]);
250 write(xml_out,
"norm_diff_minus", norm_diff_minus);
251 write(xml_out,
"norm_diff_unprec", norm_diff_plus);
279 XMLReader paramtop(xml, path);
288 XMLReader inputtop(xml, path);
297 read(inputtop,
"Cfg", input.
cfg);
301 XMLReader xml_action(inputtop,
"UnprecAction");
302 std::ostringstream os;
303 xml_action.print(os);
309 XMLReader xml_action(inputtop,
"PrecAction");
310 std::ostringstream os;
311 xml_action.print(os);
317 QDPIO::cerr <<
"Error reading test data: " << e << std::endl;
325 int main(
int argc,
char **argv)
330 QDPIO::cout <<
"linkage=" <<
linkage_hack() << std::endl;
342 read(xml_in,
"/t_precact", input);
346 QDPIO::cerr <<
"t_precact_4d: Caught Exception reading XML: " << e << std::endl;
351 QDPIO::cerr <<
"t_precact_4d: caught generic exception reading XML" << std::endl;
359 QDPIO::cout <<
"t_precact" << std::endl;
362 multi1d<LatticeColorMatrix>
u(
Nd);
363 XMLReader gauge_file_xml, gauge_xml;
370 push(xml_out,
"t_precact");
375 write(xml_out,
"Input", xml_in);
378 write(xml_out,
"Config_info", gauge_xml);
384 MesPlq(xml_out,
"Observables",
u);
390 std::istringstream xml_s_eo(input.
action_eo);
391 std::istringstream xml_s_un(input.
action_un);
392 XMLReader fermacttop_eo(xml_s_eo);
393 XMLReader fermacttop_un(xml_s_un);
394 const std::string fermact_path_eo =
"/PrecAction/FermionAction";
395 const std::string fermact_path_un =
"/UnprecAction/FermionAction";
401 read(fermacttop_eo, fermact_path_eo +
"/FermAct", fermact_eo);
402 read(fermacttop_un, fermact_path_un +
"/FermAct", fermact_un);
406 QDPIO::cerr <<
"Error reading fermact: " << e << std::endl;
409 catch (
const char* e)
411 QDPIO::cerr <<
"Error reading fermact: " << e << std::endl;
415 QDPIO::cout <<
"PrecFermAct = " << fermact_eo << std::endl;
416 QDPIO::cout <<
"UnprecFermAct = " << fermact_un << std::endl;
426 const std::string state_info_path_eo =
"/PrecAction/StateInfo";
427 const std::string state_info_path_un =
"/UnprecAction/StateInfo";
428 XMLReader state_info_xml_eo(fermacttop_eo,state_info_path_eo);
429 XMLReader state_info_xml_un(fermacttop_un,state_info_path_un);
432 typedef LatticeFermion
T;
433 typedef multi1d<LatticeColorMatrix>
P;
434 typedef multi1d<LatticeColorMatrix>
Q;
437 bool success =
false;
439 QDPIO::cerr <<
"create prec = " << fermact_eo << std::endl;
449 state_info_path_eo));
452 QDPIO::cerr <<
"create unprec = " << fermact_un << std::endl;
461 state_info_path_un));
469 QDPIO::cout <<
"Check bulk linops" << std::endl;
476 QDPIO::cout <<
"Got Preconditioned System Solver" << std::endl;
480 QDPIO::cout <<
"Got Unprec System Solver " << std::endl;
482 QDPIO::cout <<
"Check qprop" << std::endl;
486 QDPIO::cout <<
"Check bulk derivatives" << std::endl;
494 QDPIO::cerr <<
"Error in t_precact: " << e << std::endl;
497 catch (
const char* e)
499 QDPIO::cerr <<
"Error in t_precact: " << e << std::endl;
Primary include file for CHROMA in application codes.
Even-odd preconditioned linear operator.
Even-odd preconditioned Wilson-like fermion actions including derivatives.
Class for counted reference semantics.
Unpreconditioned linear operator including derivatives.
Unpreconditioned Wilson-like fermion actions with derivatives.
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams ¶m)
Read parameters.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams ¶m)
Writer parameters.
void unitarityCheck(const multi1d< LatticeColorMatrixF3 > &u)
Check the unitarity of color matrix in SU(N)
void gaugeStartup(XMLReader &gauge_file_xml, XMLReader &gauge_xml, multi1d< LatticeColorMatrix > &u, Cfg_t &cfg)
Initialize the gauge fields.
void proginfo(XMLWriter &xml)
Print out basic information about this program.
GroupXML_t readXMLGroup(XMLReader &xml_in, const std::string &path, const std::string &type_name)
Read group and return as a std::string.
multi1d< LatticeColorMatrix > P
BinaryReturn< C1, C2, FnInnerProduct >::Type_t innerProduct(const QDPSubType< T1, C1 > &s1, const QDPType< T2, C2 > &s2)
bool registerAll()
Register all the factories.
Asqtad Staggered-Dirac operator.
static multi1d< LatticeColorMatrix > u
LinOpSysSolverMGProtoClover::Q Q
push(xml_out,"Condensates")
LinOpSysSolverMGProtoClover::T T
void initialize(int *argc, char ***argv)
Chroma initialisation routine.
void finalize(void)
Chroma finalization routine.
multi1d< LatticeFermion > chi(Ncb)
std::string getXMLInputFileName()
Get input file name.
void MesPlq(const multi1d< LatticeColorMatrixF3 > &u, multi2d< Double > &plane_plaq, Double &link)
XMLFileWriter & getXMLOutputInstance()
Get xml output instance.
FloatingPoint< double > Double
Gauge configuration structure.
Hold group xml and type id.
Holds return info from SystemSolver call.
Parameters for running program.
SysSolverCGParams invParam
void check_qprop(XMLWriter &xml_out, const std::string &prefix, const SystemSolver< LatticeFermion > &PP, const SystemSolver< LatticeFermion > &UP)
Check Qprop.
bool linkage_hack()
To insure linking of code, place the registered code flags here.
int main(int argc, char **argv)
void check_linops(XMLWriter &xml_out, const std::string &prefix, const EvenOddPrecLinearOperator< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > &AP, const UnprecLinearOperator< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > &AU)
Check linops.
multi1d< LatticeColorMatrix > deriv(const EvenOddPrecLinearOperator< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > &AP, const LatticeFermion &chi, const LatticeFermion &psi, enum PlusMinus isign)
Apply the operator onto a source std::vector.
void check_derivs(XMLWriter &xml_out, const std::string &prefix, const EvenOddPrecLinearOperator< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > &AP, const UnprecLinearOperator< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > &AU)
Check linops.