CHROMA
chrono_predictor.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Chronological predictor for HMC
4  *
5  * Chronological predictor for HMC
6  */
7 
8 #ifndef chrono_predictor_h
9 #define chrono_predictor_h
10 
11 #include "chromabase.h"
12 #include "linearop.h"
13 
14 using namespace QDP;
15 using namespace Chroma;
16 
17 namespace Chroma
18 {
19 
20  //! Abstract interface for a Chronological Solution predictor
21  /*! @ingroup predictor */
22  template<typename T>
24  public:
25 
26  // Virtual destructor to help with cleanup
28 
29  // Set psi to be the next initial guess
30  //
31  // I have expanded the interface to allow us to
32  // pass the Matrix M, and the RHS chi as well as phi
33  //
34  // We are trying to solve the system:
35  // A psi = chi
36  //
37  // for a CG situation A = MdagM
38  //
39  // and we are trying to get a guess for phi which
40  // minimises the initial residual.
41  virtual void operator()(T& psi,
42  const LinearOperator<T>& A,
43  const T& chi) = 0;
44 
45  // Reset internal state (call this if the gauge field or
46  // pseudofermion fields change)
47  virtual void reset(void) = 0;
48 
49  // Present new std::vector for use in future chronological
50  // Predictors
51  virtual void newVector(const T& psi) = 0;
52  };
53 
54  //! Abstract interface for a Chronological Solution predictor
55  /*! @ingroup predictor */
56  template<typename T>
58  public:
59 
60  // Virtual destructor to help with cleanup
62 
63  // Set psi to be the next initial guess
64  //
65  // I have expanded the interface to allow us to
66  // pass the Matrix M, and the RHS chi as well as phi
67  //
68  // We are trying to solve the system:
69  // A psi = chi
70  //
71  // for a CG situation A = MdagM
72  //
73  // and we are trying to get a guess for phi which
74  // minimises the initial residual.
75 
76  virtual void predictX(T& X, const T& chi, const Subset& s) const
77  {
78  QDPIO::cerr << "Not Implemented" << std::endl;
79  QDP_abort(1);
80  }
81 
82  virtual void predictY(T& Y, const T& chi, const Subset& s) const
83  {
84  QDPIO::cerr << "Not Implemented" << std::endl;
85  QDP_abort(1);
86  }
87 
88 
89 
90  virtual void predictX(T& X,
91  const LinearOperator<T>& A,
92  const T& chi) = 0;
93 
94 
95  virtual void predictY(T& Y,
96  const LinearOperator<T>& A,
97  const T& chi) = 0;
98 
99  // Reset internal state (call this if the gauge field or
100  // pseudofermion fields change)
101  virtual void reset(void) = 0;
102 
103 
104  virtual void newXVector(const T& X) = 0;
105  virtual void newYVector(const T& Y) = 0;
106 
107 
108  virtual void newXVector(const T& X_in, const LinearOperator<T>& M)
109  {
110  QDPIO::cerr << "Not Implemented" <<std::endl;
111  QDP_abort(1);
112  }
113 
114  virtual void newYVector(const T& Y_in, const LinearOperator<T>& M)
115  {
116  QDPIO::cerr << "Not Implemented" <<std::endl;
117  QDP_abort(1);
118  }
119 
120  // This is a 'predict X' which is always MdagM X = phi
121  // These two are backward compatibilities until everything
122  // is changed...
123  virtual void operator()(T& psi,
124  const LinearOperator<T>& A,
125  const T& chi)
126  {
127 
128  predictX(psi, A, chi);
129  }
130 
131  // Present new std::vector for use in future chronological
132  // Predictors
133  virtual void newVector(const T& psi)
134  {
135  newXVector(psi);
136  }
137 
138  // These two deal with the
139  };
140 
141 
142  //! Abstract interface for a Chronological Solution predictor in 5D
143  /*! @ingroup predictor */
144  template<typename T>
146  public:
147 
149 
150  // Set psi to be the next initial guess
151  // I have expanded the interface to allow us to
152  // pass the Matrix M, and the RHS chi as well as phi
153  //
154  // We are trying to solve the system
155  // A psi = chi
156  //
157  // (for now in a CG based situation A = MdagM)
158  //
159  // and we are trying to get a guess for phi which
160  // minimises the initial residual.
161  virtual void operator()(multi1d<T>& psi,
162  const LinearOperatorArray<T>& A,
163  const multi1d<T>& chi) = 0;
164 
165 
166  // Reset internal state (call this if the gauge field or
167  // pseudofermion fields change)
168  virtual void reset(void) = 0;
169 
170  // Present new std::vector for use in future chronological
171  // Predictors
172  virtual void newVector(const multi1d<T>& psi) = 0;
173  };
174 
175 } // End namespace
176 #endif
Primary include file for CHROMA library code.
Abstract interface for a Chronological Solution predictor.
virtual void newVector(const T &psi)=0
virtual void operator()(T &psi, const LinearOperator< T > &A, const T &chi)=0
Abstract interface for a Chronological Solution predictor in 5D.
virtual void newVector(const multi1d< T > &psi)=0
virtual void operator()(multi1d< T > &psi, const LinearOperatorArray< T > &A, const multi1d< T > &chi)=0
Abstract interface for a Chronological Solution predictor.
virtual void newYVector(const T &Y_in, const LinearOperator< T > &M)
virtual void operator()(T &psi, const LinearOperator< T > &A, const T &chi)
virtual void predictY(T &Y, const T &chi, const Subset &s) const
virtual void newYVector(const T &Y)=0
virtual void predictY(T &Y, const LinearOperator< T > &A, const T &chi)=0
virtual void predictX(T &X, const T &chi, const Subset &s) const
virtual void newXVector(const T &X_in, const LinearOperator< T > &M)
virtual void newXVector(const T &X)=0
virtual void predictX(T &X, const LinearOperator< T > &A, const T &chi)=0
Linear Operator to arrays.
Definition: linearop.h:61
Linear Operator.
Definition: linearop.h:27
unsigned s
Definition: ldumul_w.cc:37
Linear Operators.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
LinOpSysSolverMGProtoClover::T T
A(A, psi, r, Ncb, PLUS)
chi
Definition: pade_trln_w.cc:24
psi
Definition: pade_trln_w.cc:191