CHROMA
inline_laplace_eigs.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Use the IRL method to solve for eigenvalues and eigenvectors
3  * of the gauge-covariant laplacian.
4  */
5 
6 #include "fermact.h"
11 #include "meas/smear/gaus_smear.h"
12 #include "meas/glue/mesplq.h"
16 #include "util/ft/sftmom.h"
17 #include "util/info/proginfo.h"
20 #include <qdp-lapack.h>
21 
23 
24 namespace Chroma
25 {
26  namespace InlineLaplaceEigsEnv
27  {
28 
29  //! Propagator input
30  void read(XMLReader& xml, const std::string& path, Params::NamedObject_t& input)
31  {
32  XMLReader inputtop(xml, path);
33 
34  read(inputtop, "gauge_id", input.gauge_id);
35  read(inputtop, "colorvec_id", input.colorvec_id);
36 
37  // User Specified MapObject tags
38  input.colorvec_obj = readXMLGroup(inputtop, "ColorVecMapObject", "MapObjType");
39  }
40 
41  //! Propagator output
42  void write(XMLWriter& xml, const std::string& path, const Params::NamedObject_t& input)
43  {
44  push(xml, path);
45 
46  write(xml, "gauge_id", input.gauge_id);
47  write(xml, "colorvec_id", input.colorvec_id);
48  xml << input.colorvec_obj.xml;
49 
50  pop(xml);
51  }
52 
53  //! Propagator input
54  void read(XMLReader& xml, const std::string& path, Params::Param_t& input)
55  {
56  XMLReader inputtop(xml, path);
57 
58  read(inputtop, "num_vecs", input.num_vecs);
59  read(inputtop, "decay_dir", input.decay_dir);
60  read(inputtop, "max_iter", input.max_iter);
61  read(inputtop, "tol", input.tol);
62  input.link_smear = readXMLGroup(inputtop, "LinkSmearing", "LinkSmearingType");
63  }
64 
65  //! Propagator output
66  void write(XMLWriter& xml, const std::string& path, const Params::Param_t& out)
67  {
68  push(xml, path);
69 
70  write(xml, "num_vecs", out.num_vecs);
71  write(xml, "decay_dir", out.decay_dir);
72  write(xml, "max_iter", out.max_iter);
73  write(xml, "tol", out.tol);
74  xml << out.link_smear.xml;
75 
76  pop(xml);
77  }
78 
79 
80  //! Propagator input
81  void read(XMLReader& xml, const std::string& path, Params& input)
82  {
83  Params tmp(xml, path);
84  input = tmp;
85  }
86 
87  //! Propagator output
88  void write(XMLWriter& xml, const std::string& path, const Params& input)
89  {
90  push(xml, path);
91 
92  write(xml, "Param", input.param);
93  write(xml, "NamedObject", input.named_obj);
94 
95  pop(xml);
96  }
97  } // namespace InlineCreateColorVecsEnv
98 
99 
100  namespace InlineLaplaceEigsEnv
101  {
102  namespace
103  {
104  AbsInlineMeasurement* createMeasurement(XMLReader& xml_in,
105  const std::string& path)
106  {
107  return new InlineMeas(Params(xml_in, path));
108  }
109 
110  //! Local registration flag
111  bool registered = false;
112  }
113 
114  const std::string name = "LAPLACE_EIGS";
115 
116  //! Register all the factories
117  bool registerAll()
118  {
119  bool success = true;
120  if (! registered)
121  {
122  success &= TheInlineMeasurementFactory::Instance().registerObject(name, createMeasurement);
124  registered = true;
125  }
126  return success;
127  }
128 
129 
130  //-------------------------------------------------------------------------
131  // Param stuff
133 
134  Params::Params(XMLReader& xml_in, const std::string& path)
135  {
136  try
137  {
138  XMLReader paramtop(xml_in, path);
139 
140  if (paramtop.count("Frequency") == 1)
141  read(paramtop, "Frequency", frequency);
142  else
143  frequency = 1;
144 
145  // Parameters for source construction
146  read(paramtop, "Param", param);
147 
148  // Read in the output propagator/source configuration info
149  read(paramtop, "NamedObject", named_obj);
150 
151  // Possible alternate XML file pattern
152  if (paramtop.count("xml_file") != 0)
153  {
154  read(paramtop, "xml_file", xml_file);
155  }
156  }
157  catch(const std::string& e)
158  {
159  QDPIO::cerr << __func__ << ": Caught Exception reading XML: " << e << std::endl;
160  QDP_abort(1);
161  }
162  }
163 
164 
165 
166  // Function call
167  void
168  InlineMeas::operator()(unsigned long update_no,
169  XMLWriter& xml_out)
170  {
171  // If xml file not empty, then use alternate
172  if (params.xml_file != "")
173  {
174  std::string xml_file = makeXMLFileName(params.xml_file, update_no);
175 
176  push(xml_out, "LaplaceEigs");
177  write(xml_out, "update_no", update_no);
178  write(xml_out, "xml_file", xml_file);
179  pop(xml_out);
180 
181  XMLFileWriter xml(xml_file);
182  func(update_no, xml);
183  }
184  else
185  {
186  func(update_no, xml_out);
187  }
188  }
189 
190  template<typename T>
191  void partitionedInnerProduct(const T& phi, const T& chi, multi1d<DComplex>& inner_prod, const Set& product_set)
192  {
193  inner_prod = sumMulti(localInnerProduct(phi,chi),product_set);
194  }
195 
196  template<typename T>
197  void laplacian(const multi1d<LatticeColorMatrix>& u, const T& psi, T& chi, int j_decay)
198  {
199  T temp;
200  Real minus_one = -1.;
201  temp = psi * minus_one;
202  klein_gord(u, temp, chi, 0.0, j_decay);
203  }
204 
205 
206  void q(const multi1d<LatticeColorMatrix>& u,
207  const LatticeColorVector& psi,
208  LatticeColorVector& chi,
209  int j_decay)
210  {
211  laplacian(u, psi, chi, j_decay);
212  chi *= Real(-2.0 / 14.0);
213  chi += psi * Real(-1.0 - 2.0 * .35 / 14.0);
214  }
215 
216  //12th order chebyshev
217  void chebyshev(const multi1d<LatticeColorMatrix>& u,
218  const LatticeColorVector& psi,
219  LatticeColorVector& chi,
220  int j_decay)
221  {
222  int n = 12;
223  double chebCo[6] = {-72.0, 840.0, -3584.0, 6912.0, -6144.0, 2048.0};
224  LatticeColorVector tmp = psi;
225  LatticeColorVector prev;
226  LatticeColorVector final = zero;
227 
228  for(int i = 2; i <= n; i += 2){
229  if(i > 2)
230  tmp = prev;
231 
232  q(u, tmp, chi, j_decay);
233  tmp = chi;
234  q(u, tmp, chi, j_decay);
235  prev = chi;
236 
237  final += chebCo[i/2-1]*chi;
238  }
239 
240  final += psi;
241  chi = final;
242  }
243 
244 
245  // Real work done here
246  void
247  InlineMeas::func(unsigned long update_no,
248  XMLWriter& xml_out)
249  {
250  START_CODE();
251 
252  StopWatch snoop;
253  snoop.reset();
254  snoop.start();
255 
256  // Test and grab a reference to the gauge field
257  multi1d<LatticeColorMatrix> u;
258  XMLBufferWriter gauge_xml;
259  try
260  {
261  u = TheNamedObjMap::Instance().getData< multi1d<LatticeColorMatrix> >(params.named_obj.gauge_id);
262  TheNamedObjMap::Instance().get(params.named_obj.gauge_id).getRecordXML(gauge_xml);
263  }
264  catch( std::bad_cast ) {
265  QDPIO::cerr << name << ": caught dynamic cast error" << std::endl;
266  QDP_abort(1);
267  }
268  catch (const std::string& e) {
269  QDPIO::cerr << name << ": std::map call failed: " << e << std::endl;
270  QDP_abort(1);
271  }
272 
273  push(xml_out, "LaplaceEigs");
274  write(xml_out, "update_no", update_no);
275 
276  QDPIO::cout << name << ": Use the IRL method to solve for laplace eigenpairs" << std::endl;
277 
278  proginfo(xml_out); // Print out basic program info
279 
280  // Write out the input
281  write(xml_out, "Input", params);
282 
283  // Write out the config header
284  write(xml_out, "Config_info", gauge_xml);
285 
286  push(xml_out, "Output_version");
287  write(xml_out, "out_version", 1);
288  pop(xml_out);
289 
290  // Calculate some gauge invariant observables just for info.
291  MesPlq(xml_out, "Observables", u);
292 
293  //
294  // Smear the gauge field if needed
295  //
296  multi1d<LatticeColorMatrix> u_smr = u;
297 
298  try {
299  std::istringstream xml_l(params.param.link_smear.xml);
300  XMLReader linktop(xml_l);
301  QDPIO::cout << "Link smearing type = "
303  << std::endl;
304 
306  linkSmearing(TheLinkSmearingFactory::Instance().createObject(params.param.link_smear.id,
307  linktop,params.param.link_smear.path));
308  (*linkSmearing)(u_smr);
309  }
310  catch(const std::string& e){
311  QDPIO::cerr << name << ": Caught Exception link smearing: "<<e<< std::endl;
312  QDP_abort(1);
313  }
314 
315  // Record the smeared observables
316  MesPlq(xml_out, "Smeared_Observables", u_smr);
317 
318 
319  //
320  // Create the output files
321  //
322  try {
323  // Generate a metadata
324  std::string file_str;
325  if (1)
326  {
327  XMLBufferWriter file_xml;
328 
329  push(file_xml, "MODMetaData");
330  write(file_xml, "id", std::string("eigenColorVec"));
331  write(file_xml, "lattSize", QDP::Layout::lattSize());
332  write(file_xml, "num_vecs", params.param.num_vecs);
333  write(file_xml, "Config_info", gauge_xml);
334  pop(file_xml);
335 
336  file_str = file_xml.str();
337  }
338 
339  // Create the object
340  std::istringstream xml_s(params.named_obj.colorvec_obj.xml);
341  XMLReader MapObjReader(xml_s);
342 
343  // Create the entry
347  MapObjReader,
349  file_str);
350  }
351  catch (std::bad_cast) {
352  QDPIO::cerr << name << ": caught dynamic cast error" << std::endl;
353  QDP_abort(1);
354  }
355  catch (const std::string& e) {
356 
357  QDPIO::cerr << name << ": error creating prop: " << e << std::endl;
358  QDP_abort(1);
359  }
360 
361  // Cast should be valid now
362  // Cast should be valid now
363  QDP::MapObject<int,EVPair<LatticeColorVector> >& color_vecs =
365 
366 
367  // The code goes here
368  StopWatch swatch;
369  StopWatch fossil;
370  fossil.reset();
371  swatch.reset();
372  swatch.start();
373 
374  // Initialize the slow Fourier transform phases
375  SftMom phases(0, true, params.param.decay_dir);
376 
377  int num_vecs = params.param.num_vecs;
378  int nt = phases.numSubsets();
379  multi1d<EVPair<LatticeColorVector> > ev_pairs(num_vecs);
380  for(int n=0; n < num_vecs; ++n) {
381  ev_pairs[n].eigenValue.weights.resize(nt);
382  }
383 
384 
385  // Choose the starting eigenvectors to have identical
386  // components and unit norm.
387  // The norm is evaluated time slice by time slice
388  LatticeColorVector starting_vectors;
389 
390  /*
391  ColorVector ones;
392  pokeColor(ones, Complex(1.0), 0);
393  pokeColor(ones, Complex(1.0), 1);
394  pokeColor(ones, Complex(1.0), 2);
395 
396  starting_vectors = ones;
397  */
398 
399  gaussian(starting_vectors);
400 
401  // Norm of the eigenvectors on each time slice
402  // vector_norms is declared complex, this allows
403  // us to use partitionedInnerProduct but it may be a
404  // design flaw
405  multi1d<DComplex> vector_norms;
406 
407 
408  QDPIO::cout << "Normalizing starting std::vector" << std::endl;
409 
410  // This function gives the norms squared
411  partitionedInnerProduct(starting_vectors,starting_vectors,vector_norms,phases.getSet());
412  // Apply the square root to get the true norm
413  // and normalise the starting vectors
414 
415  QDPIO::cout << "Nt = " << nt << std::endl;
416 
417  for(int t=0; t<nt; ++t) {
418  //QDPIO::cout << "vector_norms[" << t << "] = " << vector_norms[t] << std::endl;
419 
420  vector_norms[t] = Complex(sqrt(Real(real(vector_norms[t]))));
421  starting_vectors[phases.getSet()[t]] /= vector_norms[t];
422  }
423 
424 
425  //Build Krlov subspace
426  int kdim = 3 * params.param.num_vecs;
428 
429  QDPIO::cout << "Krylov Dim = " << kdim << std::endl;
430 
431  // beta should really be an array of Reals
432  multi1d< multi1d<DComplex> > beta(kdim-1);
433  multi1d< multi1d<DComplex> > alpha(kdim);
434 
435  multi1d<double*> d(nt);
436  multi1d<double*> e(nt);
437  multi1d<double*> z(nt);
438 
439  for (int t = 0 ; t < nt ; ++t) {
440  d[t] = new double[kdim];
441  e[t] = new double[kdim - 1];
442  z[t] = new double[(kdim) * (kdim)];
443  }
444 
445  for (int k = 0 ; k < kdim ; ++k) {
446 
447  alpha[k].resize(nt);
448 
449  if (k < kdim - 1) {
450 
451  beta[k].resize(nt);
452  }
453  }
454 
455 
456  multi1d<LatticeColorVector> lanczos_vectors(kdim);
457  lanczos_vectors[0] = starting_vectors;
458 
459  // Yields alpha[0] ... alpha[kdim-2]
460  // beta[0] ... beta[kdim-2]
461  // lanczos_vector[0] ... lanczos_vector[kdim-1]
462  // After the last iteration compute alpha[kdim-1]
463  for(int k=0; k<kdim-1; ++k) {
464 
465  //QDPIO::cout << "k = " << k << std::endl;
466 
467 
468  //temporary seems to be defined as a single element but is used as both an array and a single element?
469  LatticeColorVector temporary;
470  // Apply the spatial Laplace operator; j_decay denotes the temporal direction
471  //laplacian(u_smr,lanczos_vectors[k],temporary,j_decay);
472  chebyshev(u_smr,lanczos_vectors[k],temporary,j_decay);
473 
474  if(k > 0){
475  for(int t=0; t<nt; ++t){
476  temporary[phases.getSet()[t]] -= beta[k-1][t]*lanczos_vectors[k-1];
477  }
478  }
479 
480  partitionedInnerProduct(lanczos_vectors[k],temporary,alpha[k],phases.getSet());
481 
482  for(int t=0; t<nt; ++t){
483  //QDPIO::cout << "alpha[k][" << t << "] = " << alpha[k][t] << std::endl;
484  temporary[phases.getSet()[t]] -= alpha[k][t]*lanczos_vectors[k];
485  }
486 
487 
488  QDPIO::cout << "Reorthogonalizing" << std::endl;
489  multi1d<DComplex> alpha_temp(nt);
490  // Reorthogonalise - this may be unnecessary
491  if(k>0){
492 
493  partitionedInnerProduct(lanczos_vectors[k-1],temporary,alpha_temp,phases.getSet());
494  for(int t=0; t<nt; ++t){
495  temporary[phases.getSet()[t]] -= alpha_temp[t]*lanczos_vectors[k-1];
496  }
497  }
498 
499  partitionedInnerProduct(lanczos_vectors[k],temporary,alpha_temp,phases.getSet());
500 
501  for(int t=0; t<nt; ++t){
502  temporary[phases.getSet()[t]] -= alpha_temp[t]*lanczos_vectors[k];
503  } //
504 
505 
506  // Global reorthogonalisation to go here?
507  // .......
508  // .....
509 
510  partitionedInnerProduct(temporary,temporary,beta[k],phases.getSet());
511 
512  for(int t=0; t<nt; ++t) {
513  //QDPIO::cout << "beta[k][" << t << "] = " << beta[k][t] << std::endl;
514  beta[k][t] = Complex(sqrt(Real(real(beta[k][t]))));
515  lanczos_vectors[k+1][phases.getSet()[t]] = temporary/beta[k][t];
516  //if (k < kdim - 1)
517  d[t][k] = toDouble(Real(real(alpha[k][t])));
518 
519  //if (k < kdim - 2)
520  e[t][k] = toDouble(Real(real(beta[k][t])));
521  }
522  /*
523  QDPIO::cout << "Checking orthogonality of std::vector " << k+1 << std::endl;
524  for(int m = 0; m <= k; m++){
525  multi1d<DComplex> tmp(nt);
526  partitionedInnerProduct(lanczos_vectors[k+1],lanczos_vectors[m],tmp,phases.getSet());
527 
528 
529  for(int t = 0; t < nt; t++){
530  QDPIO::cout << " t = " << t << ": " << tmp[t] << std::endl;
531  }
532  }
533  */
534 
535  }
536  // Loop over k is complete, now compute alpha[kdim-1]
537 
538  LatticeColorVector tmp;
539 
540  chebyshev(u_smr, lanczos_vectors[kdim-1], tmp, j_decay);
541 
542  for(int t = 0; t < nt; t++){
543  tmp[phases.getSet()[t]] -= beta[kdim-2][t]*lanczos_vectors[kdim-2];
544  }
545 
546  partitionedInnerProduct(lanczos_vectors[kdim-1],tmp,alpha[kdim-1],phases.getSet());
547 
548  // Finally compute eigenvectors and eigenvalues
549 
550  //Is AL = LT, up to small corrections?
551 
552 
553  /*
554  QDPIO::cout << "Testing AL = LT" << std::endl;
555 
556 
557  for (int k = 0 ; k < kdim -1 ; ++k)
558  {
559  QDPIO::cout << "Row " << k << std::endl;
560 
561  LatticeColorVector al = zero;
562 
563  //laplacian(u_smr, lanczos_vectors[k], al, j_decay);
564  chebyshev(u_smr, lanczos_vectors[k], al, j_decay);
565 
566  LatticeColorVector lt = zero;
567 
568  for (int t = 0 ; t < nt ; ++t)
569  {
570  if (k != 0)
571  {
572  lt[ phases.getSet()[t] ] += toDouble(Real(real(beta[k-1][t])))
573  * lanczos_vectors[k-1];
574  }
575 
576  if (k != (kdim - 2))
577  {
578 
579  lt[phases.getSet()[t]] += toDouble(Real(real(beta[k][t]))) *
580  lanczos_vectors[k+1];
581  }
582 
583  lt[ phases.getSet()[t] ] += toDouble(Real(real(alpha[k][t]))) *
584  lanczos_vectors[k];
585  } //t
586 
587  LatticeColorVector ldiff = al - lt;
588 
589  multi1d<DComplex> ldcnt(nt);
590  partitionedInnerProduct(ldiff, ldiff, ldcnt, phases.getSet());
591 
592  for (int t = 0 ; t < nt ; t++)
593 
594  if (toDouble(Real(real(ldcnt[t]))) > 1e-5)
595  QDPIO::cout << " dcnt[" << t << "] = " << ldcnt[t] << std::endl;
596 
597  } //k
598 
599  */
600 
601  //parameters for dsteqr
602  char compz = 'I';
603 
604  double* work = new double[2*(kdim) - 2];
605 
606  int info = 0;
607  int ldz = kdim;
608 
609 
610  multi1d< multi1d< multi1d<double> > > evecs(nt);
611  multi1d< multi1d<double> > evals(nt);
612 
613  for(int t = 0; t < nt; t++) {
614 
615  //QDPIO::cout << "Starting QR factorization t = " << t << std::endl;
616  fossil.reset();
617  fossil.start();
618 
619  QDPLapack::dsteqr(&compz, &ldz, d[t], e[t], z[t], &ldz, work, &info);
620 
621  fossil.stop();
622 
623  QDPIO::cout << "LAPACK routine completed: " << fossil.getTimeInSeconds() << " sec" << std::endl;
624 
625  QDPIO::cout << "info = " << info << std::endl;
626 
627 
628  evecs[t].resize(kdim);
629  evals[t].resize(kdim);
630 
631  for (int v = 0 ; v < kdim ; ++v) {
632  evals[t][v] = d[t][v];
633 
634  //QDPIO::cout << "Eval[ " << v << "] = " << evals[t][v] << std::endl;
635 
636  evecs[t][v].resize(kdim);
637 
638  for (int n = 0 ; n < kdim ; ++n) {
639  evecs[t][v][n] = z[t][v * (kdim ) + n ];
640  }
641 
642  //Apply matrix to std::vector
643  multi1d<double> Av(kdim );
644 
645  double dcnt = 0;
646 
647  for (int n = 0 ; n < kdim ; ++n) {
648  Av[n] = 0;
649  if (n != 0) {
650  Av[n] += toDouble(Real(real(beta[n-1][t]))) *
651  evecs[t][v][n-1];
652  }
653 
654  if (n != (kdim - 1)) {
655 
656  Av[n] += toDouble(Real(real(beta[n][t]))) *
657  evecs[t][v][n+1];
658  }
659 
660  Av[n] += toDouble(Real(real(alpha[n][t]))) *
661  evecs[t][v][n];
662 
663 
664  dcnt += (Av[n] - evals[t][v]*evecs[t][v][n]) *
665  (Av[n] - evals[t][v]*evecs[t][v][n]);
666  }//n
667 
668  //QDPIO::cout << "Vector " << v << " : dcnt = " << dcnt << std::endl;
669 
670  }//v
671 
672  }//t
673 
674 
675  //Get Eigenvectors
676 
677  QDPIO::cout << "Obtaining eigenvectors of the laplacian" << std::endl;
678  for (int k = 0 ; k < params.param.num_vecs ; ++k) {
679  LatticeColorVector vec_k = zero;
680 
681  //LatticeColorVector lambda_v = zero;
682 
683  for (int t = 0 ; t < nt ; ++t) {
684  //QDPIO::cout << "t = " << t << std::endl;
685 
686  for (int n = 0 ; n < kdim ; ++n) {
687  vec_k[phases.getSet()[t] ] +=
688  Real(evecs[t][kdim - 1 - k][n]) * lanczos_vectors[n];
689  }
690 
691  //QDPIO::cout << "Made evector" << std::endl;
692 
693  //lambda_v[phases.getSet()[t] ] +=
694  // Real(evals[t][kdim - 3 - k]) * vec_k;
695 
696 
697  //QDPIO::cout << "Eval[" << k << "] = " <<
698 
699  }
700 
701  ev_pairs[k].eigenVector = vec_k;
702 
703  //Test if this is an eigenstd::vector
704  // LatticeColorVector avec = zero;
705 
706  /*
707  //laplacian(u_smr, vec_k, avec, j_decay);
708  chebyshev(u_smr, vec_k, avec, j_decay);
709 
710  multi1d< DComplex > dcnt_arr(nt);
711 
712  LatticeColorVector diffs = avec - lambda_v;
713  partitionedInnerProduct( diffs, diffs, dcnt_arr, phases.getSet());
714  */
715 
716  //QDPIO::cout << "Testing Lap. eigvec " << k << std::endl;
717  /*
718  for (int t = 0 ; t < nt ; ++t)
719  {
720  if (toDouble(Real(real(dcnt_arr[t]))) > 1e-5)
721  QDPIO::cout << "dcnt[" << t << "] = " << dcnt_arr[t]
722  << std::endl;
723  }
724  */
725 
726  multi1d< DComplex > temp(nt);
727  multi1d< DComplex > temp2(nt);
728 
729  LatticeColorVector bvec = zero;
730  laplacian(u_smr, vec_k, bvec, j_decay);
731  partitionedInnerProduct(vec_k, bvec, temp, phases.getSet());
732  partitionedInnerProduct(vec_k, vec_k, temp2, phases.getSet());
733 
734  //Obtaining eigenvalues of the laplacian
735  for(int t = 0; t < nt; t++){
736  Complex temp3 = temp[t] / temp2[t];
737 
738  evals[t][k] = -1.0 * toDouble(Real(real(temp3)));
739 
740  ev_pairs[k].eigenValue.weights[t] =
741  Real(evals[t][k]);
742 
743  QDPIO::cout << "t = " << t << std::endl;
744  QDPIO::cout << "lap_evals[" << k << "] = " << evals[t][k] << std::endl;
745  }
746 
747  LatticeColorVector lambda_v2 = zero;
748 
749  for(int t = 0; t < nt; t++){
750 
751  lambda_v2[phases.getSet()[t]] = Real(evals[t][k]) * vec_k;
752 
753  }
754 
755  multi1d< DComplex > dcnt_arr2(nt);
756 
757  LatticeColorVector diffs2 = bvec + lambda_v2;
758 
759  partitionedInnerProduct(diffs2, diffs2, dcnt_arr2, phases.getSet());
760 
761  QDPIO::cout << "Testing Laplace Eigenvalue " << k << std::endl;
762  for(int t = 0; t < nt; t++){
763  if(toDouble(Real(real(dcnt_arr2[t]))) > 1e-5)
764  QDPIO::cout << "dcnt[" << k << "] = " << dcnt_arr2[t] << std::endl;
765  }
766 
767  }//k
768 
769  for(int n=0; n < num_vecs; n++) {
770  color_vecs.insert(n, ev_pairs[n]);
771  }
772  color_vecs.flush();
773 
774  //pop(xml_out);
775 
776  swatch.stop();
777  QDPIO::cout << name << ": time for colorvec construction = "
778  << swatch.getTimeInSeconds()
779  << " secs" << std::endl;
780 
781  pop(xml_out); // CreateColorVecs
782 
783 
784 
785  // Write the meta-data for this operator
786  {
787  XMLBufferWriter file_xml;
788 
789  push(file_xml, "LaplaceEigInfo");
790  write(file_xml, "num_vecs", num_vecs);
791  write(file_xml, "Params", params.param);
792  write(file_xml, "Config_info", gauge_xml);
793  pop(file_xml);
794 
795  XMLBufferWriter record_xml;
796  push(record_xml, "SubsetVectors");
797  for(int i(0);i<num_vecs;i++){
798  push(record_xml, "EigenPair");
799  write(record_xml, "EigenPairNumber", i);
800  write(record_xml, "EigenValues", ev_pairs[i].eigenValue.weights);
801  pop(record_xml);
802  }
803  pop(record_xml);
804 
805  // Write the propagator xml info
806  TheNamedObjMap::Instance().get(params.named_obj.colorvec_id).setFileXML(file_xml);
807  TheNamedObjMap::Instance().get(params.named_obj.colorvec_id).setRecordXML(record_xml);
808  }
809 
810 
811  snoop.stop();
812  QDPIO::cout << name << ": total time = "
813  << snoop.getTimeInSeconds()
814  << " secs" << std::endl;
815 
816  QDPIO::cout << name << ": ran successfully" << std::endl;
817 
818  END_CODE();
819  }
820 
821  }
822 
823 } // namespace Chroma
Inline measurement factory.
Class for counted reference semantics.
Definition: handle.h:33
void func(const unsigned long update_no, XMLWriter &xml_out)
Do the measurement.
void operator()(const unsigned long update_no, XMLWriter &xml_out)
Do the measurement.
Fourier transform phase factor support.
Definition: sftmom.h:35
int numSubsets() const
Number of subsets - length in decay direction.
Definition: sftmom.h:63
const Set & getSet() const
The set to be used in sumMulti.
Definition: sftmom.h:57
static T & Instance()
Definition: singleton.h:432
Class structure for fermion actions.
Gaussian smearing of color std::vector.
void klein_gord(const multi1d< LatticeColorMatrix > &u, const T &psi, T &chi, const Real &mass_sq, int j_decay)
Compute the covariant Klein-Gordon operator.
Definition: klein_gord.cc:31
void proginfo(XMLWriter &xml)
Print out basic information about this program.
Definition: proginfo.cc:24
std::string makeXMLFileName(std::string xml_file, unsigned long update_no)
Return a xml file name for inline measurements.
GroupXML_t readXMLGroup(XMLReader &xml_in, const std::string &path, const std::string &type_name)
Read group and return as a std::string.
Use the Implicitly Restarted Lanczos method with a Tchebyshev polynomial preconditioner to solve for ...
Klein-Gordon operator.
unsigned n
Definition: ldumul_w.cc:36
Make xml file writer.
int z
Definition: meslate.cc:36
int j_decay
Definition: meslate.cc:22
int t
Definition: meslate.cc:37
LatticeReal phi
Definition: mesq.cc:27
Named object function std::map.
static bool registered
Local registration flag.
void q(const multi1d< LatticeColorMatrix > &u, const LatticeColorVector &psi, LatticeColorVector &chi, int j_decay)
void chebyshev(const multi1d< LatticeColorMatrix > &u, const LatticeColorVector &psi, LatticeColorVector &chi, int j_decay)
void write(XMLWriter &xml, const std::string &path, const Params::NamedObject_t &input)
Propagator output.
bool registerAll()
Register all the factories.
void partitionedInnerProduct(const T &phi, const T &chi, multi1d< DComplex > &inner_prod, const Set &product_set)
void read(XMLReader &xml, const std::string &path, Params::NamedObject_t &input)
Propagator input.
void laplacian(const multi1d< LatticeColorMatrix > &u, const T &psi, T &chi, int j_decay)
QDPSubTypeTrait< typename BinaryReturn< C1, C2, FnLocalInnerProduct >::Type_t >::Type_t localInnerProduct(const QDPSubType< T1, C1 > &l, const QDPType< T2, C2 > &r)
bool registerAll()
aggregate everything
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
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
push(xml_out,"Condensates")
LinOpSysSolverMGProtoClover::T T
int i
Definition: pbg5p_w.cc:55
multi1d< LatticeFermion > chi(Ncb)
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
DComplex d
Definition: invbicg.cc:99
static QDP_ColorVector * out
Constructor.
START_CODE()
static QOP_info_t info
Double zero
Definition: invbicg.cc:106
int k
Definition: invbicg.cc:119
::std::string string
Definition: gtest.h:1979
Print out basic info about this program.
Fourier transform phase factor support.
Holds of vectors and weights.