CHROMA
invmr.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Minimal-Residual (MR) for a generic fermion Linear Operator
4  */
5 
6 #ifndef __invmr_h__
7 #define __invmr_h__
8 
9 #include "linearop.h"
10 #include "syssolver.h"
11 
12 namespace Chroma
13 {
14 
15  //! Minimal-residual (MR) algorithm for a generic Linear Operator
16  /*! \ingroup invert
17  * This subroutine uses the Minimal Residual (MR) algorithm to determine
18  * the solution of the set of linear equations. Here we allow M to be nonhermitian.
19  *
20  * Chi = M . Psi
21  *
22  * Algorithm:
23  *
24  * Psi[0] Argument
25  * r[0] := Chi - M . Psi[0] ; Initial residual
26  * IF |r[0]| <= RsdCG |Chi| THEN RETURN; Converged?
27  * FOR k FROM 1 TO MaxCG DO MR iterations
28  * a[k-1] := <M.r[k-1],r[k-1]> / <M.r[k-1],M.r[k-1]> ;
29  * ap[k-1] := MRovpar * a[k] ; Overrelaxtion step
30  * Psi[k] += ap[k-1] r[k-1] ; New solution std::vector
31  * r[k] -= ap[k-1] A . r[k-1] ; New residual
32  * IF |r[k]| <= RsdCG |Chi| THEN RETURN; Converged?
33 
34  * Arguments:
35 
36  * \param M Linear Operator (Read)
37  * \param chi Source (Read)
38  * \param psi Solution (Modify)
39  * \param RsdCG MR residual accuracy (Read)
40  * \param MRovpar Overrelaxation parameter (Read)
41  * \param MaxCG Maximum MR iterations (Read)
42 
43  * Local Variables:
44 
45  * r Residual std::vector
46  * cp | r[k] |**2
47  * c | r[k-1] |**2
48  * k MR iteration counter
49  * a a[k]
50  * d < M.r[k], M.r[k] >
51  * R_Aux Temporary for M.Psi
52  * Mr Temporary for M.r
53 
54  * Global Variables:
55 
56  * MaxCG Maximum number of MR iterations allowed
57  * RsdCG Maximum acceptable MR residual (relative to source)
58  *
59  * Subroutines:
60  *
61  * M Apply matrix to std::vector
62  *
63  * @{
64  */
65 
66  template<typename T>
67  SystemSolverResults_t
68  InvMR(const LinearOperator<T>& M,
69  const T& chi,
70  T& psi,
71  const Real& MRovpar,
72  const Real& RsdMR,
73  int MaxMR,
74  enum PlusMinus isign);
75 
76  /*! @} */ // end of group invert
77 
78 } // end namespace Chroma
79 
80 #endif
SystemSolverResults_t InvMR(const LinearOperator< LatticeFermion > &M, const LatticeFermion &chi, LatticeFermion &psi, const Real &MRovpar, const Real &RsdMR, int MaxMR, enum PlusMinus isign)
Minimal-residual (MR) algorithm for a generic Linear Operator.
Definition: invmr.cc:185
Linear Operators.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
multi1d< LatticeFermion > chi(Ncb)
LatticeFermion psi
Definition: mespbg5p_w.cc:35
RsdMR
Definition: pade_trln_w.cc:26
Linear system solvers.
LatticeFermion T
Definition: t_clover.cc:11