From ebf079f739c58ae2385b01de4d16a91ef4d16ac9 Mon Sep 17 00:00:00 2001 From: jiri Date: Wed, 27 Sep 2017 21:13:48 +0000 Subject: [PATCH] *** empty log message *** --- diis.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/diis.h b/diis.h index 98f996c..1b25d8c 100644 --- a/diis.h +++ b/diis.h @@ -54,7 +54,7 @@ public: DIIS(const int n, const bool core=1); void setup(const int n, const bool core=1); ~DIIS(); - typename LA_traits::normtype extrapolate(T &vec, const U &errvec, bool verbose=false, const Un diiseps=0); //vec is input/output; returns square residual norm + typename LA_traits::normtype extrapolate(T &vec, U &errvec, bool verbose=false, const Un diiseps=0, bool errvecout=false); //vec is input/output, errvec optionally too; returns square residual norm }; template @@ -94,7 +94,7 @@ if(errstor) delete[] errstor; template -typename LA_traits::normtype DIIS::extrapolate(T &vec, const U &errvec, bool verbose, const Un diiseps) +typename LA_traits::normtype DIIS::extrapolate(T &vec, U &errvec, bool verbose, const Un diiseps, bool errvecout) { if(!dim) laerror("attempt to extrapolate from uninitialized DIIS"); //if dim exceeded, shift @@ -156,16 +156,26 @@ if(verbose) std::cout <<"DIIS coefficients: "<get(tmp,(i-1+cyclicshift)%dim); vec.axpy(rhs[i],tmp); + if(errvecout) + { + errst->get(errtmp,(i-1+cyclicshift)%dim); + errvec.axpy(rhs[i],errtmp); + } } }