CHROMA
mre_initcg_extrap_predictor.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Minimal residual predictor - which takes also information
4  * from an EIG CG e-vec basis...
5  *
6  * Predictors for HMC
7  */
8 
9 #ifndef __mre_initcg_hmc_extrap_predictor_h__
10 #define __mre_initcg_hmc_extrap_predictor_h__
11 
12 #include "chromabase.h"
13 #include "handle.h"
19 
20 namespace Chroma
21 {
22 
23  /*! @ingroup predictor */
24  namespace MREInitCG4DChronoPredictorEnv
25  {
26  extern const std::string name;
27  bool registerAll();
28  }
29 
30  //! Minimal residual predictor
31  /*! @ingroup predictor */
33  : public AbsChronologicalPredictor4D<LatticeFermion>
34  {
35  private:
37 
38  void find_extrap_solution(LatticeFermion& psi,
40  const LatticeFermion& chi);
41 
43  int Neig; // No of vecs produced by EigCG per solve
44 
45  public:
46 
47  MREInitCG4DChronoPredictor(unsigned int max_chrono, const std::string& eigen_id, unsigned int max_evec) : chrono_buf(new CircularBuffer<LatticeFermion>(max_chrono)), opt_eigen_id(eigen_id), Neig(max_evec) {}
48 
49  // Destructor is automagic
51 
52  // Do the hard work
53  void operator()(LatticeFermion& psi,
55  const LatticeFermion& chi);
56 
57  // No internal state so reset is a nop
58  void reset(void) {
59  chrono_buf->reset();
60  }
61 
62  // Ignore new std::vector
63  void newVector(const LatticeFermion& psi)
64  {
65  START_CODE();
66 
67  QDPIO::cout << "MREPredictor: registering new solution. " << std::endl;
68  if( chrono_buf->sizeMax() > 0 ) {
69  chrono_buf->push(psi);
70  }
71 
72 
73  QDPIO::cout << "MREPredictor: number of vectors stored is = " << chrono_buf->size() << std::endl;
74 
75  END_CODE();
76  }
77 
78  };
79 
80 
81 
82 } // End Namespace Chroma
83 
84 #endif
Primary include file for CHROMA library code.
Chronological predictor for HMC.
Monomial factories.
Circular buffers.
Abstract interface for a Chronological Solution predictor.
Circular Buffer.
Class for counted reference semantics.
Definition: handle.h:33
Handle< CircularBuffer< LatticeFermion > > chrono_buf
void newVector(const LatticeFermion &psi)
MREInitCG4DChronoPredictor(unsigned int max_chrono, const std::string &eigen_id, unsigned int max_evec)
void operator()(LatticeFermion &psi, const LinearOperator< LatticeFermion > &A, const LatticeFermion &chi)
void find_extrap_solution(LatticeFermion &psi, const LinearOperator< LatticeFermion > &A, const LatticeFermion &chi)
Class for counted reference semantics.
Named object function std::map.
bool registerAll()
Register all the factories.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
multi1d< LatticeFermion > chi(Ncb)
LatticeFermion psi
Definition: mespbg5p_w.cc:35
START_CODE()
A(A, psi, r, Ncb, PLUS)
::std::string string
Definition: gtest.h:1979