30 QDPIO::cout << __func__ <<
": entering" << std::endl;
32 LatticeFermion source;
33 LatticeFermion sol_unprec;
34 LatticeFermion sol_prec;
38 Double s_norm = sqrt(norm2(source));
39 Real factor = Real(1)/Real(s_norm);
47 std::cout <<
"QPROP Prec done" << std::endl << std::flush ;
51 LatticeFermion diff = sol_prec - sol_unprec;
52 Double norm_diff = sqrt(norm2(diff));
54 QDPIO::cout <<
"Prop Diff: " << norm_diff << std::endl;
55 push(xml_out, prefix);
58 write(xml_out,
"prop_diff", norm_diff);
61 QDPIO::cout << __func__ <<
": exiting" << std::endl;
70 QDPIO::cout << __func__ <<
": entering" << std::endl;
73 multi1d<LatticeFermion> source(
N5);
74 multi1d<LatticeFermion> sol_unprec(
N5);
75 multi1d<LatticeFermion> sol_prec(
N5);
78 for(
int n=0;
n < PP.
size(); ++
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)
90 std::cout <<
"QPROP Prec done" << std::endl << std::flush ;
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));
99 QDPIO::cout <<
"Prop Diff: " << norm_diff << std::endl;
100 push(xml_out, prefix);
103 write(xml_out,
"prop_diff", norm_diff);
106 QDPIO::cout << __func__ <<
": exiting" << std::endl;
115 QDPIO::cout <<
"Check linops" << std::endl;
117 const int N5 = AP.size();
119 multi1d<LatticeFermion> tmpx(
N5), tmpy(
N5);
121 for(
int m=0;
m <
N5; ++
m)
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);
133 for(
int m=0;
m <
N5; ++
m) {
135 QDPIO::cout <<
" psi - EvenEvenInv*EvenEven psi: m = " <<
m <<
" diff = " << foo << std::endl;
137 trivial_diff_plus += foo;
140 AP.unprecLinOp(tmp1,
psi,
PLUS);
141 DComplex nnP_plus =
zero;
142 multi1d<DComplex> nnP_plus_array(
N5);
144 for(
int m=0;
m <
N5; ++
m) {
146 nnP_plus += nnP_plus_array[
m];
149 QDPIO::cout <<
"AP minus" << std::endl;
150 QDPIO::cout <<
"Cheking evenEvenInv(MINUS): " << std::endl;
152 AP.evenEvenInvLinOp(tmpy, tmpx,
MINUS);
154 for(
int m=0;
m <
N5; ++
m) {
156 QDPIO::cout <<
" psi - EvenEvenInv*EvenEven psi: m = " <<
m <<
" diff = " << foo << std::endl;
158 trivial_diff_minus += foo;
162 DComplex nnP_minus =
zero;
163 multi1d<DComplex> nnP_minus_array(
N5);
165 for(
int m=0;
m <
N5; ++
m) {
167 nnP_minus += nnP_minus_array[
m];
170 multi1d<LatticeFermion>
tmp3(
N5), tmp4(
N5);
171 QDPIO::cout <<
"AU plus" << std::endl;
173 DComplex nnU_plus =
zero;
174 multi1d<DComplex> nnU_plus_array(
N5);
176 for(
int m=0;
m <
N5; ++
m) {
178 nnU_plus += nnU_plus_array[
m];
181 QDPIO::cout <<
"AU minus" << std::endl;
183 DComplex nnU_minus =
zero;
184 multi1d<DComplex> nnU_minus_array(
N5);
185 for(
int m=0;
m <
N5; ++
m) {
187 nnU_minus += nnU_minus_array[
m];
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);
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)
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;
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);
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);
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)
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;
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);
232 QDPIO::cout << __func__ <<
": exiting" << std::endl;
238 multi1d<LatticeColorMatrix>
240 multi1d<LatticeColorMatrix>,
241 multi1d<LatticeColorMatrix> >& AP,
242 const multi1d<LatticeFermion>&
chi,
const multi1d<LatticeFermion>&
psi,
245 QDPIO::cout << __func__ <<
": entering" << std::endl;
253 multi1d<LatticeColorMatrix> ds_u, ds_1;
254 multi1d<LatticeFermion> tmp1,
tmp2,
tmp3;
272 AP.evenOddLinOp(tmp1,
chi, msign);
273 AP.evenEvenInvLinOp(
tmp3, tmp1, msign);
278 AP.evenOddLinOp(tmp1,
chi, msign);
279 AP.evenEvenInvLinOp(
tmp3, tmp1, msign);
283 QDPIO::cout << __func__ <<
": exiting" << std::endl;
293 multi1d<LatticeColorMatrix>,
294 multi1d<LatticeColorMatrix> >& AP,
296 multi1d<LatticeColorMatrix>,
297 multi1d<LatticeColorMatrix> >& AU)
299 QDPIO::cout <<
"Check derivs" << std::endl;
301 const int N5 = AP.size();
304 for(
int m=0;
m <
N5; ++
m)
310 multi1d<LatticeColorMatrix> ds_1, ds_2;
311 QDPIO::cout <<
"AP plus" << std::endl;
313 Double nnP_plus = norm2(ds_1);
315 QDPIO::cout <<
"AP minus" << std::endl;
317 Double nnP_minus = norm2(ds_2);
319 for(
int m=0;
m <
Nd; ++
m)
320 norm_diff_prec += norm2(ds_1[
m]-ds_2[
m]);
322 multi1d<LatticeColorMatrix> ds_tmp;
325 Double norm_diff_check_prec_plus = norm2(ds_tmp);
329 Double norm_diff_check_prec_minus = norm2(ds_tmp);
331 multi1d<LatticeColorMatrix> ds_3, ds_4;
332 QDPIO::cout <<
"AU plus" << std::endl;
334 Double nnU_plus = norm2(ds_3);
336 QDPIO::cout <<
"AP minus" << std::endl;
338 Double nnU_minus = norm2(ds_4);
340 for(
int m=0;
m <
Nd; ++
m)
341 norm_diff_unprec += norm2(ds_3[
m]-ds_4[
m]);
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);
347 write(xml_out,
"nnP_plus", nnP_plus);
348 write(xml_out,
"nnU_plus", nnU_plus);
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);
355 write(xml_out,
"nnP_minus", nnP_minus);
356 write(xml_out,
"nnU_minus", nnU_minus);
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);
364 QDPIO::cout << __func__ <<
": exiting" << std::endl;
391 XMLReader paramtop(xml, path);
400 XMLReader inputtop(xml, path);
409 read(inputtop,
"Cfg", input.
cfg);
413 XMLReader xml_action(inputtop,
"UnprecAction");
414 std::ostringstream os;
415 xml_action.print(os);
421 XMLReader xml_action(inputtop,
"PrecAction");
422 std::ostringstream os;
423 xml_action.print(os);
429 QDPIO::cerr <<
"Error reading test data: " << e << std::endl;
437 int main(
int argc,
char **argv)
442 QDPIO::cout <<
"linkage=" <<
linkage_hack() << std::endl;
451 read(xml_in,
"/t_precact", input);
457 QDPIO::cout <<
"t_precact" << std::endl;
460 multi1d<LatticeColorMatrix>
u(
Nd);
461 XMLReader gauge_file_xml, gauge_xml;
468 push(xml_out,
"t_precact");
473 write(xml_out,
"Input", xml_in);
476 write(xml_out,
"Config_info", gauge_xml);
482 MesPlq(xml_out,
"Observables",
u);
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";
499 read(fermacttop_eo, fermact_path_eo +
"/FermAct", fermact_eo);
500 read(fermacttop_un, fermact_path_un +
"/FermAct", fermact_un);
504 QDPIO::cerr <<
"Error reading fermact: " << e << std::endl;
507 catch (
const char* e)
509 QDPIO::cerr <<
"Error reading fermact: " << e << std::endl;
513 QDPIO::cout <<
"PrecFermAct = " << fermact_eo << std::endl;
514 QDPIO::cout <<
"UnprecFermAct = " << fermact_un << std::endl;
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);
530 typedef LatticeFermion
T;
531 typedef multi1d<LatticeColorMatrix>
P;
532 typedef multi1d<LatticeColorMatrix>
Q;
536 bool success =
false;
538 QDPIO::cerr <<
"create prec = " << fermact_eo << std::endl;
548 state_info_path_eo));
551 QDPIO::cerr <<
"create unprec = " << fermact_un << std::endl;
560 state_info_path_un));
564 if (S_f_eo->size() != S_f_un->size())
566 QDPIO::cout <<
"Prec and unprec fermacts do not have same size" << std::endl;
575 QDPIO::cout <<
"Check bulk linops" << std::endl;
582 QDPIO::cout <<
"Got Preconditioned System Solver qprop" << std::endl;
587 QDPIO::cout <<
"Got Preconditioned System Solver qpropT" << std::endl;
592 QDPIO::cout <<
"Got Unprec System Solver qprop" << std::endl;
597 QDPIO::cout <<
"Got Unprec System Solver qpropT" << std::endl;
599 QDPIO::cout <<
"Check qprop" << std::endl;
603 QDPIO::cout <<
"Check qpropT" << std::endl;
607 QDPIO::cout <<
"Check bulk derivatives" << std::endl;
618 QDPIO::cout <<
"Check PV linops" << std::endl;
622 QDPIO::cout <<
"Check PV derivatives" << std::endl;
630 QDPIO::cerr <<
"Error in t_precact: " << e << std::endl;
633 catch (
const char* e)
635 QDPIO::cerr <<
"Error in t_precact: " << e << std::endl;
Primary include file for CHROMA in application codes.
Even-odd preconditioned linear operator including derivatives for arrays.
Even-odd preconditioned Wilson-like fermion actions including derivatives.
Class for counted reference semantics.
virtual int size() const =0
Expected length of array index.
Unpreconditioned linear operator including derivatives.
Unpreconditioned Wilson-like fermion actions in extra dims 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_qpropT(XMLWriter &xml_out, const std::string &prefix, const SystemSolverArray< LatticeFermion > &PP, const SystemSolverArray< LatticeFermion > &UP)
Check QpropT.
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.