CHROMA
unprec_ovlap_contfrac5d_fermact_array_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Unpreconditioned extended-Overlap (5D) (Naryanan&Neuberger) action
3  */
4 
5 #include "chromabase.h"
6 
12 
14 #include "zolotarev.h"
15 
18 //#include "actions/ferm/fermstates/ferm_createstate_reader_w.h"
20 
21 #include "io/enum_io/enum_io.h"
22 #include "io/overlap_state_info.h"
23 
25 
26 namespace Chroma
27 {
28 
29  //! Hooks to register the class with the fermact factory
30  namespace UnprecOvlapContFrac5DFermActArrayEnv
31  {
32  //! Callback function
33  WilsonTypeFermAct5D<LatticeFermion,
34  multi1d<LatticeColorMatrix>,
35  multi1d<LatticeColorMatrix> >* createFermAct5D(XMLReader& xml_in,
36  const std::string& path)
37  {
40  }
41 
42  //! Callback function
43  /*! Differs in return type */
44  FermionAction<LatticeFermion,
45  multi1d<LatticeColorMatrix>,
46  multi1d<LatticeColorMatrix> >* createFermAct(XMLReader& xml_in,
47  const std::string& path)
48  {
49  return createFermAct5D(xml_in, path);
50  }
51 
52  //! Name to be used
53  const std::string name = "UNPRECONDITIONED_OVERLAP_CONTINUED_FRACTION_5D";
54 
55  //! Local registration flag
56  static bool registered = false;
57 
58  //! Register all the factories
59  bool registerAll()
60  {
61  bool success = true;
62  if (! registered)
63  {
64  success &= Chroma::TheFermionActionFactory::Instance().registerObject(name, createFermAct);
66  registered = true;
67  }
68  return success;
69  }
70  } // End Namespace UnprecOvlapContFrac5DFermActArrayEnv
71 
72 
73  //! Read XML
75  {
76  XMLReader in(xml, path);
77 
78  try {
79  if(in.count("AuxFermAct") == 1 ) {
80  XMLReader xml_tmp(in, "AuxFermAct");
81  std::ostringstream os;
82  xml_tmp.print(os);
83  AuxFermAct = os.str();
84  }
85  else {
86  throw std::string("No auxilliary action");
87  }
88 
89  read(in, "Mass", Mass);
90  read(in, "RatPolyDeg", RatPolyDeg);
91 
92  if( in.count("ApproximationType") == 1 )
93  {
94  read(in, "ApproximationType", approximation_type);
95  }
96  else
97  {
98  // Default coeffs are unscaled tanh
100  }
101 
103  {
104  read(in, "ApproxMin", ApproxMin);
105  read(in, "ApproxMax", ApproxMax);
106  }
107  else
108  {
109  ApproxMin = ApproxMax = 0.0;
110  }
111  }
112  catch( const std::string &e ) {
113  QDPIO::cerr << "Caught Exception reading unprec ContFrac Fermact params: " << e << std::endl;
114  QDP_abort(1);
115  }
116  }
117 
118  void read(XMLReader& xml_in, const std::string& path,
120  {
121 
123  param = tmp;
124  }
125 
126  void write(XMLWriter& xml_out, const std::string& path, const UnprecOvlapContFrac5DFermActParams& p)
127  {
128  if ( path != "." ) {
129  push( xml_out, path);
130  }
131 
132  xml_out << p.AuxFermAct;
133  write(xml_out, "Mass", p.Mass);
134  write(xml_out, "RatPolyDeg", p.RatPolyDeg);
135  write(xml_out, "ApproximationType", p.approximation_type);
136  write(xml_out, "ApproxMin", p.ApproxMin);
137  write(xml_out, "ApproxMax", p.ApproxMax);
138 
139  pop(xml_out);
140 
141 
142  if( path != "." ) {
143  pop(xml_out);
144  }
145  }
146 
147 
148 
149  // Construct the action out of a parameter structure
151  Handle< FermBC<T,P,Q> > fbc_,
152  const UnprecOvlapContFrac5DFermActParams& params_) :
153  fbc(fbc_), params(params_)
154  {
155  QDPIO::cout << UnprecOvlapContFrac5DFermActArrayEnv::name << ": entering constructor" << std::endl;
156 
157  // Sanity check
158  if (fbc.operator->() == 0)
159  {
160  QDPIO::cerr << UnprecOvlapContFrac5DFermActArrayEnv::name << ": error: fbc is null" << std::endl;
161  QDP_abort(1);
162  }
163 
164  // Fake a creator. This should be cleaned up
166  cfs = cfs_;
167 
168 
169  // WHAT IS BELOW ONLY WORKS FOR TYPE=0 approximations
170  // which is what we use. Forget TYPE=1
171  // the Tanh approximation (Higham) is of type TYPE=0
172  // We have two cases.
173  bool isEvenRatPolyDeg = ( params.RatPolyDeg % 2 == 0);
174 
175  if( isEvenRatPolyDeg ) {
176 
177  N5 = params.RatPolyDeg+1;
178  isLastZeroP = true;
179  }
180  else {
181 
182  N5 = params.RatPolyDeg;
183  isLastZeroP = false;
184  }
185 
186  // Construct the fermact
187  std::istringstream xml_s(params.AuxFermAct);
188  XMLReader fermacttop(xml_s);
189  const std::string fermact_path = "/AuxFermAct";
190 
191  // In case I fail to upcast to the UnprecWilsonType FermAct
192  struct UnprecCastFailure {
193  UnprecCastFailure(std::string e) : auxfermact(e) {};
194  const std::string auxfermact;
195  };
196 
197  try {
198  std::string auxfermact;
199  read(fermacttop, fermact_path + "/FermAct", auxfermact);
200  QDPIO::cout << "AuxFermAct: " << auxfermact << std::endl;
201 
202  // Generic Wilson-Type stuff
204  TheFermionActionFactory::Instance().createObject(auxfermact,
205  fermacttop,
206  fermact_path);
207 
208  UnprecWilsonTypeFermAct<T,P,Q>* S_aux_ptr =
209  dynamic_cast<UnprecWilsonTypeFermAct<T,P,Q>*>(S_f);
210 
211  // Dumbass User specifies something that is not UnpreWilsonTypeFermAct
212  // dynamic_cast MUST be checked for 0
213  if( S_aux_ptr == 0 ) throw UnprecCastFailure(auxfermact);
214 
215  // Drop AuxFermAct into a Handle immediately.
216  // This should free things up at the end
217  Handle<UnprecWilsonTypeFermAct<T,P,Q> > S_w(S_aux_ptr);
218  S_aux = S_w;
219  }
220  catch( const UnprecCastFailure& e)
221  {
222  // Breakage Scenario
223  QDPIO::cerr << "Unable to upcast auxiliary fermion action to "
224  << "UnprecWilsonTypeFermAct " << std::endl;
225  QDPIO::cerr << UnprecOvlapContFrac5DFermActArrayEnv::name << " does not support even-odd preconditioned "
226  << "auxiliary FermActs" << std::endl;
227  QDPIO::cerr << "You passed : " << std::endl;
228  QDPIO::cerr << e.auxfermact << std::endl;
229  QDP_abort(1);
230  }
231  catch (const std::exception& e)
232  {
233  // General breakage Scenario
234  QDPIO::cerr << "Error reading data: " << e.what() << std::endl;
235  throw;
236  }
237  catch( const std::string& e )
238  {
239  QDPIO::cerr << "Caught Exception" << e << std::endl;
240  QDP_abort(1);
241  }
242  }
243 
244 
245  void
247  multi1d<Real>& alpha,
248  multi1d<Real>& beta,
249  int& NEig,
250  multi1d<Real>& EigValFunc,
251  const OverlapConnectState& state) const
252  {
253  int NEigVal = state.getEigVal().size();
254  if( NEigVal == 0 ) {
255  NEig = 0;
256  }
257  else {
258  NEig = NEigVal;
259  }
260 
261  int type = 0;
262  zolotarev_data *rdata;
263  Real epsilon;
264 
265  Real approxMin = (state.getEigVal().size() != 0) ? state.getApproxMin() : params.ApproxMin;
266  Real approxMax = (state.getEigVal().size() != 0) ? state.getApproxMax() : params.ApproxMax;
267 
268  switch(params.approximation_type)
269  {
271  epsilon = approxMin / approxMax;
272  QDPIO::cout << "Initing Linop with Zolotarev Coefficients: epsilon = " << epsilon << std::endl;
273  rdata = zolotarev(toFloat(epsilon), params.RatPolyDeg, type);
274  scale_fac = Real(1) / approxMax;
275  break;
276 
278  epsilon = approxMin;
279  QDPIO::cout << "Initing Linop with Higham Rep tanh Coefficients" << std::endl;
280  rdata = higham(toFloat(epsilon), params.RatPolyDeg);
281  scale_fac = Real(1);
282  break;
283 
284  default:
285  // The std::map system should ensure that we never get here but
286  // just for style
287  QDPIO::cerr << "Unknown coefficient type: " << params.approximation_type
288  << std::endl;
289  QDP_abort(1);
290  }
291 
292  Real maxerr = (Real)(rdata->Delta);
293 
294  // Check N5 is good:
295  if( N5 != rdata->db ) {
296  QDPIO::cerr << "Mismatch between N5 and N5 from Coefficient Code" << std::endl;
297  QDPIO::cerr << "N5 = " << N5 << " rdata->db=" << rdata->db << std::endl;
298  QDP_abort(1);
299  }
300 
301  // The coefficients from the continued fraction
302  beta.resize(N5);
303  for(int i = 0; i < N5; i++) {
304  beta[i] = rdata->beta[i];
305  }
306 
307  alpha.resize(N5-1);
308  for(int i=0; i < N5-1; i++) {
309  alpha[i] = Real(1);
310  }
311 
312  // The gamma's are the equivalence transforms
313  // There are N5-1 of them and they appear in the
314  // diagonal terms as gamma^2
315  // and in the off diagonal terms as gamma_i gamma_i+1
316  // except in the last one which is just gamma
317  //
318  // For the moment choose gamma_i = 1/sqrt(beta_i) */
319 
320  multi1d<Real> gamma(N5-1);
321  for(int i=0; i < N5-1; i++) {
322  gamma[i] = Real(1)/ sqrt( beta[i] );
323  }
324 
325  // Now perform the equivalence transformation
326  //
327  // On the diagonal coefficients
328  // Note that beta[N5-1] is NOT changed
329  for(int i=0; i < N5-1; i++) {
330  beta[i] = beta[i]*gamma[i]*gamma[i];
331  }
332 
333  // and the off diagonal ones
334  // from 0..N5-3 we have gamma_i gamma_i+1
335  // and on N5-2 we have gamma_i
336  for(int i=0; i < N5-2; i++) {
337  alpha[i] *= gamma[i]*gamma[i+1];
338  }
339  alpha[N5-2] *= gamma[N5-2];
340 
341 
342  QDPIO::cout << "UnprecOvlapContfrac5d: " << std::endl
343  << " Degree=" << params.RatPolyDeg
344  << " N5=" << N5 << " scale=" << scale_fac
345  << " Nwils = " << NEigVal << " Mass=" << params.Mass << std::endl ;
346  QDPIO::cout << "Approximation on [-1,eps] U [eps,1] with eps = " << epsilon <<std::endl;
347 
348  QDPIO::cout << "Maximum error | R(x) - sgn(x) | <= Delta = " << maxerr << std::endl;
349  /*
350  for(int i=0; i < N5; i++) {
351  QDPIO::cout << "beta["<<i<<"] = " << beta[i] << std::endl;
352  }
353  for(int i=0; i < N5; i++) {
354  QDPIO::cout << "alpha["<<i<<"] = " << alpha[i] << std::endl;
355  }
356  */
357 
358  switch( params.approximation_type) {
360  QDPIO::cout << "Coefficients from Zolotarev" << std::endl;
361 
362  if(type == 0) {
363  QDPIO::cout << "Approximation type " << type << " with R(0) = 0"
364  << std::endl;
365  }
366  else {
367  QDPIO::cout << "Approximation type " << type << " with R(0) = infinity" << std::endl;
368  }
369 
370  break;
371  case COEFF_TYPE_TANH:
372  QDPIO::cout << "Coefficients from Higham Tanh representation" << std::endl;
373  break;
375  QDPIO::cout << "Coefficients from Unscaled Higham Tanh representation" << std::endl;
376  break;
377  default:
378  QDPIO::cerr << "Unknown coefficient type " << params.approximation_type
379  << std::endl;
380  QDP_abort(1);
381  break;
382  }
383 
384  // We will also compute te 'function of the eigenvalues
385  if( NEig > 0 ) {
386  for(int i=0; i < NEigVal; i++) {
387  if( toBool( state.getEigVal()[i] > Real(0) ) ) {
388  EigValFunc[i] = Real(1);
389  }
390  else if( toBool( state.getEigVal()[i] < Real(0) ) ) {
391  EigValFunc[i] = Real(-1);
392  }
393  else {
394  EigValFunc[i] = 0;
395  }
396  }
397  }
398 
399 
400  // free the arrays allocated by Tony's Zolo
401  zolotarev_free(rdata);
402  }
403 
404 
405  //! Produce a linear operator for this action
406  /*!
407  * The operator acts on the entire lattice
408  *
409  * \param state gauge field (Read)
410  */
411  UnprecLinearOperatorArray<LatticeFermion,
412  multi1d<LatticeColorMatrix>,
413  multi1d<LatticeColorMatrix> >*
415  {
416  START_CODE();
417  try {
418 
419  // This throws a bad cast exception if the cast fails
420  // Hence the "try" above
421  const OverlapConnectState& state =
422  dynamic_cast<OverlapConnectState&>(*state_);
423 
424  if (state.getEigVec().size() != state.getEigVal().size()) {
425  QDPIO::cerr << "UnprecOvlapContFrac5DFermActArray::linOp(): ";
426  QDPIO::cerr << "UnprecOvlapContFrac5DFermActArray: inconsistent sizes of eigenvectors and values"
427  << "state.getEigVec.size() = " << state.getEigVec().size()
428  << " state.getEigVal.size() = " << state.getEigVal().size()
429  << std::endl;
430  QDP_abort(1);
431  }
432 
433  int NEigVal = state.getEigVal().size();
434  int NEig;
435 
436  multi1d<Real> alpha;
437  multi1d<Real> beta;
438  Real scale_factor;
439  multi1d<Real> EigValFunc(NEigVal);
440 
441  init(scale_factor, alpha, beta, NEig, EigValFunc, state);
442 
444  state_,
445  params.Mass,
446  N5,
447  scale_factor,
448  alpha,
449  beta,
450  NEig,
451  EigValFunc,
452  state.getEigVec(),
453  isLastZeroP);
454 
455  }
456  catch( std::bad_cast )
457  {
458  QDPIO::cerr << "UnprecOvlapContFrac5DFermActArray::linOp(): ";
459  QDPIO::cerr << "Couldnt cast FermState<T,P,Q> to OverlapFermState<T,P,Q> "
460  << std::endl;
461  QDP_abort(1);
462  }
463 
464  // Should never get here... Just to satisfy type system
465  return 0;
466  }
467 
468 
469  //! Produce a linear operator for this action
470  /*!
471  * The operator acts on the entire lattice
472  *
473  * \param state gauge field (Read)
474  */
475  UnprecLinearOperatorArray<LatticeFermion,
476  multi1d<LatticeColorMatrix>,
477  multi1d<LatticeColorMatrix> >*
479  {
480  START_CODE();
481  try {
482 
483  // This throws a bad cast exception if the cast fails
484  // Hence the "try" above
485  const OverlapConnectState& state =
486  dynamic_cast<OverlapConnectState&>(*state_);
487 
488  if (state.getEigVec().size() != state.getEigVal().size()) {
489  QDPIO::cerr << "UnprecOvlapContFrac5DFermActArray::linOp(): ";
490  QDPIO::cerr << "UnprecOvlapContFrac5DFermActArray: inconsistent sizes of eigenvectors and values"
491  << "state.getEigVec.size() = " << state.getEigVec().size()
492  << " state.getEigVal.size() = " << state.getEigVal().size()
493  << std::endl;
494  QDP_abort(1);
495  }
496 
497  int NEigVal = state.getEigVal().size();
498  int NEig;
499 
500  multi1d<Real> alpha;
501  multi1d<Real> beta;
502  Real scale_factor;
503  multi1d<Real> EigValFunc(NEigVal);
504 
505  init(scale_factor, alpha, beta, NEig, EigValFunc, state);
506 
508  state_,
509  params.Mass,
510  N5,
511  scale_factor,
512  alpha,
513  beta,
514  NEig,
515  EigValFunc,
516  state.getEigVec(),
517  isLastZeroP);
518 
519  }
520  catch( std::bad_cast ) {
521  QDPIO::cerr << "UnprecOvlapContFrac5DFermActArray::linOp(): ";
522  QDPIO::cerr << "Couldnt cast FermState<T,P,Q> to OverlapFermState<T,P,Q> "
523  << std::endl;
524  QDP_abort(1);
525  }
526 
527  // Should never get here... Just to satisfy type system
528  return 0;
529  }
530 
531 
532  //! Produce the non-hermitian version of the operator
533  /*!
534  * The operator acts on the entire lattice
535  *
536  * \param state gauge field (Read)
537  */
540  {
541  START_CODE();
542 
543  try {
544  // This cast throws an exception if it fails hence the " try " above
545  const OverlapConnectState& state =
546  dynamic_cast<OverlapConnectState&>(*state_);
547 
548  if (state.getEigVec().size() != state.getEigVal().size()) {
549  QDPIO::cerr << "UnprecOvlapContFrac5DFermActArray::lnonHermLinOp(): ";
550  QDPIO::cerr << "UnprecOvlapContFrac5DFermActArray: inconsistent sizes of eigenvectors and values"
551  << "state.getEigVec.size() = " << state.getEigVec().size()
552  << " state.getEigVal.size() = " << state.getEigVal().size()
553  << std::endl;
554  QDP_abort(1);
555  }
556 
557 
558  int NEigVal = state.getEigVal().size();
559  int NEig;
560 
561  multi1d<Real> alpha;
562  multi1d<Real> beta;
563  Real scale_factor;
564  multi1d<Real> EigValFunc(NEigVal);
565 
566  init(scale_factor, alpha, beta, NEig, EigValFunc, state);
567 
569  state_,
570  params.Mass,
571  N5,
572  scale_factor,
573  alpha,
574  beta,
575  NEig,
576  EigValFunc,
577  state.getEigVec() );
578  }
579  catch( std::bad_cast )
580  {
581  QDPIO::cerr << "UnprecOvlapContFrac5DFermActArray::lnonHermLinOp(): ";
582  QDPIO::cerr << "Couldnt cast FermState<T,P,Q> to OverlapConnectState "
583  << std::endl;
584  QDP_abort(1);
585  }
586 
587  return 0;
588  }
589 
590 
591  //! Produce a M^dag.M linear operator for the non hermitian operator
592  /*!
593  * The operator acts on the entire lattice *
594  * \param state gauge field (Read)
595  */
598  {
600  }
601 
602 
603 
604  //! Propagator of an un-preconditioned Extended-Overlap linear operator
605  /*! \ingroup qprop
606  *
607  * Propagator solver for Extended overlap fermions
608  */
609  template<typename T>
610  class OvUnprecCF5DQprop : public SystemSolver<T>
611  {
612  public:
613  //! Constructor
614  /*!
615  * \param A_ Linear operator ( Read )
616  * \param Mass_ quark mass ( Read )
617  */
619  const Real& Mass_,
620  const SysSolverCGParams& invParam_) :
621  A(A_), Mass(Mass_), invParam(invParam_) {}
622 
623  //! Destructor is automatic
625 
626  //! Return the subset on which the operator acts
627  const Subset& subset() const {return all;}
628 
629  //! Solver the linear system
630  /*!
631  * \param psi quark propagator ( Modify )
632  * \param chi source ( Read )
633  * \return number of CG iterations
634  */
636  {
637  START_CODE();
638 
640  const int N5 = A->size();
641 
642  int G5 = Ns*Ns - 1;
643 
644  // Initialize the 5D fields
645  multi1d<LatticeFermion> chi5(N5);
646  multi1d<LatticeFermion> psi5(N5);
647 
648 
649  // For reasons I do not appreciate doing the solve as
650  // M^{dag} M psi = M^{dag} chi
651  // seems a few iterations faster and more accurate than
652  // Doing M^{dag} M psi = chi
653  // and then applying M^{dag}
654 
655  // So first get M^{dag} gamma_5 chi into the source.
656 // if( invType == "CG_INVERTER")
657  {
658  multi1d<LatticeFermion> tmp5(N5);
659 
660  // Zero out 5D vectors
661  for(int i=0; i < N5; i++) {
662  psi5[i] = zero;
663  chi5[i] = zero;
664  tmp5[i] = zero;
665  }
666 
667  // Set initial guess
668  psi5[N5-1] = psi;
669 
670  // set up gamma_5 chi into chi-1
671  chi5[N5-1] = Gamma(G5)*chi;
672  (*A)(tmp5, chi5, MINUS);
673 
674  // psi5 = (M^{dag} M)^(-1) M^{dag} * gamma_5 * chi5
675  // psi5[N5] = (1 - m)/2 D^{-1}(m) chi [N5]
676  res = InvCG2(*A, tmp5, psi5, invParam.RsdCG, invParam.MaxCG);
677  }
678 // else
679 // {
680 // QDPIO::cerr << UnprecOvlapContFrac5DFermActArrayEnv::name
681 // << "Unsupported inverter type =" << invType << std::endl;
682 // QDP_abort(1);
683 // }
684 
685  if ( res.n_count == invParam.MaxCG )
686  QDP_error_exit("no convergence in the inverter", res.n_count);
687 
688  // Compute residual
689  {
690  multi1d<T> r(N5);
691  (*A)(r, psi5, PLUS);
692  r -= chi5;
693  res.resid = sqrt(norm2(r));
694  }
695 
696  // Solution now lives in chi5
697 
698  // Multiply back in factor 2/(1-m) to return to
699  // (1/2)( 1 + m + (1-m) gamma_5 epsilon )
700  // normalisatoin
701  psi5[N5-1] *= Real(2)/(Real(1)-Mass);
702 
703  // Remove contact term
704  psi = psi5[N5-1] - chi;
705 
706  // Overall normalization
707  Real ftmp1 = Real(1) / (Real(1) - Mass);
708  psi *= ftmp1;
709 
710  END_CODE();
711 
712  return res;
713  }
714 
715  private:
716  // Hide default constructor
718 
720  Real Mass;
722  };
723 
724 
725  //! Propagator of an un-preconditioned Extended-Overlap linear operator
728  const GroupXML_t& invParam) const
729  {
730  std::istringstream is(invParam.xml);
731  XMLReader paramtop(is);
732 
734  getQuarkMass(),
735  SysSolverCGParams(paramtop,invParam.path));
736  }
737 
738 
739 
740  //! Create a ConnectState with just the gauge fields
742  UnprecOvlapContFrac5DFermActArray::createState(const multi1d<LatticeColorMatrix>& u_) const
743  {
744  try {
745  return new OverlapConnectState(fbc, u_);
746  }
747  catch(const std::string& e) {
748  QDPIO::cerr << "Caught Exception: " << e << std::endl;
749  QDP_abort(1);
750  }
751 
752  return 0;
753  }
754 
755  //! Create a ConnectState with just the gauge fields, and a lower
756  // approximation bound
758  UnprecOvlapContFrac5DFermActArray::createState(const multi1d<LatticeColorMatrix>& u_,
759  const Real& approxMin_) const
760  {
761  try {
762  return new OverlapConnectState(fbc, u_, approxMin_);
763  }
764  catch(const std::string& e) {
765  QDPIO::cerr << "Caught Exception: " << e << std::endl;
766  QDP_abort(1);
767  }
768 
769  return 0;
770  }
771 
772  //! Create a connect State with just approximation range bounds
774  UnprecOvlapContFrac5DFermActArray::createState(const multi1d<LatticeColorMatrix>& u_,
775  const Real& approxMin_,
776  const Real& approxMax_) const
777  {
778  try {
779  return new OverlapConnectState(fbc, u_, approxMin_, approxMax_);
780  }
781  catch(const std::string& e) {
782  QDPIO::cerr << "Caught Exception: " << e << std::endl;
783  QDP_abort(1);
784  }
785 
786  return 0;
787  }
788 
789  //! Create OverlapConnectState with eigenvalues/vectors
791  UnprecOvlapContFrac5DFermActArray::createState(const multi1d<LatticeColorMatrix>& u_,
792  const multi1d<Real>& lambda_lo_,
793  const multi1d<LatticeFermion>& evecs_lo_,
794  const Real& lambda_hi_) const
795  {
796  try {
797  return new OverlapConnectState(fbc, u_, lambda_lo_, evecs_lo_, lambda_hi_);
798  }
799  catch(const std::string& e) {
800  QDPIO::cerr << "Caught Exception: " << e << std::endl;
801  QDP_abort(1);
802  }
803 
804  return 0;
805  }
806 
807  //! Create OverlapConnectState from XML
809  UnprecOvlapContFrac5DFermActArray::createState(const multi1d<LatticeColorMatrix>& u_,
810  XMLReader& state_info_xml,
811  const std::string& state_info_path) const
812  {
813  // HACK UP A LINEAR OPERATOR TO CHECK EIGENVALUES/VECTORS WITH
814  Handle< FermState<T,P,Q> > state_aux = new SimpleFermState<T,P,Q> (fbc, u_);
815  Handle< LinearOperator<T> > Maux = S_aux->hermitianLinOp(state_aux);
816 
817  try {
818  return new OverlapConnectState(fbc, u_, state_info_xml, state_info_path, *Maux);
819  }
820  catch(const std::string& e) {
821  QDPIO::cerr << "Caught Exception: " << e << std::endl;
822  QDP_abort(1);
823  }
824 
825  return 0;
826  }
827 
828  //! Create OverlapConnectState from XML
830  UnprecOvlapContFrac5DFermActArray::createState(const multi1d<LatticeColorMatrix>& u_,
831  const OverlapStateInfo& state_info) const
832  {
833  // HACK UP A LINEAR OPERATOR TO CHECK EIGENVALUES/VECTORS WITH
834  Handle< FermState<T,P,Q> > state_aux = new SimpleFermState<T,P,Q> (fbc, u_);
835  Handle< LinearOperator<T> > Maux = S_aux->hermitianLinOp(state_aux);
836 
837  try {
838  return new OverlapConnectState(fbc, u_, state_info, *Maux);
839  }
840  catch(const std::string& e) {
841  QDPIO::cerr << "Caught Exception: " << e << std::endl;
842  QDP_abort(1);
843  }
844 
845  return 0;
846  }
847 
848 } // End namespace Chroma
Primary include file for CHROMA library code.
Create a simple ferm connection state.
Base class for all fermion action boundary conditions.
Definition: fermbc.h:20
Support class for fermion actions and linear operators.
Definition: state.h:94
Base class for quadratic matter actions (e.g., fermions)
Definition: fermact.h:53
Class for counted reference semantics.
Definition: handle.h:33
Linear Operator to arrays.
Definition: linearop.h:61
M^dag.M linear operator over arrays.
Definition: lmdagm.h:67
Propagator of an un-preconditioned Extended-Overlap linear operator.
const Subset & subset() const
Return the subset on which the operator acts.
OvUnprecCF5DQprop(Handle< LinearOperatorArray< T > > A_, const Real &Mass_, const SysSolverCGParams &invParam_)
Constructor.
SystemSolverResults_t operator()(T &psi, const T &chi) const
Solver the linear system.
Overlap connection state.
Definition: overlap_state.h:26
Simple version of FermState.
static T & Instance()
Definition: singleton.h:432
Linear system solvers.
Definition: syssolver.h:34
Unpreconditioned linear operator including derivatives.
Definition: linearop.h:203
5D continued fraction overlap action (Borici,Wenger, Edwards)
OverlapConnectState * createState(const multi1d< LatticeColorMatrix > &u, XMLReader &state_info_xml, const std::string &state_info_path) const
Create OverlapConnectState from XML.
Handle< UnprecWilsonTypeFermAct< T, P, Q > > S_aux
UnprecLinearOperatorArray< T, P, Q > * linOp(Handle< FermState< T, P, Q > > state) const
Produce a linear operator for this action.
LinearOperatorArray< T > * lnonHermMdagM(Handle< FermState< T, P, Q > > state) const
Produce a linear operator M^dag.M for this action.
LinearOperatorArray< T > * lnonHermLinOp(Handle< FermState< T, P, Q > > state) const
Produce a linear operator for this action.
void init(Real &scale_fac, multi1d< Real > &alpha, multi1d< Real > &beta, int &NEig, multi1d< Real > &EigValFunc, const OverlapConnectState &state) const
Helper in construction.
UnprecLinearOperatorArray< T, P, Q > * linOpPV(Handle< FermState< T, P, Q > > state) const
Produce a Pauli-Villars linear operator for this action.
SystemSolver< LatticeFermion > * qprop(Handle< FermState< T, P, Q > > state, const GroupXML_t &invParam) const
Compute quark propagator over base type.
Unpreconditioned Extended-Overlap (N&N) linear operator.
Unpreconditioned Extended-Overlap (N&N) linear operator.
Unpreconditioned Pauli-Villars Continued Fraction 5D.
Unpreconditioned Wilson-like fermion actions with derivatives.
Definition: fermact.orig.h:491
Wilson-like fermion actions.
Definition: fermact.orig.h:403
Enums.
Fermion action factories.
Fermionic boundary condition reader.
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.
Handle< FermBC< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > > reader(XMLReader &xml_in, const std::string &path)
Helper function for the FermionAction readers.
SystemSolverResults_t InvCG2(const LinearOperator< LatticeFermionF > &M, const LatticeFermionF &chi, LatticeFermionF &psi, const Real &RsdCG, int MaxCG)
Conjugate-Gradient (CGNE) algorithm for a generic Linear Operator.
Definition: invcg2.cc:240
@ COEFF_TYPE_ZOLOTAREV
@ COEFF_TYPE_TANH
@ COEFF_TYPE_TANH_UNSCALED
Params params
Conjugate-Gradient algorithm for a generic Linear Operator.
int epsilon(int i, int j, int k)
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
WilsonTypeFermAct5D< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > * createFermAct5D(XMLReader &xml_in, const std::string &path)
Callback function.
FermionAction< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > * createFermAct(XMLReader &xml_in, const std::string &path)
Callback function.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
QDP_error_exit("too many BiCG iterations", n_count, rsd_sq, cp, c, re_rvr, im_rvr, re_a, im_a, re_b, im_b)
int G5
Definition: pbg5p_w.cc:57
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
push(xml_out,"Condensates")
LinOpSysSolverMGProtoClover::T T
int i
Definition: pbg5p_w.cc:55
@ MINUS
Definition: chromabase.h:45
@ PLUS
Definition: chromabase.h:45
multi1d< LatticeFermion > chi(Ncb)
LatticeFermion psi
Definition: mespbg5p_w.cc:35
pop(xml_out)
START_CODE()
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
Definition: pbg5p_w.cc:28
const WilsonTypeFermAct< multi1d< LatticeFermion > > & S_f
Definition: pbg5p_w.cc:27
Double zero
Definition: invbicg.cc:106
static QDP_ColorVector * in
::std::string string
Definition: gtest.h:1979
Simple ferm state and a creator.
Hold group xml and type id.
Params for CG inverter.
Holds return info from SystemSolver call.
Definition: syssolver.h:17
CoeffType approximation_type
ZOLOTAREV | TANH | Other approximation coeffs.
Solve a CG1 system.
Double ftmp1
Definition: topol.cc:29
Unpreconditioned extended-Overlap (5D) (Naryanan&Neuberger) action.
Unpreconditioned extended-Overlap (5D) (Naryanan&Neuberger) linear operator.
Unpreconditioned extended-Overlap (5D) (Naryanan&Neuberger) linear operator.
Unpreconditioned Pauli-Villars Continued Fraction 5D.
Unpreconditioned Wilson fermion action.
void zolotarev_free(ZOLOTAREV_DATA *f)
ZOLOTAREV_DATA * higham(PRECISION epsilon, int n)
ZOLOTAREV_DATA * zolotarev(PRECISION epsilon, int n, int type)