CHROMA
syssolver_linop_eigcg_array.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Solve a M*psi=chi linear system array by EigCG2
4  */
5 
6 #ifndef __syssolver_linop_eigcg_array_h__
7 #define __syssolver_linop_eigcg_array_h__
8 
9 #include "handle.h"
10 #include "syssolver.h"
11 #include "linearop.h"
12 #include "lmdagm.h"
13 #include "named_obj.h"
15 
19 
20 namespace Chroma
21 {
22 
23  //! Eigenstd::vector accelerated CG system solver namespace
24  namespace LinOpSysSolverEigCGArrayEnv
25  {
26  //! Register the syssolver
27  bool registerAll();
28  }
29 
30 
31  //! Solve a M*psi=chi linear system by CG2 with eigenvectors
32  /*! \ingroup invert
33  */
34  template<typename T>
36  {
37  public:
38  //! Constructor
39  /*!
40  * \param M_ Linear operator ( Read )
41  * \param invParam_ inverter parameters ( Read )
42  */
44  const SysSolverEigCGParams& invParam_) :
45  MdagM(new MdagMLinOpArray<T>(A_)), A(A_), invParam(invParam_)
46  {
47  // NEED to grab the eignvectors from the named buffer here
49  {
51  LinAlg::RitzPairsArray<T>& GoodEvecs =
53 
54  if(invParam.Neig_max>0 ){
55  GoodEvecs.init(invParam.Neig_max,MdagM->size());
56  }
57  else{
58  GoodEvecs.init(invParam.Neig,MdagM->size());
59  }
60  }
61  }
62 
63  //! Destructor is automatic
65  {
67  {
69  }
70  }
71 
72  //! Return the subset on which the operator acts
73  const Subset& subset(void) const {return A->subset();}
74 
75  //! Expected length of array index
76  int size(void) const {return A->size(); }
77 
78  //! Solver the linear system
79  /*!
80  * \param psi solution ( Modify )
81  * \param chi source ( Read )
82  * \return syssolver results
83  *
84  * Definitions supplied in the correspond .cc file
85  */
86  SystemSolverResults_t operator() (multi1d<T>& psi, const multi1d<T>& chi) const;
87 
88  private:
89  // Hide default constructor
91 
95  };
96 
97 } // End namespace
98 
99 #endif
100 
Class for counted reference semantics.
Definition: handle.h:33
Holds eigenvalues and arrays of eigenvectors for use in 5D work.
Definition: containers.h:446
void init(int N, int Ls)
Definition: containers.h:455
Solve a M*psi=chi linear system by CG2 with eigenvectors.
Handle< LinearOperatorArray< T > > MdagM
int size(void) const
Expected length of array index.
SystemSolverResults_t operator()(multi1d< T > &psi, const multi1d< T > &chi) const
Solver the linear system.
const Subset & subset(void) const
Return the subset on which the operator acts.
~LinOpSysSolverEigCGArray()
Destructor is automatic.
Handle< LinearOperatorArray< T > > A
LinOpSysSolverEigCGArray(Handle< LinearOperatorArray< T > > A_, const SysSolverEigCGParams &invParam_)
Constructor.
SystemSolver disambiguator.
Linear Operator to arrays.
Definition: linearop.h:61
M^dag.M linear operator over arrays.
Definition: lmdagm.h:67
static T & Instance()
Definition: singleton.h:432
Class for counted reference semantics.
Linear Operators.
M^dag*M composition of a linear operator.
Named object support.
Named object function std::map.
bool registerAll()
Register all the factories.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
LinOpSysSolverMGProtoClover::T T
multi1d< LatticeFermion > chi(Ncb)
LatticeFermion psi
Definition: mespbg5p_w.cc:35
Params for EigCG inverter.
Holds return info from SystemSolver call.
Definition: syssolver.h:17
Linear system solvers.
Solve a CG1 system.
Disambiguator for LinOp system solvers.