6 #ifndef __syssolver_OPTeigbicg_h__
7 #define __syssolver_OPTeigbicg_h__
26 namespace LinOpSysSolverOptEigBiCGEnv
54 XMLBufferWriter file_xml;
55 push(file_xml,
"OptEigBiInfo");
58 write(file_xml,
"ncurEvals",
obj.ncurEvals);
59 write(file_xml,
"restartTol",
obj.restartTol);
61 write(file_xml,
"ldh",
obj.evals.size());
65 QDPFileWriter to(file_xml,
68 QDPIO_SERIAL,QDPIO_OPEN);
70 for(
int v(0);v<
obj.ncurEvals;v++){
74 XMLBufferWriter record_xml;
75 push(record_xml,
"LeftEigenVector");
76 write(record_xml,
"no",v);
78 write(to, record_xml, lf);
82 XMLBufferWriter record_xml;
83 push(record_xml,
"RightEigenVector");
84 write(record_xml,
"no",v);
86 write(to, record_xml, lf);
91 XMLBufferWriter record_xml;
92 push(record_xml,
"EigenValues");
96 multi1d<Complex> foo(
obj.evals.size()) ;
97 for(
int i(0);
i<
obj.evals.size();
i++)
98 foo[
i].elem().elem().elem() =
obj.evals[
i] ;
99 write(to, record_xml, foo);
102 XMLBufferWriter record_xml;
103 push(record_xml,
"H");
106 multi1d<Complex> foo(
obj.H.size()) ;
107 for(
int i(0);
i<
obj.H.size();
i++)
108 foo[
i].elem().elem().elem() =
obj.H[
i] ;
109 write(to, record_xml, foo);
115 QDPIO::cout<<
" QIOWriteOptEvecs: Time to write evecs= "
116 << swatch.getTimeInSeconds() <<
" secs "<<std::endl ;
138 XMLReader record_xml;
143 read(file_xml,
"/OptEigBiInfo/ldh", ldh);
144 read(file_xml,
"/OptEigBiInfo/lde", lde);
145 read(file_xml,
"/OptEigBiInfo/N", N);
146 read(file_xml,
"/OptEigBiInfo/ncurEvals",
obj.ncurEvals);
147 read(file_xml,
"/OptEigBiInfo/restartTol", restartTol);
149 QDPIO::cout <<__func__ <<
" : Reading object with following properties"<<std::endl ;
150 QDPIO::cout <<__func__ <<
" : lde= " << lde << std::endl;
151 QDPIO::cout <<__func__ <<
" : ldh= " << ldh << std::endl;
152 QDPIO::cout <<__func__ <<
" : N = " << N << std::endl;
154 QDPIO::cout << __func__ <<
" : ncurEvals = " <<
obj.ncurEvals<< std::endl;
155 QDPIO::cout << __func__ <<
" : restartTol = " << restartTol<< std::endl;
157 if(
obj.evals.size()<
obj.ncurEvals){
158 QDPIO::cerr<<__func__<<
" : ldh of the current object is not large enough to hold the vectors" ;
162 for(
int v(0);v<
obj.ncurEvals;v++){
164 XMLReader record_xml;
165 read(to, record_xml, lf);
167 read(to, record_xml, lf);
172 XMLReader record_xml;
173 multi1d<Complex> evals(ldh) ;
174 multi1d<Complex> H(ldh*ldh) ;
175 read(to, record_xml, evals);
176 read(to, record_xml, H);
177 if(ldh<=
obj.evals.size()){
178 for(
int i(0);
i<ldh;
i++){
179 obj.evals[
i] = evals[
i].elem().elem().elem() ;
181 for(
int i(0);
i<H.size();
i++){
182 obj.H[
i] = H[
i].elem().elem().elem() ;
186 QDPIO::cerr<<__func__<<
" : ldh of the current object is not large enough to hold the Cholesky factors" ;
195 QDPIO::cout<<
" QIOReadOptEvecs: Time to read evecs= "
196 << swatch.getTimeInSeconds() <<
" secs "<<std::endl ;
215 int N = Layout::sitesOnNode()*Nc*Ns ;
216 int VectorSpaceSize = Nc*Ns*(
A->subset()).numSiteTable();
220 QDPIO::cout<<
"LinOpSysSolverOptEigBiCG : reading evecs from disk"<<std::endl ;
230 QDPIO::cout<<
"LinOpSysSolverOptEigBiCG : writing evecs to disk"<<std::endl ;
240 const Subset&
subset()
const {
return A->subset();}
Class for counted reference semantics.
void init(int ldh, int lde_)
Solve a M*psi=chi linear system by biCG with eigenvectors.
SysSolverOptEigBiCGParams invParam
void QIOWriteOptEvecs()
Write out an OptEigInfo Type
LinOpSysSolverOptEigBiCG(Handle< LinearOperator< T > > A_, const SysSolverOptEigBiCGParams &invParam_)
Constructor.
const Subset & subset() const
Return the subset on which the operator acts.
~LinOpSysSolverOptEigBiCG()
Destructor is automatic.
Handle< LinearOperator< T > > A
SystemSolverResults_t operator()(T &psi, const T &chi) const
Solver the linear system.
void QIOReadOptEvecs()
Read a OptEigInfo Type
LinOpSysSolverOptEigBiCG()
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
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 EigBiCG inverter.
struct Chroma::SysSolverOptEigBiCGParams::File_t file
Holds return info from SystemSolver call.
Disambiguator for LinOp system solvers.