5 #include <qdp-lapack.h>
17 #define TEST_ALGORITHM
22 namespace MdagMSysSolverQDPEigCGEnv
27 Handle<
FermState< LatticeFermion, multi1d<LatticeColorMatrix>, multi1d<LatticeColorMatrix> > >
state,
85 multi1d<Double> lambda ;
93 while((flag==-1)||flag==3){
96 QDPIO::cout<<
"GoodEvecs.Neig= "<<GoodEvecs.
Neig<<std::endl;
105 QDPIO::cout <<
"InitGuess: time = "
106 << snoop.getTimeInSeconds()
107 <<
" secs" << std::endl;
110 if((GoodEvecs.
Neig)<GoodEvecs.
evec.vec.size())
124 double Time = snoop.getTimeInSeconds() ;
130 Time += snoop.getTimeInSeconds() ;
143 char V =
'V' ;
char U =
'U' ;
144 QDPLapack::zheev(V,
U,Htmp.mat,lambda);
145 evec.resize(GoodEvecs.
Neig) ;
147 for(
int k(0);
k<GoodEvecs.
Neig;
k++){
148 GoodEvecs.
eval[
k] = lambda[
k];
150 for(
int j(0);
j<GoodEvecs.
Neig;
j++)
151 evec[
k][
MdagM.subset()] += conj(Htmp(
k,
j))*GoodEvecs.
evec[
j] ;
154 Time += snoop.getTimeInSeconds() ;
156 QDPIO::cout <<
"Evec_Refinement: time = "
158 <<
" secs" << std::endl;
162 for(
int k(0);
k<GoodEvecs.
Neig;
k++)
168 for(
int k(0);
k<GoodEvecs.
Neig;
k++){
173 QDPIO::cout<<
"REFINE: error evec["<<
k<<
"] = "<<tt<<
" " ;
174 QDPIO::cout<<
"--- eval ="<<GoodEvecs.
eval[
k]<<
" ";
175 tt = sqrt(norm2(GoodEvecs.
evec[
k],
MdagM.subset()));
176 QDPIO::cout<<
"--- rq ="<<real(rq)<<
" ";
177 QDPIO::cout<<
"--- norm = "<<tt<<std::endl ;
211 if(toBool(restartTol!=invParam.
RsdCG)){
214 QDPIO::cout<<
"Restart: "<<restart<<std::endl ;
220 restartTol *=restartTol ;
221 if(toBool(restartTol < invParam.
RsdCG)){
222 restartTol = invParam.
RsdCG;
Support class for fermion actions and linear operators.
Class for counted reference semantics.
Holds eigenvalues and eigenvectors.
void AddVectors(const multi1d< Double > &e, const multi1d< T > &v, const Subset &s)
Solve a M*psi=chi linear system by CG2 with eigenvectors.
SystemSolverResults_t operator()(T &psi, const T &chi) const
Solver the linear system.
void normGramSchmidt(multi1d< LatticeFermionF > &vec, int f, int t, const Subset &sub)
Gram-Schmidt with normalization.
SystemSolverResults_t InvCG2(const LinearOperator< LatticeFermionF > &M, const LatticeFermionF &chi, LatticeFermionF &psi, const Real &RsdCG, int MaxCG)
Conjugate-Gradient (CGNE) algorithm for a generic Linear Operator.
Conjugate-Gradient algorithm with eigenstd::vector acceleration.
Conjugate-Gradient algorithm for a generic Linear Operator.
BinaryReturn< C1, C2, FnInnerProduct >::Type_t innerProduct(const QDPSubType< T1, C1 > &s1, const QDPType< T2, C2 > &s2)
void SubSpaceMatrix(LinAlg::Matrix< DComplex > &H, const LinearOperator< LatticeFermionF > &A, const multi1d< LatticeFermionF > &evec, int Nvecs)
SystemSolverResults_t InvEigCG2(const LinearOperator< LatticeFermionF > &A, LatticeFermionF &x, const LatticeFermionF &b, multi1d< Double > &eval, multi1d< LatticeFermionF > &evec, int Neig, int Nmax, const Real &RsdCG, int MaxCG, const int PrintLevel)
SystemSolverResults_t vecPrecondCG(const LinearOperator< LatticeFermionF > &A, LatticeFermionF &x, const LatticeFermionF &b, const multi1d< Double > &eval, const multi1d< LatticeFermionF > &evec, int startV, int endV, const Real &RsdCG, int MaxCG)
void InitGuess(const LinearOperator< LatticeFermionF > &A, LatticeFermionF &x, const LatticeFermionF &b, const multi1d< Double > &eval, const multi1d< LatticeFermionF > &evec, int &n_count)
LinOpSystemSolver< LatticeStaggeredFermion > * createStagFerm(XMLReader &xml_in, const std::string &path, Handle< LinearOperator< LatticeStaggeredFermion > > A)
Callback function.
bool registerAll()
Register all the factories.
static bool registered
Local registration flag.
MdagMSystemSolver< LatticeFermion > * createFerm(XMLReader &xml_in, const std::string &path, Handle< FermState< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > > state, Handle< LinearOperator< LatticeFermion > > A)
Callback function.
const std::string name("EIG_CG_INVERTER")
Name to be used.
Asqtad Staggered-Dirac operator.
LinOpSysSolverMGProtoClover::T T
multi1d< LatticeFermion > chi(Ncb)
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
FloatingPoint< double > Double
Gram-Schmidt with normalization.
Params for EigCG inverter.
Holds return info from SystemSolver call.
Handle< LinearOperator< T > > MdagM
Register MdagM system solvers.
Solve a M^dag*M*psi=chi linear system by EigCG.
Factory for producing system solvers for MdagM*psi = chi.
multi1d< LatticeColorMatrix > U