From 6c66b8d99780dbe2b75aa226dcfa8f5ac34e9e75 Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Thu, 30 Sep 2021 19:25:12 +0100 Subject: [PATCH] deflated guesser can optionally be used with less vectors than provided --- Grid/algorithms/iterative/Deflation.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Grid/algorithms/iterative/Deflation.h b/Grid/algorithms/iterative/Deflation.h index 626b60e3..43fe3e35 100644 --- a/Grid/algorithms/iterative/Deflation.h +++ b/Grid/algorithms/iterative/Deflation.h @@ -54,15 +54,23 @@ class DeflatedGuesser: public LinearFunction { private: const std::vector &evec; const std::vector &eval; + const unsigned int N; public: - DeflatedGuesser(const std::vector & _evec,const std::vector & _eval) : evec(_evec), eval(_eval) {}; + DeflatedGuesser(const std::vector & _evec,const std::vector & _eval) + : DeflatedGuesser(_evec, _eval, _evec.size()) + {} + + DeflatedGuesser(const std::vector & _evec, const std::vector & _eval, const unsigned int _N) + : evec(_evec), eval(_eval), N(_N) + { + assert(evec.size()==eval.size()); + assert(N <= evec.size()); + } virtual void operator()(const Field &src,Field &guess) { guess = Zero(); - assert(evec.size()==eval.size()); - auto N = evec.size(); for (int i=0;i