8 #ifndef __mre_extrap_predictor_h__
9 #define __mre_extrap_predictor_h__
23 namespace MinimalResidualExtrapolation4DChronoPredictorEnv
53 int Nvec = chrono_buf.
size();
57 multi2d<DComplex>
G(Nvec,Nvec);
59 for(
int m = 0 ;
m < Nvec;
m++) {
60 for(
int n = 0;
n < Nvec;
n++) {
66 multi1d<DComplex>
b(Nvec);
68 for(
int n = 0;
n < Nvec;
n++) {
75 multi1d<DComplex>
a(Nvec);
80 multi1d<DComplex> Ga(Nvec);
82 for(
int i=0;
i < Nvec;
i++) {
84 for(
int j=1;
j < Nvec;
j++) {
89 multi1d<DComplex>
r(Nvec);
90 for(
int i=0;
i < Nvec;
i++) {
95 psi[
s] = Complex(
a[0])*chrono_buf[0];
96 for(
int n=1;
n < Nvec;
n++) {
97 psi[
s] += Complex(
a[
n])*chrono_buf[
n];
128 QDPIO::cout <<
"MRE Predictor: before prediction || r || / || b || =" << norm_r/norm_chi << std::endl;
132 int Nvec = chrono_buf->size();
140 for(
int i=0;
i < Nvec;
i++) {
146 chrono_buf->get(
i, tmpvec);
171 multi2d<DComplex>
G(Nvec,Nvec);
173 for(
int m = 0 ;
m < Nvec;
m++) {
177 for(
int n = 0;
n < Nvec;
n++) {
183 multi1d<DComplex>
b(Nvec);
185 for(
int n = 0;
n < Nvec;
n++) {
192 multi1d<DComplex>
a(Nvec);
197 multi1d<DComplex> Ga(Nvec);
199 for(
int i=0;
i < Nvec;
i++) {
201 for(
int j=1;
j < Nvec;
j++) {
206 multi1d<DComplex>
r(Nvec);
207 for(
int i=0;
i < Nvec;
i++) {
212 QDPIO::cout <<
"Constraint Eq Solution Check" << std::endl;
213 for(
int i=0;
i < Nvec;
i++) {
214 QDPIO::cout <<
" r[ " <<
i <<
"] = " <<
r[
i] << std::endl;
219 psi[
s] = Complex(
a[0])*v[0];
220 for(
int n=1;
n < Nvec;
n++) {
234 QDPIO::cout <<
"MRE Predictor: after prediction || r || / || b || =" << norm_r/norm_chi << std::endl;
275 QDPIO::cout <<
"MRE Predictor: Zero vectors stored. Giving you zero guess" << std::endl;
281 QDPIO::cout <<
"MRE Predictor: Only 1 std::vector stored. Giving you last solution " << std::endl;
287 QDPIO::cout <<
"MRE Predictor: Finding X extrapolation with "<< Nvec <<
" vectors" << std::endl;
297 QDPIO::cout <<
"MRE_PREDICT_X_TIME = " << swatch.getTimeInSeconds() <<
" s" << std::endl;
313 QDPIO::cout <<
"MRE Predictor: Zero vectors stored. Giving you zero guess" << std::endl;
319 QDPIO::cout <<
"MRE Predictor: Only 1 std::vector stored. Giving you last solution " << std::endl;
325 QDPIO::cout <<
"MRE Predictor: Finding Y extrapolation with "<< Nvec <<
" vectors" << std::endl;
335 QDPIO::cout <<
"MRE_PREDICT_Y_TIME = " << swatch.getTimeInSeconds() <<
" s" << std::endl;
353 QDPIO::cout <<
"MRE Predictor: Zero vectors stored. Giving you zero guess" << std::endl;
359 QDPIO::cout <<
"MRE Predictor: Only 1 std::vector stored. Giving you last solution " << std::endl;
365 QDPIO::cout <<
"MRE Predictor: Finding X extrapolation with "<< Nvec <<
" vectors" << std::endl;
375 QDPIO::cout <<
"MRE_PREDICT_X_TIME = " << swatch.getTimeInSeconds() <<
" s" << std::endl;
393 QDPIO::cout <<
"MRE Predictor: Zero vectors stored. Giving you zero guess" << std::endl;
399 QDPIO::cout <<
"MRE Predictor: Only 1 std::vector stored. Giving you last solution " << std::endl;
405 QDPIO::cout <<
"MRE Predictor: Finding Y extrapolation with "<< Nvec <<
" vectors" << std::endl;
415 QDPIO::cout <<
"MRE_PREDICT_Y_TIME = " << swatch.getTimeInSeconds() <<
" s" << std::endl;
422 for(
int i=0;
i < buffer.
size(); ++
i) {
423 for(
int j=0;
j < buffer.
size(); ++
j ) {
426 if( toBool( fabs(
Double(1)-real(ip)) >
Double(1.0e-12) ) ) {
427 QDPIO::cout <<
"Lack of normalization: < v["<<
i<<
"] | v[" <<
j <<
"] > = " << ip << std::endl;
430 if( toBool( fabs(imag(ip)) >
Double(1.0e-12) ) ) {
431 QDPIO::cout <<
"Lack of normalization: < v["<<
i<<
"] | v[" <<
j <<
"] > = " << ip << std::endl;
437 if( toBool( fabs(real(ip)) >
Double(1.0e-12) ) ) {
438 QDPIO::cout <<
"Lack of orthogonality: < v["<<
i<<
"] | v[" <<
j <<
"] > = " << ip << std::endl;
441 if( toBool( fabs(imag(ip)) >
Double(1.0e-12) ) ) {
442 QDPIO::cout <<
"Lack of orthogonality: < v["<<
i<<
"] | v[" <<
j <<
"] > = " << ip << std::endl;
466 for(
int i=0;
i < buffer.
size(); ++
i) {
468 x[
s] -= iprod*buffer[
i];
472 for(
int i=0;
i < buffer.
size(); ++
i) {
474 x[
s] -= iprod*buffer[
i];
490 QDPIO::cout <<
"MREPredictor: registering new X solution. " << std::endl;
507 QDPIO::cout <<
"MREPredictor: number of X vectors stored is = " <<
chrono_bufX->size() <<
" and MX vectors = " <<
chrono_bufMX->size() << std::endl;
509 QDPIO::cout <<
"MRE Predictor: X_VEC_REGISTRATION_TIME = " << swatch.getTimeInSeconds() <<
" sec. \n";
521 QDPIO::cout <<
"MREPredictor: registering new X solution. " << std::endl;
526 QDPIO::cout <<
"MREPredictor: number of X vectors stored is = " <<
chrono_bufX->size() << std::endl;
536 QDPIO::cout <<
"MREPredictor: registering new Y solution. " << std::endl;
538 QDPIO::cout <<
"MREPredictor: number of Y vectors stored is = " <<
chrono_bufY->size() << std::endl;
550 QDPIO::cout <<
"MREPredictor: registering new Y solution. " << std::endl;
566 QDPIO::cout <<
"MREPredictor: number of Y vectors stored is = " <<
chrono_bufY->size() <<
" and MY vectors = " <<
chrono_bufMY->size() << std::endl;
568 QDPIO::cout <<
"MRE Predictor: Y_VEC_REGISTRATION_TIME = " << swatch.getTimeInSeconds() <<
" sec. \n";
591 namespace MinimalResidualExtrapolation5DChronoPredictorEnv
609 const multi1d<LatticeFermion>&
chi);
623 const multi1d<LatticeFermion>&
chi);
637 QDPIO::cout <<
"MRE Predictor: registering new solution. " << std::endl;
639 QDPIO::cout <<
"MRE Predictor: number of vectors stored is = " <<
chrono_buf->size() << std::endl;
Primary include file for CHROMA library code.
Chronological predictor for HMC.
Abstract interface for a Chronological Solution predictor in 5D.
Abstract interface for a Chronological Solution predictor.
Circular buffer of arrays.
int size(void) const
Get the current number of items stored.
Class for counted reference semantics.
Linear Operator to arrays.
virtual const Subset & subset() const =0
Return the subset on which the operator acts.
Gramm-Schmidt orthogonolization.
void GramSchm(multi1d< LatticeFermion > &psi, const int Npsi, const multi1d< LatticeFermion > &vec, const int Nvec, const Subset &sub)
Gramm-Schmidt orthogonolization.
void LUSolve(multi1d< DComplex > &a, const multi2d< DComplex > &M, const multi1d< DComplex > &b)
Solve M a = b by LU decomposition with partial pivoting.
Class for counted reference semantics.
BinaryReturn< C1, C2, FnInnerProduct >::Type_t innerProduct(const QDPSubType< T1, C1 > &s1, const QDPType< T2, C2 > &s2)
multi1d< LatticeColorMatrix > G
Asqtad Staggered-Dirac operator.
LinOpSysSolverMGProtoClover::T T
multi1d< LatticeFermion > chi(Ncb)
multi1d< LatticeFermion > s(Ncb)
FloatingPoint< double > Double