CHROMA
t_precact_5d.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Test 5d fermion actions
3  */
4 
5 #include <iostream>
6 #include <cstdio>
7 
8 #include "chroma.h"
9 
10 #include "qdp_util.h"
11 
12 using namespace Chroma;
13 
14 
15 //! To insure linking of code, place the registered code flags here
16 /*! This is the bit of code that dictates what fermacts are in use */
18 {
19  bool foo = true;
20  // All actions
22  return foo;
23 }
24 
25 //! Check Qprop
26 void check_qprop(XMLWriter& xml_out, const std::string& prefix,
29 {
30  QDPIO::cout << __func__ << ": entering" << std::endl;
31 
32  LatticeFermion source;
33  LatticeFermion sol_unprec;
34  LatticeFermion sol_prec;
35 
36  // Make some kind of source
37  gaussian(source);
38  Double s_norm = sqrt(norm2(source));
39  Real factor = Real(1)/Real(s_norm);
40  source *= factor;
41 
42  sol_prec=zero;
43  sol_unprec=zero;
44 
45  // Do solution one;
46  SystemSolverResults_t res1 = PP(sol_prec, source);
47  std::cout << "QPROP Prec done" << std::endl << std::flush ;
48 
49  SystemSolverResults_t res2 = UP(sol_unprec, source);
50 
51  LatticeFermion diff = sol_prec - sol_unprec;
52  Double norm_diff = sqrt(norm2(diff));
53 
54  QDPIO::cout << "Prop Diff: " << norm_diff << std::endl;
55  push(xml_out, prefix);
56  write(xml_out, "n_count1", res1.n_count);
57  write(xml_out, "n_count2", res2.n_count);
58  write(xml_out, "prop_diff", norm_diff);
59  pop(xml_out);
60 
61  QDPIO::cout << __func__ << ": exiting" << std::endl;
62 }
63 
64 
65 //! Check QpropT
66 void check_qpropT(XMLWriter& xml_out, const std::string& prefix,
69 {
70  QDPIO::cout << __func__ << ": entering" << std::endl;
71 
72  const int N5 = PP.size();
73  multi1d<LatticeFermion> source(N5);
74  multi1d<LatticeFermion> sol_unprec(N5);
75  multi1d<LatticeFermion> sol_prec(N5);
76 
77  // Make some kind of source
78  for(int n=0; n < PP.size(); ++n)
79  gaussian(source[n]);
80  Double s_norm = sqrt(norm2(source));
81  Real factor = Real(1)/Real(s_norm);
82  for(int n=0; n < PP.size(); ++n)
83  source[n] *= factor;
84 
85  sol_prec=zero;
86  sol_unprec=zero;
87 
88  // Do solution one;
89  SystemSolverResults_t res1 = PP(sol_prec, source);
90  std::cout << "QPROP Prec done" << std::endl << std::flush ;
91 
92  SystemSolverResults_t res2 = UP(sol_unprec, source);
93 
94  multi1d<LatticeFermion> diff(N5);
95  for(int n=0; n < PP.size(); ++n)
96  diff[n] = sol_prec[n] - sol_unprec[n];
97  Double norm_diff = sqrt(norm2(diff));
98 
99  QDPIO::cout << "Prop Diff: " << norm_diff << std::endl;
100  push(xml_out, prefix);
101  write(xml_out, "n_count1", res1.n_count);
102  write(xml_out, "n_count2", res2.n_count);
103  write(xml_out, "prop_diff", norm_diff);
104  pop(xml_out);
105 
106  QDPIO::cout << __func__ << ": exiting" << std::endl;
107 }
108 
109 
110 //! Check linops
111 void check_linops(XMLWriter& xml_out, const std::string& prefix,
112  const EvenOddPrecLinearOperatorArray<LatticeFermion, multi1d<LatticeColorMatrix>, multi1d<LatticeColorMatrix> >& AP,
113  const UnprecLinearOperatorArray<LatticeFermion, multi1d<LatticeColorMatrix>, multi1d<LatticeColorMatrix> >& AU)
114 {
115  QDPIO::cout << "Check linops" << std::endl;
116 
117  const int N5 = AP.size();
118  multi1d<LatticeFermion> psi(N5), chi(N5);
119  multi1d<LatticeFermion> tmpx(N5), tmpy(N5);
120 
121  for(int m=0; m < N5; ++m)
122  {
123  gaussian(psi[m]);
124  gaussian(chi[m]);
125  }
126 
127  multi1d<LatticeFermion> tmp1(N5), tmp2(N5);
128  QDPIO::cout << "AP plus" << std::endl;
129  QDPIO::cout << "Cheking evenEvenInv(PLUS): " << std::endl;
130  AP.evenEvenLinOp(tmpx, psi, PLUS);
131  AP.evenEvenInvLinOp(tmpy, tmpx, PLUS);
132  Double trivial_diff_plus = zero;
133  for(int m=0; m < N5; ++m) {
134  Double foo = norm2(tmpy[m]-psi[m],even);
135  QDPIO::cout << " psi - EvenEvenInv*EvenEven psi: m = " << m << " diff = " << foo << std::endl;
136 
137  trivial_diff_plus += foo;
138  }
139 
140  AP.unprecLinOp(tmp1, psi, PLUS);
141  DComplex nnP_plus = zero;
142  multi1d<DComplex> nnP_plus_array(N5);
143 
144  for(int m=0; m < N5; ++m) {
145  nnP_plus_array[m] = innerProduct(chi[m], tmp1[m]);
146  nnP_plus += nnP_plus_array[m];
147  }
148 
149  QDPIO::cout << "AP minus" << std::endl;
150  QDPIO::cout << "Cheking evenEvenInv(MINUS): " << std::endl;
151  AP.evenEvenLinOp(tmpx, psi, MINUS);
152  AP.evenEvenInvLinOp(tmpy, tmpx, MINUS);
153  Double trivial_diff_minus = zero;
154  for(int m=0; m < N5; ++m) {
155  Double foo = norm2(tmpy[m]-psi[m],even);
156  QDPIO::cout << " psi - EvenEvenInv*EvenEven psi: m = " << m << " diff = " << foo << std::endl;
157 
158  trivial_diff_minus += foo;
159  }
160 
161  AP.unprecLinOp(tmp2, chi, MINUS);
162  DComplex nnP_minus = zero;
163  multi1d<DComplex> nnP_minus_array(N5);
164 
165  for(int m=0; m < N5; ++m) {
166  nnP_minus_array[m] = innerProduct(tmp2[m], psi[m]);
167  nnP_minus += nnP_minus_array[m];
168  }
169 
170  multi1d<LatticeFermion> tmp3(N5), tmp4(N5);
171  QDPIO::cout << "AU plus" << std::endl;
172  AU(tmp3, psi, PLUS);
173  DComplex nnU_plus = zero;
174  multi1d<DComplex> nnU_plus_array(N5);
175 
176  for(int m=0; m < N5; ++m) {
177  nnU_plus_array[m] = innerProduct(chi[m], tmp3[m]);
178  nnU_plus += nnU_plus_array[m];
179  }
180 
181  QDPIO::cout << "AU minus" << std::endl;
182  AU(tmp4, chi, MINUS);
183  DComplex nnU_minus = zero;
184  multi1d<DComplex> nnU_minus_array(N5);
185  for(int m=0; m < N5; ++m) {
186  nnU_minus_array[m] = innerProduct(tmp4[m], psi[m]);
187  nnU_minus += nnU_minus_array[m];
188  }
189 
190  push(xml_out,prefix+"LinOpInnerprods");
191  write(xml_out, "trivial_diff_plus", trivial_diff_plus);
192  write(xml_out, "nnP_plus", nnP_plus);
193  write(xml_out, "nnU_plus", nnU_plus);
194  Double norm_diff_plus = zero;
195  multi1d<Double> norm_diff_plus_array_e(N5);
196  multi1d<Double> norm_diff_plus_array_o(N5);
197  for(int m=0; m < N5; ++m)
198  {
199  norm_diff_plus_array_e[m] = norm2(tmp1[m]-tmp3[m],even);
200  norm_diff_plus_array_o[m] = norm2(tmp1[m]-tmp3[m],odd);
201  norm_diff_plus += norm_diff_plus_array_e[m] + norm_diff_plus_array_o[m];
202  QDPIO::cout << "PLUS, EVEN: Prec(Full) - Unprec: m = " << m << " diff = " << norm_diff_plus_array_e[m] << std::endl;
203  QDPIO::cout << "PLUS, ODD: Prec(Full) - Unprec: m = " << m << " diff = " << norm_diff_plus_array_o[m] << std::endl;
204 
205  }
206 
207  write(xml_out, "norm_diff_plus", norm_diff_plus);
208  write(xml_out, "norm_diff_plus_array_even", norm_diff_plus_array_e);
209  write(xml_out, "norm_diff_plus_array_odd", norm_diff_plus_array_o);
210 
211 
212  write(xml_out, "trivial_diff_minus", trivial_diff_minus);
213  write(xml_out, "nnP_minus", nnP_minus);
214  write(xml_out, "nnU_minus", nnU_minus);
215  Double norm_diff_minus = zero;
216  multi1d<Double> norm_diff_minus_array_e(N5);
217  multi1d<Double> norm_diff_minus_array_o(N5);
218  for(int m=0; m < N5; ++m)
219  {
220  norm_diff_minus_array_e[m] = norm2(tmp2[m]-tmp4[m],even);
221  norm_diff_minus_array_o[m] = norm2(tmp2[m]-tmp4[m], odd);
222  norm_diff_minus += norm_diff_minus_array_e[m] + norm_diff_minus_array_o[m];
223  QDPIO::cout << "MINUS,EVEN: Prec(Full) - Unprec: m = " << m << " diff = " << norm_diff_minus_array_e[m] << std::endl;
224  QDPIO::cout << "MINUS,ODD: Prec(Full) - Unprec: m = " << m << " diff = " << norm_diff_minus_array_o[m] << std::endl;
225  }
226 
227  write(xml_out, "norm_diff_minus", norm_diff_minus);
228  write(xml_out, "norm_diff_minus_array_even", norm_diff_minus_array_e);
229  write(xml_out, "norm_diff_minus_array_odd", norm_diff_minus_array_o);
230  pop(xml_out);
231 
232  QDPIO::cout << __func__ << ": exiting" << std::endl;
233 }
234 
235 
236 //! Apply the operator onto a source std::vector
237 /*! User should make sure deriv routines do a resize */
238 multi1d<LatticeColorMatrix>
239 deriv(const EvenOddPrecLinearOperatorArray<LatticeFermion,
240  multi1d<LatticeColorMatrix>,
241  multi1d<LatticeColorMatrix> >& AP,
242  const multi1d<LatticeFermion>& chi, const multi1d<LatticeFermion>& psi,
243  enum PlusMinus isign)
244 {
245  QDPIO::cout << __func__ << ": entering" << std::endl;
246 
247  // Need deriv of (A_oo - D_oe*Ainv_ee*D_eo*psi_e)
248  enum PlusMinus msign = (isign == PLUS) ? MINUS : PLUS;
249 
250  //
251  // Make sure the deriv routines do a resize !!!
252  //
253  multi1d<LatticeColorMatrix> ds_u, ds_1;
254  multi1d<LatticeFermion> tmp1, tmp2, tmp3;
255 
256  //
257  // NOTE: even with even-odd decomposition, the ds_u will still have contributions
258  // on all cb. So, no adding of ds_1 onto ds_u under a subset
259  //
260  // ds_u = chi^dag * A'_oo * psi
261  AP.derivOddOddLinOp(ds_u, chi, psi, isign);
262 
263  // ds_u -= chi^dag * D'_oe * Ainv_ee * D_eo * psi_o
264  AP.evenOddLinOp(tmp1, psi, isign);
265  AP.evenEvenInvLinOp(tmp2, tmp1, isign);
266  AP.derivOddEvenLinOp(ds_1, chi, tmp2, isign);
267  ds_u -= ds_1;
268 
269  // ds_u += chi^dag * D_oe * Ainv_ee * A'_ee * Ainv_ee * D_eo * psi_o
270  AP.evenOddLinOp(tmp1, psi, isign);
271  AP.evenEvenInvLinOp(tmp2, tmp1, isign);
272  AP.evenOddLinOp(tmp1, chi, msign);
273  AP.evenEvenInvLinOp(tmp3, tmp1, msign);
274  AP.derivEvenEvenLinOp(ds_1, tmp3, tmp2, isign);
275  ds_u += ds_1;
276 
277  // ds_u -= chi^dag * D_oe * Ainv_ee * D'_eo * psi_o
278  AP.evenOddLinOp(tmp1, chi, msign);
279  AP.evenEvenInvLinOp(tmp3, tmp1, msign);
280  AP.derivEvenOddLinOp(ds_1, tmp3, psi, isign);
281  ds_u -= ds_1;
282 
283  QDPIO::cout << __func__ << ": exiting" << std::endl;
284 
285  return ds_u;
286 }
287 
288 
289 
290 //! Check linops
291 void check_derivs(XMLWriter& xml_out, const std::string& prefix,
292  const EvenOddPrecLinearOperatorArray<LatticeFermion,
293  multi1d<LatticeColorMatrix>,
294  multi1d<LatticeColorMatrix> >& AP,
295  const UnprecLinearOperatorArray<LatticeFermion,
296  multi1d<LatticeColorMatrix>,
297  multi1d<LatticeColorMatrix> >& AU)
298 {
299  QDPIO::cout << "Check derivs" << std::endl;
300 
301  const int N5 = AP.size();
302  multi1d<LatticeFermion> psi(N5), chi(N5);
303 
304  for(int m=0; m < N5; ++m)
305  {
306  gaussian(psi[m]);
307  gaussian(chi[m]);
308  }
309 
310  multi1d<LatticeColorMatrix> ds_1, ds_2;
311  QDPIO::cout << "AP plus" << std::endl;
312  AP.derivUnprecLinOp(ds_1, chi, psi, PLUS);
313  Double nnP_plus = norm2(ds_1);
314 
315  QDPIO::cout << "AP minus" << std::endl;
316  AP.derivUnprecLinOp(ds_2, chi, psi, MINUS);
317  Double nnP_minus = norm2(ds_2);
318  Double norm_diff_prec = zero;
319  for(int m=0; m < Nd; ++m)
320  norm_diff_prec += norm2(ds_1[m]-ds_2[m]);
321 
322  multi1d<LatticeColorMatrix> ds_tmp;
323  AP.deriv(ds_tmp, chi, psi, PLUS);
324  ds_tmp -= deriv(AP, chi, psi, PLUS);
325  Double norm_diff_check_prec_plus = norm2(ds_tmp);
326 
327  AP.deriv(ds_tmp, chi, psi, MINUS);
328  ds_tmp -= deriv(AP, chi, psi, MINUS);
329  Double norm_diff_check_prec_minus = norm2(ds_tmp);
330 
331  multi1d<LatticeColorMatrix> ds_3, ds_4;
332  QDPIO::cout << "AU plus" << std::endl;
333  AU.deriv(ds_3, chi, psi, PLUS);
334  Double nnU_plus = norm2(ds_3);
335 
336  QDPIO::cout << "AP minus" << std::endl;
337  AU.deriv(ds_4, chi, psi, MINUS);
338  Double nnU_minus = norm2(ds_4);
339  Double norm_diff_unprec = zero;
340  for(int m=0; m < Nd; ++m)
341  norm_diff_unprec += norm2(ds_3[m]-ds_4[m]);
342 
343  push(xml_out,prefix+"DerivInnerprods");
344  write(xml_out, "norm_diff_check_prec_plus", norm_diff_check_prec_plus);
345  write(xml_out, "norm_diff_check_prec_minus", norm_diff_check_prec_minus);
346 
347  write(xml_out, "nnP_plus", nnP_plus);
348  write(xml_out, "nnU_plus", nnU_plus);
349  Double norm_diff_plus = zero;
350  for(int m=0; m < Nd; ++m)
351  norm_diff_plus += norm2(ds_1[m]-ds_3[m]);
352  write(xml_out, "norm_diff_plus", norm_diff_plus);
353  write(xml_out, "norm_diff_prec", norm_diff_plus);
354 
355  write(xml_out, "nnP_minus", nnP_minus);
356  write(xml_out, "nnU_minus", nnU_minus);
357  Double norm_diff_minus = zero;
358  for(int m=0; m < Nd; ++m)
359  norm_diff_minus += norm2(ds_2[m]-ds_4[m]);
360  write(xml_out, "norm_diff_minus", norm_diff_minus);
361  write(xml_out, "norm_diff_unprec", norm_diff_plus);
362  pop(xml_out);
363 
364  QDPIO::cout << __func__ << ": exiting" << std::endl;
365 }
366 
367 
368 /*
369  * Input
370  */
371 // Parameters which must be determined from the XML input
372 // and written to the XML output
373 struct Param_t
374 {
375  multi1d<int> nrow; // Lattice dimension
376  GroupXML_t invParam; // Inverter parameters
377 };
378 
379 //! Mega-structure of all input
380 struct Test_input_t
381 {
382  Param_t param;
383  Cfg_t cfg;
384  std::string action_eo;
385  std::string action_un;
386 };
387 
388 //! Parameters for running code
389 void read(XMLReader& xml, const std::string& path, Param_t& param)
390 {
391  XMLReader paramtop(xml, path);
392  read(paramtop, "nrow", param.nrow);
393  param.invParam = readXMLGroup(paramtop, "InvertParam", "invType");
394 }
395 
396 
397 // Reader for input parameters
398 void read(XMLReader& xml, const std::string& path, Test_input_t& input)
399 {
400  XMLReader inputtop(xml, path);
401 
402  // Read all the input groups
403  try
404  {
405  // Read program parameters
406  read(inputtop, "Param", input.param);
407 
408  // Read in the gauge configuration info
409  read(inputtop, "Cfg", input.cfg);
410 
411  // Read unprec action stuff
412  {
413  XMLReader xml_action(inputtop, "UnprecAction");
414  std::ostringstream os;
415  xml_action.print(os);
416  input.action_un = os.str();
417  }
418 
419  // Read prec action stuff
420  {
421  XMLReader xml_action(inputtop, "PrecAction");
422  std::ostringstream os;
423  xml_action.print(os);
424  input.action_eo = os.str();
425  }
426  }
427  catch (const std::string& e)
428  {
429  QDPIO::cerr << "Error reading test data: " << e << std::endl;
430  throw;
431  }
432 }
433 
434 
435 
436 
437 int main(int argc, char **argv)
438 {
439  // Put the machine into a known state
440  Chroma::initialize(&argc, &argv);
441 
442  QDPIO::cout << "linkage=" << linkage_hack() << std::endl;
443 
444  // Input parameter structure
445  Test_input_t input;
446 
447  // Instantiate xml reader for DATA
448  XMLReader xml_in(Chroma::getXMLInputFileName());
449 
450  // Read data
451  read(xml_in, "/t_precact", input);
452 
453  // Specify lattice size, shape, etc.
454  Layout::setLattSize(input.param.nrow);
455  Layout::create();
456 
457  QDPIO::cout << "t_precact" << std::endl;
458 
459  // Read in the configuration along with relevant information.
460  multi1d<LatticeColorMatrix> u(Nd);
461  XMLReader gauge_file_xml, gauge_xml;
462 
463  // Start up the gauge field
464  gaugeStartup(gauge_file_xml, gauge_xml, u, input.cfg);
465 
466  // Instantiate XML writer for XMLDAT
467  XMLFileWriter& xml_out = Chroma::getXMLOutputInstance();
468  push(xml_out, "t_precact");
469 
470  proginfo(xml_out); // Print out basic program info
471 
472  // Write out the input
473  write(xml_out, "Input", xml_in);
474 
475  // Write out the config header
476  write(xml_out, "Config_info", gauge_xml);
477 
478  // Check if the gauge field configuration is unitarized
479  unitarityCheck(u);
480 
481  // Calculate some gauge invariant observables just for info.
482  MesPlq(xml_out, "Observables", u);
483  xml_out.flush();
484 
485  //
486  // Initialize fermion action
487  //
488  std::istringstream xml_s_eo(input.action_eo);
489  std::istringstream xml_s_un(input.action_un);
490  XMLReader fermacttop_eo(xml_s_eo);
491  XMLReader fermacttop_un(xml_s_un);
492  const std::string fermact_path_eo = "/PrecAction/FermionAction";
493  const std::string fermact_path_un = "/UnprecAction/FermionAction";
494  std::string fermact_eo;
495  std::string fermact_un;
496 
497  try
498  {
499  read(fermacttop_eo, fermact_path_eo + "/FermAct", fermact_eo);
500  read(fermacttop_un, fermact_path_un + "/FermAct", fermact_un);
501  }
502  catch (const std::string& e)
503  {
504  QDPIO::cerr << "Error reading fermact: " << e << std::endl;
505  throw;
506  }
507  catch (const char* e)
508  {
509  QDPIO::cerr << "Error reading fermact: " << e << std::endl;
510  throw;
511  }
512 
513  QDPIO::cout << "PrecFermAct = " << fermact_eo << std::endl;
514  QDPIO::cout << "UnprecFermAct = " << fermact_un << std::endl;
515 
516 
517  // Deal with auxiliary (and polymorphic) state information
518  // eigenvectors, eigenvalues etc. The XML for this should be
519  // stored as a std::string called "stateInfo" in the param struct.
520 
521  try
522  {
523  // Make a reader for the stateInfo
524  const std::string state_info_path_eo = "/PrecAction/StateInfo";
525  const std::string state_info_path_un = "/UnprecAction/StateInfo";
526  XMLReader state_info_xml_eo(fermacttop_eo,state_info_path_eo);
527  XMLReader state_info_xml_un(fermacttop_un,state_info_path_un);
528 
529  // Typedefs to save typing
530  typedef LatticeFermion T;
531  typedef multi1d<LatticeColorMatrix> P;
532  typedef multi1d<LatticeColorMatrix> Q;
533 
534 
535  // Preconditioned operator
536  bool success = false;
537 
538  QDPIO::cerr << "create prec = " << fermact_eo << std::endl;
540 
542  S_f_eo(dynamic_cast<EO5D*>(TheWilsonTypeFermAct5DFactory::Instance().createObject(fermact_eo,
543  fermacttop_eo,
544  fermact_path_eo)));
545 
546  Handle< FermState<T,P,Q> > state_eo(S_f_eo->createState(u,
547  state_info_xml_eo,
548  state_info_path_eo));
549 
550  // Unpreconditioned operator
551  QDPIO::cerr << "create unprec = " << fermact_un << std::endl;
554  S_f_un(dynamic_cast<U5D*>(TheWilsonTypeFermAct5DFactory::Instance().createObject(fermact_un,
555  fermacttop_un,
556  fermact_path_un)));
557 
558  Handle< FermState<T,P,Q> > state_un(S_f_un->createState(u,
559  state_info_xml_un,
560  state_info_path_un));
561 
562 
563  // Sanity check
564  if (S_f_eo->size() != S_f_un->size())
565  {
566  QDPIO::cout << "Prec and unprec fermacts do not have same size" << std::endl;
567  QDP_abort(1);
568  }
569 
570  //-------------------------------------------------------------------------------
571  {
572  Handle< EvenOddPrecLinearOperatorArray<T,P,Q> > AP(S_f_eo->linOp(state_eo));
573  Handle< UnprecLinearOperatorArray<T,P,Q> > AU(S_f_un->linOp(state_un));
574 
575  QDPIO::cout << "Check bulk linops" << std::endl;
576  check_linops(xml_out, "Bulk", *AP, *AU);
577  xml_out.flush();
578 
579  Handle< SystemSolver<T> > PP(S_f_eo->qprop(state_eo,
580  input.param.invParam));
581 
582  QDPIO::cout << "Got Preconditioned System Solver qprop" << std::endl;
583 
584  Handle< SystemSolverArray<T> > PPT(S_f_eo->qpropT(state_eo,
585  input.param.invParam));
586 
587  QDPIO::cout << "Got Preconditioned System Solver qpropT" << std::endl;
588 
589  Handle< SystemSolver<T> > UP(S_f_un->qprop(state_un,
590  input.param.invParam));
591 
592  QDPIO::cout << "Got Unprec System Solver qprop" << std::endl;
593 
594  Handle< SystemSolverArray<T> > UPT(S_f_un->qpropT(state_un,
595  input.param.invParam));
596 
597  QDPIO::cout << "Got Unprec System Solver qpropT" << std::endl;
598 
599  QDPIO::cout << "Check qprop" << std::endl;
600  check_qprop(xml_out, "Qprop", *PP, *UP);
601  xml_out.flush();
602 
603  QDPIO::cout << "Check qpropT" << std::endl;
604  check_qpropT(xml_out, "QpropT", *PPT, *UPT);
605  xml_out.flush();
606 
607  QDPIO::cout << "Check bulk derivatives" << std::endl;
608  check_derivs(xml_out, "Bulk", *AP, *AU);
609  xml_out.flush();
610  }
611 
612 
613  //-------------------------------------------------------------------------------
614  {
615  Handle< EvenOddPrecLinearOperatorArray<T,P,Q> > AP(S_f_eo->linOpPV(state_eo));
616  Handle< UnprecLinearOperatorArray<T,P,Q> > AU(S_f_un->linOpPV(state_un));
617 
618  QDPIO::cout << "Check PV linops" << std::endl;
619  check_linops(xml_out, "PV", *AP, *AU);
620  xml_out.flush();
621 
622  QDPIO::cout << "Check PV derivatives" << std::endl;
623  check_derivs(xml_out, "PV", *AP, *AU);
624  xml_out.flush();
625  }
626 
627  }
628  catch (const std::string& e)
629  {
630  QDPIO::cerr << "Error in t_precact: " << e << std::endl;
631  throw;
632  }
633  catch (const char* e)
634  {
635  QDPIO::cerr << "Error in t_precact: " << e << std::endl;
636  throw;
637  }
638 
639  pop(xml_out);
640 
641  // Time to bolt
643 
644  exit(0);
645 }
Primary include file for CHROMA in application codes.
Even-odd preconditioned linear operator including derivatives for arrays.
Definition: eoprec_linop.h:312
Even-odd preconditioned Wilson-like fermion actions including derivatives.
Class for counted reference semantics.
Definition: handle.h:33
static T & Instance()
Definition: singleton.h:432
virtual int size() const =0
Expected length of array index.
Unpreconditioned linear operator including derivatives.
Definition: linearop.h:203
Unpreconditioned Wilson-like fermion actions in extra dims with derivatives.
Definition: fermact.orig.h:571
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams &param)
Read parameters.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
void unitarityCheck(const multi1d< LatticeColorMatrixF3 > &u)
Check the unitarity of color matrix in SU(N)
Definition: unit_check.cc:20
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.
Definition: proginfo.cc:24
GroupXML_t readXMLGroup(XMLReader &xml_in, const std::string &path, const std::string &type_name)
Read group and return as a std::string.
unsigned n
Definition: ldumul_w.cc:36
static int m[4]
Definition: make_seeds.cc:16
Nd
Definition: meslate.cc:74
Double tmp2
Definition: mesq.cc:30
Double tmp3
Definition: mesq.cc:31
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.
Definition: klein_gord.cc:10
gaussian(aux)
static multi1d< LatticeColorMatrix > u
LinOpSysSolverMGProtoClover::Q Q
push(xml_out,"Condensates")
LinOpSysSolverMGProtoClover::T T
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
multi1d< LatticeFermion > chi(Ncb)
std::string getXMLInputFileName()
Get input file name.
Definition: chroma_init.cc:88
LatticeFermion psi
Definition: mespbg5p_w.cc:35
pop(xml_out)
void MesPlq(const multi1d< LatticeColorMatrixF3 > &u, multi2d< Double > &plane_plaq, Double &link)
Definition: mesplq.cc:83
XMLFileWriter & getXMLOutputInstance()
Get xml output instance.
Definition: chroma_init.cc:359
Double zero
Definition: invbicg.cc:106
FloatingPoint< double > Double
Definition: gtest.h:7351
::std::string string
Definition: gtest.h:1979
Gauge configuration structure.
Definition: cfgtype_io.h:16
Hold group xml and type id.
Holds return info from SystemSolver call.
Definition: syssolver.h:17
Parameters for running program.
Definition: qpropadd.cc:17
SysSolverCGParams invParam
multi1d< int > nrow
Definition: qpropadd.cc:18
Mega-structure of all input.
Definition: t_dwf4d.cc:38
std::string action_un
std::string action_eo
Param_t param
Definition: t_dwf4d.cc:39
Cfg_t cfg
Definition: t_dwf4d.cc:40
void check_qprop(XMLWriter &xml_out, const std::string &prefix, const SystemSolver< LatticeFermion > &PP, const SystemSolver< LatticeFermion > &UP)
Check Qprop.
Definition: t_precact_5d.cc:26
bool linkage_hack()
To insure linking of code, place the registered code flags here.
Definition: t_precact_5d.cc:17
int main(int argc, char **argv)
void check_qpropT(XMLWriter &xml_out, const std::string &prefix, const SystemSolverArray< LatticeFermion > &PP, const SystemSolverArray< LatticeFermion > &UP)
Check QpropT.
Definition: t_precact_5d.cc:66
void check_derivs(XMLWriter &xml_out, const std::string &prefix, const EvenOddPrecLinearOperatorArray< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > &AP, const UnprecLinearOperatorArray< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > &AU)
Check linops.
void check_linops(XMLWriter &xml_out, const std::string &prefix, const EvenOddPrecLinearOperatorArray< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > &AP, const UnprecLinearOperatorArray< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > &AU)
Check linops.
multi1d< LatticeColorMatrix > deriv(const EvenOddPrecLinearOperatorArray< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > &AP, const multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign)
Apply the operator onto a source std::vector.