CHROMA
syssolver.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! @file
3  * @brief Linear system solvers
4  */
5 
6 #ifndef __syssolver_h__
7 #define __syssolver_h__
8 
9 #include "chromabase.h"
10 
11 namespace Chroma
12 {
13  //-----------------------------------------------------------------------------------
14  //! Holds return info from SystemSolver call
15  /*! @ingroup solvers */
17  {
19 
20  int n_count; /*!< Number of iterations */
21  Real resid; /*!< (True) Residual of unpreconditioned problem,
22  * resid = sqrt(norm2(rhs - A.soln)) */
23  };
24 
25 
26  //-----------------------------------------------------------------------------------
27  //! Linear system solvers
28  /*! @ingroup solvers
29  *
30  * Solves linear systems of equations. The solver may only live on a subset.
31  */
32  template<typename T>
34  {
35  public:
36  //! Virtual destructor to help with cleanup;
37  virtual ~SystemSolver() {}
38 
39  //! Apply the operator onto a source std::vector
40  /*!
41  * Solves A*psi = chi or psi = A^(-1)*chi up to some accuracy.
42  * There is the interesting possibility of generalizing to support PLUS/MINUS
43  *
44  * Should the accuracy be specified here ???
45  */
46  virtual SystemSolverResults_t operator() (T& psi, const T& chi) const = 0;
47 
48  //! Return the subset on which the operator acts
49  virtual const Subset& subset() const = 0;
50  };
51 
52 
53 
54  //-----------------------------------------------------------------------------------
55  //! Linear system solvers of arrays
56  /*! @ingroup solvers
57  *
58  * Solves linear systems of equations. The solver may only live on a subset.
59  */
60  template<typename T>
62  {
63  public:
64  //! Virtual destructor to help with cleanup;
65  virtual ~SystemSolverArray() {}
66 
67  //! Expected length of array index
68  virtual int size() const = 0;
69 
70  //! Apply the operator onto a source std::vector
71  /*!
72  * Solves A*psi = chi or psi = A^(-1)*chi up to some accuracy.
73  * There is the interesting possibility of generalizing to support PLUS/MINUS
74  *
75  * Should the accuracy be specified here ???
76  */
77  virtual SystemSolverResults_t operator() (multi1d<T>& psi, const multi1d<T>& chi) const = 0;
78 
79  //! Return the subset on which the operator acts
80  virtual const Subset& subset() const = 0;
81  };
82 
83 
84 
85  //-----------------------------------------------------------------------------------
86  //! Linear multi-system solvers
87  /*! @ingroup solvers
88  *
89  * Solves multi-shift linear systems of equations. The solver may only live on a subset.
90  */
91  template<typename T>
93  {
94  public:
95  //! Virtual destructor to help with cleanup;
96  virtual ~MultiSystemSolver() {}
97 
98  //! Apply the operator onto a source std::vector
99  /*!
100  * Solves A*psi = chi or psi = A^(-1)*chi up to some accuracy.
101  * There is the interesting possibility of generalizing to support PLUS/MINUS
102  *
103  * Should the accuracy be specified here ???
104  *
105  * Should the shifts be here or in the constructor???
106  */
107  virtual SystemSolverResults_t operator() (multi1d<T>& psi,
108  const multi1d<Real>& shifts,
109  const T& chi) const = 0;
110 
111  //! Return the subset on which the operator acts
112  virtual const Subset& subset() const = 0;
113  };
114 
115 
116 
117 
118  //-----------------------------------------------------------------------------------
119  //! Linear multi-system solvers of arrays
120  /*! @ingroup solvers
121  *
122  * Solves multi-shift linear systems of equations. The solver may only live on a subset.
123  */
124  template<typename T>
126  {
127  public:
128  //! Virtual destructor to help with cleanup;
130 
131  //! Expected length of array index
132  virtual int size() const = 0;
133 
134  //! Apply the operator onto a source std::vector
135  /*!
136  * Solves A*psi = chi or psi = A^(-1)*chi up to some accuracy.
137  * There is the interesting possibility of generalizing to support PLUS/MINUS
138  *
139  * Should the accuracy be specified here ???
140  *
141  * Should the shifts be here or in the constructor???
142  */
143  virtual SystemSolverResults_t operator() (multi1d< multi1d<T> >& psi,
144  const multi1d<Real>& shifts,
145  const multi1d<T>& chi) const = 0;
146 
147  //! Return the subset on which the operator acts
148  virtual const Subset& subset() const = 0;
149  };
150 
151 
152  //-----------------------------------------------------------------------------------
153  //! Linear multi-system solvers with accumulation
154  /*! @ingroup solvers
155  *
156  * A tweak of solvers for multi-shift linear systems of equations.
157  * so that the results are accumulated a la:
158  *
159  * s = A sum_sigma t_i X_i
160  * where x_i are the solutions.
161  * The solver may only live on a subset.
162  */
163  template<typename T>
165  {
166  public:
167  //! Virtual destructor to help with cleanup;
169 
170  //! Apply the operator onto a source std::vector
172  const Real& norm,
173  const multi1d<Real>& residues,
174  const multi1d<Real>& poles,
175  const T& chi) const = 0;
176 
177  //! Return the subset on which the operator acts
178  virtual const Subset& subset() const = 0;
179  };
180 
181  //-----------------------------------------------------------------------------------
182  //! Linear multi-system solvers with accumulation
183  /*! @ingroup solvers
184  *
185  * A tweak of solvers for multi-shift linear systems of equations.
186  * so that the results are accumulated a la:
187  *
188  * s = A sum_sigma t_i X_i
189  * where x_i are the solutions.
190  * The solver may only live on a subset.
191  */
192  template<typename T>
194  {
195  public:
196  //! Virtual destructor to help with cleanup;
198 
199  //! Apply the operator onto a source std::vector
200  virtual SystemSolverResults_t operator() (multi1d<T>& psi,
201  const Real& norm,
202  const multi1d<Real>& residues,
203  const multi1d<Real>& poles,
204  const multi1d<T>& chi) const = 0;
205 
206  //! Return the subset on which the operator acts
207  virtual const Subset& subset() const = 0;
208  };
209 
210 }
211 
212 
213 
214 #endif
Primary include file for CHROMA library code.
Linear multi-system solvers with accumulation.
Definition: syssolver.h:194
virtual SystemSolverResults_t operator()(multi1d< T > &psi, const Real &norm, const multi1d< Real > &residues, const multi1d< Real > &poles, const multi1d< T > &chi) const =0
Apply the operator onto a source std::vector.
virtual ~MultiSystemSolverAccumulateArray()
Virtual destructor to help with cleanup;.
Definition: syssolver.h:197
virtual const Subset & subset() const =0
Return the subset on which the operator acts.
Linear multi-system solvers with accumulation.
Definition: syssolver.h:165
virtual const Subset & subset() const =0
Return the subset on which the operator acts.
virtual ~MultiSystemSolverAccumulate()
Virtual destructor to help with cleanup;.
Definition: syssolver.h:168
virtual SystemSolverResults_t operator()(T &psi, const Real &norm, const multi1d< Real > &residues, const multi1d< Real > &poles, const T &chi) const =0
Apply the operator onto a source std::vector.
Linear multi-system solvers of arrays.
Definition: syssolver.h:126
virtual ~MultiSystemSolverArray()
Virtual destructor to help with cleanup;.
Definition: syssolver.h:129
virtual const Subset & subset() const =0
Return the subset on which the operator acts.
virtual SystemSolverResults_t operator()(multi1d< multi1d< T > > &psi, const multi1d< Real > &shifts, const multi1d< T > &chi) const =0
Apply the operator onto a source std::vector.
virtual int size() const =0
Expected length of array index.
Linear multi-system solvers.
Definition: syssolver.h:93
virtual SystemSolverResults_t operator()(multi1d< T > &psi, const multi1d< Real > &shifts, const T &chi) const =0
Apply the operator onto a source std::vector.
virtual const Subset & subset() const =0
Return the subset on which the operator acts.
virtual ~MultiSystemSolver()
Virtual destructor to help with cleanup;.
Definition: syssolver.h:96
Linear system solvers of arrays.
Definition: syssolver.h:62
virtual const Subset & subset() const =0
Return the subset on which the operator acts.
virtual ~SystemSolverArray()
Virtual destructor to help with cleanup;.
Definition: syssolver.h:65
virtual int size() const =0
Expected length of array index.
virtual SystemSolverResults_t operator()(multi1d< T > &psi, const multi1d< T > &chi) const =0
Apply the operator onto a source std::vector.
Linear system solvers.
Definition: syssolver.h:34
virtual SystemSolverResults_t operator()(T &psi, const T &chi) const =0
Apply the operator onto a source std::vector.
virtual ~SystemSolver()
Virtual destructor to help with cleanup;.
Definition: syssolver.h:37
virtual const Subset & subset() const =0
Return the subset on which the operator acts.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
LinOpSysSolverMGProtoClover::T T
multi1d< LatticeFermion > chi(Ncb)
LatticeFermion psi
Definition: mespbg5p_w.cc:35
Double zero
Definition: invbicg.cc:106
int norm
Definition: qtopcor.cc:35
Holds return info from SystemSolver call.
Definition: syssolver.h:17