6 #ifndef __syssolver_mdagm_OPTeigcg_h__
7 #define __syssolver_mdagm_OPTeigcg_h__
27 namespace MdagMSysSolverOptEigCGEnv
53 XMLBufferWriter file_xml;
54 push(file_xml,
"OptEigInfo");
57 write(file_xml,
"ncurEvals",
obj.ncurEvals);
58 write(file_xml,
"restartTol",
obj.restartTol);
60 write(file_xml,
"ldh",
obj.evals.size());
64 QDPFileWriter to(file_xml,
67 QDPIO_SERIAL,QDPIO_OPEN);
69 for(
int v(0);v<
obj.ncurEvals;v++){
72 XMLBufferWriter record_xml;
73 push(record_xml,
"EigenVector");
74 write(record_xml,
"no",v);
76 write(to, record_xml, lf);
80 XMLBufferWriter record_xml;
81 push(record_xml,
"EigenValues");
86 XMLBufferWriter record_xml;
87 push(record_xml,
"H");
92 XMLBufferWriter record_xml;
93 push(record_xml,
"HU");
101 QDPIO::cout<<
" QIOWriteOptEvecs: Time to write evecs= "
102 << swatch.getTimeInSeconds() <<
" secs "<<std::endl ;
124 XMLReader record_xml;
129 read(file_xml,
"/OptEigInfo/ldh", ldh);
130 read(file_xml,
"/OptEigInfo/lde", lde);
131 read(file_xml,
"/OptEigInfo/N", N);
132 read(file_xml,
"/OptEigInfo/ncurEvals",
obj.ncurEvals);
133 read(file_xml,
"/OptEigInfo/restartTol", restartTol);
135 QDPIO::cout <<__func__ <<
" : Reading object with following properties"<<std::endl ;
136 QDPIO::cout <<__func__ <<
" : lde= " << lde << std::endl;
137 QDPIO::cout <<__func__ <<
" : ldh= " << ldh << std::endl;
138 QDPIO::cout <<__func__ <<
" : N = " << N << std::endl;
140 QDPIO::cout << __func__ <<
" : ncurEvals = " <<
obj.ncurEvals<< std::endl;
141 QDPIO::cout << __func__ <<
" : restartTol = " << restartTol<< std::endl;
143 if(
obj.evals.size()<
obj.ncurEvals){
144 QDPIO::cerr<<__func__<<
" : ldh of the current object is not large enough to hold the vectors" ;
148 for(
int v(0);v<
obj.ncurEvals;v++){
150 XMLReader record_xml;
151 read(to, record_xml, lf);
156 XMLReader record_xml;
157 multi1d<Real> evals(ldh) ;
158 multi1d<Complex> H(ldh*ldh) ;
159 multi1d<Complex> HU(ldh*ldh) ;
160 read(to, record_xml, evals);
161 read(to, record_xml, H);
162 read(to, record_xml, HU);
163 if(ldh<=
obj.evals.size()){
164 for(
int i(0);
i<ldh;
i++)
165 obj.evals[
i] = evals[
i] ;
166 for(
int i(0);
i<H.size();
i++){
172 QDPIO::cerr<<__func__<<
" : ldh of the current object is not large enough to hold the Cholesky factors" ;
181 QDPIO::cout<<
" QIOReadOptEvecs: Time to read evecs= "
182 << swatch.getTimeInSeconds() <<
" secs "<<std::endl ;
194 #ifndef QDP_IS_QDPJIT
202 int N = Layout::sitesOnNode()*Nc*Ns ;
203 int VectorSpaceSize = Nc*Ns*(
A->subset()).numSiteTable();
207 QDPIO::cout<<
"MdagMSysSolverOptEigCG : reading evecs from disk"<<std::endl ;
218 QDPIO::cout<<
"MdagMSysSolverOptEigCG : writing evecs to disk"<<std::endl ;
228 const Subset&
subset()
const {
return A->subset();}
Abstract interface for a Chronological Solution predictor.
virtual void newVector(const T &psi)=0
Class for counted reference semantics.
void init(int ldh, int lde_)
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 QIOReadOptEvecs()
Read a OptEigInfo Type
SystemSolverResults_t operator()(T &psi, const T &chi, AbsChronologicalPredictor4D< T > &predictor) const
Solve the linear system starting with a chrono guess.
SysSolverOptEigCGParams invParam
MdagMSysSolverOptEigCG(Handle< LinearOperator< T > > A_, const SysSolverOptEigCGParams &invParam_)
Constructor.
const Subset & subset() const
Return the subset on which the operator acts.
void QIOWriteOptEvecs()
Write out an OptEigInfo Type
~MdagMSysSolverOptEigCG()
Destructor is automatic.
Handle< LinearOperator< T > > MdagM
Handle< LinearOperator< T > > A
SystemSolver disambiguator.
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams ¶m)
Read parameters.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams ¶m)
Writer parameters.
std::string uniqueId()
Return a unique id.
Class for counted reference semantics.
Handle< MapObject< int, EVPair< LatticeColorVector > > > obj
M^dag*M composition of a linear operator.
Named object function std::map.
bool registerAll()
Register all the factories.
Asqtad Staggered-Dirac operator.
push(xml_out,"Condensates")
LinOpSysSolverMGProtoClover::T T
multi1d< LatticeFermion > chi(Ncb)
Params for EigCG inverter.
struct Chroma::SysSolverOptEigCGParams::File_t file
Holds return info from SystemSolver call.
Disambiguator for LinOp system solvers.