CHROMA
eigen_state.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Eigenstate reader
4  */
5 
6 #ifndef eigen_state_h
7 #define eigen_state_h
8 
9 #include "named_obj.h"
10 #include "state.h"
11 #include "chromabase.h"
12 #include "util/ferm/eigeninfo.h"
14 
15 namespace Chroma
16 {
17 
18  //! Eigen-state holder
19  /*! @ingroup fermstates */
20  class EigenConnectState : public FermState<LatticeFermion,
21  multi1d<LatticeColorMatrix>,
22  multi1d<LatticeColorMatrix> >
23  {
24  public:
25  // Typedefs to save typing
26  typedef LatticeFermion T;
27  typedef multi1d<LatticeColorMatrix> P;
28  typedef multi1d<LatticeColorMatrix> Q;
29 
30  //! Main constructor
32  const multi1d<LatticeColorMatrix>& u_) :
33  fbc(fbc_), u(u_)
34  {
35  QDPIO::cout << "Calling EigenConnectState constructor with no IDs" << std::endl;
36  fbc->modify(u);
37  eigen_info_id = "";
38  Neig = 0;
39  dummy_evecs.resize(0);
40  dummy_evals.resize(0);
41  }
42 
44  const multi1d<LatticeColorMatrix>& u_,
45  std::string eigen_info_id_) :
46  fbc(fbc_), u(u_)
47  {
48  fbc->modify(u);
49  eigen_info_id = eigen_info_id_;
50  QDPIO::cout << "Creating EigenConnectState using eigen_info_id :" << eigen_info_id << std::endl << std::flush ;
51 
53  dummy_evecs.resize(0);
54  dummy_evals.resize(0);
55 
56  }
57 
59 
60  const multi1d<LatticeColorMatrix>& getLinks() const {
61  return u;
62  }
63 
64  //! Return the eigenvalues
65  multi1d<Real>& getEvalues() {
66  if (Neig == 0) {
67  return dummy_evals;
68  }
69 
71  }
72 
73  //! Return the eigenvalues
74  const multi1d<Real>& getEvalues() const {
75  if (Neig == 0) {
76  return dummy_evals;
77  }
78 
80  }
81 
82  multi1d<LatticeFermion>& getEvectors() {
83  if (Neig == 0) {
84  return dummy_evecs;
85  }
86 
88 
89  }
90 
91  const multi1d<LatticeFermion>& getEvectors() const {
92  if (Neig == 0) {
93  return dummy_evecs;
94  }
95 
97 
98  }
99 
100  Real& getLargest() {
101  if (Neig == 0) {
102  QDPIO::cerr<< "Attempt to call getEvalues() on state with no e-values" << std::endl;
103  QDP_abort(1);
104  }
105 
107  }
108 
109  const Real& getLargest() const {
110  if (Neig == 0) {
111  QDPIO::cerr<< "Attempt to call getEvalues() on state with no e-values" << std::endl;
112  QDP_abort(1);
113  }
114 
116  }
117 
118  int getNEig() const {
119  return Neig;
120  }
121 
122  //! Return the ferm BC object for this state
123  const FermBC<T,P,Q>& getBC() const {return *fbc;}
124 
125  //! Return the gauge BC object for this state
126  /*! This is to help the optimized linops */
127  Handle< FermBC<T,P,Q> > getFermBC() const {return fbc;}
128 
129  protected:
130  //! Hide default constructor
132  void operator=(const EigenConnectState&) {}
133 
134  private:
136  multi1d<LatticeColorMatrix> u;
138  int Neig;
139  multi1d<LatticeFermion> dummy_evecs;
140  multi1d<Real> dummy_evals;
141  };
142 
143 
144 
145  //! Create a simple ferm connection state
146  /*! @ingroup fermstates
147  *
148  * This is a factory class for producing a connection state
149  */
150  class CreateEigenConnectState : public CreateFermState<LatticeFermion,
151  multi1d<LatticeColorMatrix>,
152  multi1d<LatticeColorMatrix> >
153  {
154  public:
155  // Typedefs to save typing
156  typedef LatticeFermion T;
157  typedef multi1d<LatticeColorMatrix> P;
158  typedef multi1d<LatticeColorMatrix> Q;
159 
160  //! Full constructor
162 
163  //! Destructor
165 
166  //! Construct a ConnectState
168  {
169  return new EigenConnectState(fbc, q);
170  }
171 
172  //! Return the ferm BC object for this state
173  const FermBC<T,P,Q>& getBC() const {return *fbc;}
174 
175  private:
176  CreateEigenConnectState() {} // hide default constructur
177  void operator=(const CreateEigenConnectState&) {} // hide =
178 
179  private:
181  };
182 
183 
184 
185 }
186 
187 
188 
189 #endif
Primary include file for CHROMA library code.
Create a simple ferm connection state.
Definition: eigen_state.h:153
void operator=(const CreateEigenConnectState &)
Definition: eigen_state.h:177
EigenConnectState * operator()(const Q &q) const
Construct a ConnectState.
Definition: eigen_state.h:167
const FermBC< T, P, Q > & getBC() const
Return the ferm BC object for this state.
Definition: eigen_state.h:173
multi1d< LatticeColorMatrix > Q
Definition: eigen_state.h:158
CreateEigenConnectState(Handle< FermBC< T, P, Q > > fbc_)
Full constructor.
Definition: eigen_state.h:161
Handle< FermBC< T, P, Q > > fbc
Definition: eigen_state.h:180
multi1d< LatticeColorMatrix > P
Definition: eigen_state.h:157
Create a fermion connection state.
Definition: create_state.h:69
Eigen-state holder.
Definition: eigen_state.h:23
EigenConnectState(Handle< FermBC< T, P, Q > > fbc_, const multi1d< LatticeColorMatrix > &u_, std::string eigen_info_id_)
Definition: eigen_state.h:43
Handle< FermBC< T, P, Q > > fbc
Definition: eigen_state.h:135
const multi1d< LatticeFermion > & getEvectors() const
Definition: eigen_state.h:91
const Real & getLargest() const
Definition: eigen_state.h:109
multi1d< LatticeColorMatrix > Q
Definition: eigen_state.h:28
void operator=(const EigenConnectState &)
Definition: eigen_state.h:132
Handle< FermBC< T, P, Q > > getFermBC() const
Return the gauge BC object for this state.
Definition: eigen_state.h:127
const multi1d< Real > & getEvalues() const
Return the eigenvalues.
Definition: eigen_state.h:74
multi1d< LatticeColorMatrix > P
Definition: eigen_state.h:27
multi1d< LatticeFermion > dummy_evecs
Definition: eigen_state.h:139
EigenConnectState()
Hide default constructor.
Definition: eigen_state.h:131
multi1d< Real > dummy_evals
Definition: eigen_state.h:140
EigenConnectState(Handle< FermBC< T, P, Q > > fbc_, const multi1d< LatticeColorMatrix > &u_)
Main constructor.
Definition: eigen_state.h:31
const multi1d< LatticeColorMatrix > & getLinks() const
Return the coordinates (link fields) needed in constructing linear operators.
Definition: eigen_state.h:60
multi1d< LatticeColorMatrix > u
Definition: eigen_state.h:136
multi1d< Real > & getEvalues()
Return the eigenvalues.
Definition: eigen_state.h:65
const FermBC< T, P, Q > & getBC() const
Return the ferm BC object for this state.
Definition: eigen_state.h:123
multi1d< LatticeFermion > & getEvectors()
Definition: eigen_state.h:82
Hold eigenvalues and eigenvectors.
Definition: eigeninfo.h:19
Base class for all fermion action boundary conditions.
Definition: fermbc.h:20
Support class for fermion actions and linear operators.
Definition: state.h:94
Class for counted reference semantics.
Definition: handle.h:33
static T & Instance()
Definition: singleton.h:432
Hold eigenvalues and eigenvectors.
Double q
Definition: mesq.cc:17
Named object support.
Named object function std::map.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
::std::string string
Definition: gtest.h:1979
Support class for fermion actions and linear operators.