Belos  Version of the Day
BelosRCGIter.hpp
Go to the documentation of this file.
1 //@HEADER
2 // ************************************************************************
3 //
4 // Belos: Block Linear Solvers Package
5 // Copyright 2004 Sandia Corporation
6 //
7 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8 // the U.S. Government retains certain rights in this software.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ************************************************************************
40 //@HEADER
41 
42 #ifndef BELOS_RCG_ITER_HPP
43 #define BELOS_RCG_ITER_HPP
44 
49 #include "BelosConfigDefs.hpp"
50 #include "BelosTypes.hpp"
51 
52 #include "BelosLinearProblem.hpp"
53 #include "BelosMatOrthoManager.hpp"
54 #include "BelosOutputManager.hpp"
55 #include "BelosStatusTest.hpp"
56 #include "BelosOperatorTraits.hpp"
57 #include "BelosMultiVecTraits.hpp"
58 
59 #include "Teuchos_BLAS.hpp"
60 #include "Teuchos_LAPACK.hpp"
61 #include "Teuchos_SerialDenseMatrix.hpp"
62 #include "Teuchos_SerialDenseVector.hpp"
63 #include "Teuchos_ScalarTraits.hpp"
64 #include "Teuchos_ParameterList.hpp"
65 #include "Teuchos_TimeMonitor.hpp"
66 
67 // MLP Remove after debugging
68 #include <fstream>
69 #include <iomanip>
70 
82 namespace Belos {
83 
85 
86 
91  template <class ScalarType, class MV>
92  struct RCGIterState {
97  int curDim;
98 
100  Teuchos::RCP<MV> P;
101 
103  Teuchos::RCP<MV> Ap;
104 
106  Teuchos::RCP<MV> r;
107 
109  Teuchos::RCP<MV> z;
110 
112  bool existU;
113 
115  Teuchos::RCP<MV> U, AU;
116 
119  Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > Alpha;
120  Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > Beta;
121  Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > D;
122  Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > rTz_old;
123 
125  Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > Delta;
126 
128  Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > LUUTAU;
130  Teuchos::RCP<std::vector<int> > ipiv;
131 
132 
133  RCGIterState() : curDim(0), P(Teuchos::null), Ap(Teuchos::null), r(Teuchos::null),
134  z(Teuchos::null),
135  existU(false),
136  U(Teuchos::null), AU(Teuchos::null),
137  Alpha(Teuchos::null), Beta(Teuchos::null), D(Teuchos::null), rTz_old(Teuchos::null),
138  Delta(Teuchos::null), LUUTAU(Teuchos::null), ipiv(Teuchos::null)
139  {}
140  };
141 
143 
145 
146 
158  class RCGIterInitFailure : public BelosError {public:
159  RCGIterInitFailure(const std::string& what_arg) : BelosError(what_arg)
160  {}};
161 
168  class RCGIterFailure : public BelosError {public:
169  RCGIterFailure(const std::string& what_arg) : BelosError(what_arg)
170  {}};
171 
178  class RCGIterOrthoFailure : public BelosError {public:
179  RCGIterOrthoFailure(const std::string& what_arg) : BelosError(what_arg)
180  {}};
181 
188  class RCGIterLAPACKFailure : public BelosError {public:
189  RCGIterLAPACKFailure(const std::string& what_arg) : BelosError(what_arg)
190  {}};
191 
193 
194 
195  template<class ScalarType, class MV, class OP>
196  class RCGIter : virtual public Iteration<ScalarType,MV,OP> {
197 
198  public:
199 
200  //
201  // Convenience typedefs
202  //
205  typedef Teuchos::ScalarTraits<ScalarType> SCT;
206  typedef typename SCT::magnitudeType MagnitudeType;
207 
209 
210 
218  RCGIter( const Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > &problem,
219  const Teuchos::RCP<OutputManager<ScalarType> > &printer,
220  const Teuchos::RCP<StatusTest<ScalarType,MV,OP> > &tester,
221  Teuchos::ParameterList &params );
222 
224  virtual ~RCGIter() {};
226 
227 
229 
230 
243  void iterate();
244 
259  void initialize(RCGIterState<ScalarType,MV> &newstate);
260 
264  void initialize()
265  {
267  initialize(empty);
268  }
269 
271 
273 
274 
276  int getNumIters() const { return iter_; }
277 
279  void resetNumIters( int iter = 0 ) { iter_ = iter; }
280 
283  Teuchos::RCP<const MV> getNativeResiduals( std::vector<MagnitudeType> *norms ) const { return r_; }
284 
286 
291  Teuchos::RCP<MV> getCurrentUpdate() const { return Teuchos::null; }
292 
294  int getCurSubspaceDim() const {
295  if (!initialized_) return 0;
296  return curDim_;
297  };
298 
300  int getMaxSubspaceDim() const { return numBlocks_+1; }
301 
303 
304 
306 
307 
309  const LinearProblem<ScalarType,MV,OP>& getProblem() const { return *lp_; }
310 
312  int getNumBlocks() const { return numBlocks_; }
313 
315  void setNumBlocks(int numBlocks) { setSize( recycleBlocks_, numBlocks ); };
316 
318  int getRecycledBlocks() const { return recycleBlocks_; }
319 
321  void setRecycledBlocks(int recycleBlocks) { setSize( recycleBlocks, numBlocks_ ); };
322 
324  int getBlockSize() const { return 1; }
325 
327  void setBlockSize(int blockSize) {
328  TEUCHOS_TEST_FOR_EXCEPTION(blockSize!=1,std::invalid_argument,
329  "Belos::RCGIter::setBlockSize(): Cannot use a block size that is not one.");
330  }
331 
333  void setSize( int recycleBlocks, int numBlocks );
334 
336  bool isInitialized() { return initialized_; }
337 
339 
340  private:
341 
342  //
343  // Internal methods
344  //
345 
346  //
347  // Classes input through constructor that define the linear problem to be solved.
348  //
349  const Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > lp_;
350  const Teuchos::RCP<OutputManager<ScalarType> > om_;
351  const Teuchos::RCP<StatusTest<ScalarType,MV,OP> > stest_;
352 
353  //
354  // Algorithmic parameters
355  //
356  // numBlocks_ is the size of the allocated space for the Krylov basis, in blocks.
357  int numBlocks_;
358 
359  // recycleBlocks_ is the size of the allocated space for the recycled subspace, in blocks.
360  int recycleBlocks_;
361 
362  //
363  // Current solver state
364  //
365  // initialized_ specifies that the basis vectors have been initialized and the iterate() routine
366  // is capable of running; _initialize is controlled by the initialize() member method
367  // For the implications of the state of initialized_, please see documentation for initialize()
368  bool initialized_;
369 
370  // Current subspace dimension, and number of iterations performed.
371  int curDim_, iter_;
372 
373  //
374  // State Storage
375  //
376  // Search vectors
377  Teuchos::RCP<MV> P_;
378  //
379  // A times current search vector
380  Teuchos::RCP<MV> Ap_;
381  //
382  // Residual vector
383  Teuchos::RCP<MV> r_;
384  //
385  // Preconditioned residual
386  Teuchos::RCP<MV> z_;
387  //
388  // Flag to indicate that the recycle space should be used
389  bool existU_;
390  // Recycled subspace and its image
391  Teuchos::RCP<MV> U_, AU_;
392  //
393  // Coefficients arising in RCG iteration
394  Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > Alpha_,Beta_,D_;
395  //
396  // Solutions to local least-squares problems
397  Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > Delta_;
398  //
399  // The LU factorization of the matrix U^T A U
400  Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > LUUTAU_;
401  //
402  // Data from LU factorization of UTAU
403  Teuchos::RCP<std::vector<int> > ipiv_;
404  //
405  // The scalar r'*z
406  Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > rTz_old_;
407  };
408 
410  // Constructor.
411  template<class ScalarType, class MV, class OP>
413  const Teuchos::RCP<OutputManager<ScalarType> > &printer,
414  const Teuchos::RCP<StatusTest<ScalarType,MV,OP> > &tester,
415  Teuchos::ParameterList &params ):
416  lp_(problem),
417  om_(printer),
418  stest_(tester),
419  numBlocks_(0),
420  recycleBlocks_(0),
421  initialized_(false),
422  curDim_(0),
423  iter_(0),
424  existU_(false)
425  {
426  // Get the maximum number of blocks allowed for this Krylov subspace
427  TEUCHOS_TEST_FOR_EXCEPTION(!params.isParameter("Num Blocks"), std::invalid_argument,
428  "Belos::RCGIter::constructor: mandatory parameter \"Num Blocks\" is not specified.");
429  int nb = Teuchos::getParameter<int>(params, "Num Blocks");
430 
431  TEUCHOS_TEST_FOR_EXCEPTION(!params.isParameter("Recycled Blocks"), std::invalid_argument,
432  "Belos::RCGIter::constructor: mandatory parameter \"Recycled Blocks\" is not specified.");
433  int rb = Teuchos::getParameter<int>(params, "Recycled Blocks");
434 
435  // Set the number of blocks and allocate data
436  setSize( rb, nb );
437  }
438 
440  // Set the block size and make necessary adjustments.
441  template <class ScalarType, class MV, class OP>
442  void RCGIter<ScalarType,MV,OP>::setSize( int recycleBlocks, int numBlocks )
443  {
444 
445  TEUCHOS_TEST_FOR_EXCEPTION(numBlocks <= 0, std::invalid_argument, "Belos::RCGIter::setSize() was passed a non-positive argument for \"Num Blocks\".");
446  TEUCHOS_TEST_FOR_EXCEPTION(recycleBlocks <= 0, std::invalid_argument, "Belos::RCGIter::setSize() was passed a non-positive argument for \"Recycled Blocks\".");
447  TEUCHOS_TEST_FOR_EXCEPTION(recycleBlocks >= numBlocks, std::invalid_argument, "Belos::RCGIter::setSize() the number of recycled blocks is larger than the allowable subspace.");
448 
449  numBlocks_ = numBlocks;
450  recycleBlocks_ = recycleBlocks;
451 
452  }
453 
455  // Initialize this iteration object
456  template <class ScalarType, class MV, class OP>
458  {
459 
460  if (newstate.P != Teuchos::null &&
461  newstate.Ap != Teuchos::null &&
462  newstate.r != Teuchos::null &&
463  newstate.z != Teuchos::null &&
464  newstate.U != Teuchos::null &&
465  newstate.AU != Teuchos::null &&
466  newstate.Alpha != Teuchos::null &&
467  newstate.Beta != Teuchos::null &&
468  newstate.D != Teuchos::null &&
469  newstate.Delta != Teuchos::null &&
470  newstate.LUUTAU != Teuchos::null &&
471  newstate.ipiv != Teuchos::null &&
472  newstate.rTz_old != Teuchos::null) {
473 
474  curDim_ = newstate.curDim;
475  P_ = newstate.P;
476  Ap_ = newstate.Ap;
477  r_ = newstate.r;
478  z_ = newstate.z;
479  existU_ = newstate.existU;
480  U_ = newstate.U;
481  AU_ = newstate.AU;
482  Alpha_ = newstate.Alpha;
483  Beta_ = newstate.Beta;
484  D_ = newstate.D;
485  Delta_ = newstate.Delta;
486  LUUTAU_ = newstate.LUUTAU;
487  ipiv_ = newstate.ipiv;
488  rTz_old_ = newstate.rTz_old;
489  }
490  else {
491 
492  TEUCHOS_TEST_FOR_EXCEPTION(newstate.P == Teuchos::null,std::invalid_argument,
493  "Belos::RCGIter::initialize(): RCGIterState does not have P initialized.");
494 
495  TEUCHOS_TEST_FOR_EXCEPTION(newstate.Ap == Teuchos::null,std::invalid_argument,
496  "Belos::RCGIter::initialize(): RCGIterState does not have Ap initialized.");
497 
498  TEUCHOS_TEST_FOR_EXCEPTION(newstate.r == Teuchos::null,std::invalid_argument,
499  "Belos::RCGIter::initialize(): RCGIterState does not have r initialized.");
500 
501  TEUCHOS_TEST_FOR_EXCEPTION(newstate.z == Teuchos::null,std::invalid_argument,
502  "Belos::RCGIter::initialize(): RCGIterState does not have z initialized.");
503 
504  TEUCHOS_TEST_FOR_EXCEPTION(newstate.U == Teuchos::null,std::invalid_argument,
505  "Belos::RCGIter::initialize(): RCGIterState does not have U initialized.");
506 
507  TEUCHOS_TEST_FOR_EXCEPTION(newstate.AU == Teuchos::null,std::invalid_argument,
508  "Belos::RCGIter::initialize(): RCGIterState does not have AU initialized.");
509 
510  TEUCHOS_TEST_FOR_EXCEPTION(newstate.Alpha == Teuchos::null,std::invalid_argument,
511  "Belos::RCGIter::initialize(): RCGIterState does not have Alpha initialized.");
512 
513  TEUCHOS_TEST_FOR_EXCEPTION(newstate.Beta == Teuchos::null,std::invalid_argument,
514  "Belos::RCGIter::initialize(): RCGIterState does not have Beta initialized.");
515 
516  TEUCHOS_TEST_FOR_EXCEPTION(newstate.D == Teuchos::null,std::invalid_argument,
517  "Belos::RCGIter::initialize(): RCGIterState does not have D initialized.");
518 
519  TEUCHOS_TEST_FOR_EXCEPTION(newstate.Delta == Teuchos::null,std::invalid_argument,
520  "Belos::RCGIter::initialize(): RCGIterState does not have Delta initialized.");
521 
522  TEUCHOS_TEST_FOR_EXCEPTION(newstate.LUUTAU == Teuchos::null,std::invalid_argument,
523  "Belos::RCGIter::initialize(): RCGIterState does not have LUUTAU initialized.");
524 
525  TEUCHOS_TEST_FOR_EXCEPTION(newstate.ipiv == Teuchos::null,std::invalid_argument,
526  "Belos::RCGIter::initialize(): RCGIterState does not have ipiv initialized.");
527 
528  TEUCHOS_TEST_FOR_EXCEPTION(newstate.rTz_old == Teuchos::null,std::invalid_argument,
529  "Belos::RCGIter::initialize(): RCGIterState does not have rTz_old initialized.");
530 
531  }
532 
533  // the solver is initialized
534  initialized_ = true;
535 
536  }
537 
539  // Iterate until the status test informs us we should stop.
540  template <class ScalarType, class MV, class OP>
542  {
543  TEUCHOS_TEST_FOR_EXCEPTION( initialized_ == false, RCGIterFailure,
544  "Belos::RCGIter::iterate(): RCGIter class not initialized." );
545 
546  // We'll need LAPACK
547  Teuchos::LAPACK<int,ScalarType> lapack;
548 
549  // Create convenience variables for zero and one.
550  ScalarType one = Teuchos::ScalarTraits<ScalarType>::one();
551  ScalarType zero = Teuchos::ScalarTraits<ScalarType>::zero();
552 
553  // Allocate memory for scalars
554  std::vector<int> index(1);
555  Teuchos::SerialDenseMatrix<int,ScalarType> pAp(1,1), rTz(1,1);
556 
557  // Get the current solution std::vector.
558  Teuchos::RCP<MV> cur_soln_vec = lp_->getCurrLHSVec();
559 
560  // Check that the current solution std::vector only has one column.
561  TEUCHOS_TEST_FOR_EXCEPTION( MVT::GetNumberVecs(*cur_soln_vec) != 1, RCGIterFailure,
562  "Belos::RCGIter::iterate(): current linear system has more than one std::vector!" );
563 
564  // Compute the current search dimension.
565  int searchDim = numBlocks_+1;
566 
567  // index of iteration within current cycle
568  int i_ = 0;
569 
571  // iterate until the status test tells us to stop.
572  //
573  // also break if our basis is full
574  //
575  Teuchos::RCP<const MV> p_ = Teuchos::null;
576  Teuchos::RCP<MV> pnext_ = Teuchos::null;
577  while (stest_->checkStatus(this) != Passed && curDim_+1 <= searchDim) {
578 
579  // Ap = A*p;
580  index.resize( 1 );
581  index[0] = i_;
582  p_ = MVT::CloneView( *P_, index );
583  lp_->applyOp( *p_, *Ap_ );
584 
585  // d = p'*Ap;
586  MVT::MvTransMv( one, *p_, *Ap_, pAp );
587  (*D_)(i_,0) = pAp(0,0);
588 
589  // alpha = rTz_old / pAp
590  (*Alpha_)(i_,0) = (*rTz_old_)(0,0) / pAp(0,0);
591 
592  // Check that alpha is a positive number
593  TEUCHOS_TEST_FOR_EXCEPTION( SCT::real(pAp(0,0)) <= zero, RCGIterFailure, "Belos::RCGIter::iterate(): non-positive value for p^H*A*p encountered!" );
594 
595  // x = x + (alpha * p);
596  MVT::MvAddMv( one, *cur_soln_vec, (*Alpha_)(i_,0), *p_, *cur_soln_vec );
597  lp_->updateSolution();
598 
599  // r = r - (alpha * Ap);
600  MVT::MvAddMv( one, *r_, -(*Alpha_)(i_,0), *Ap_, *r_ );
601 
602  std::vector<MagnitudeType> norm(1);
603  MVT::MvNorm( *r_, norm );
604 //printf("i = %i\tnorm(r) = %e\n",i_,norm[0]);
605 
606  // z = M\r
607  if ( lp_->getLeftPrec() != Teuchos::null ) {
608  lp_->applyLeftPrec( *r_, *z_ );
609  }
610  else if ( lp_->getRightPrec() != Teuchos::null ) {
611  lp_->applyRightPrec( *r_, *z_ );
612  }
613  else {
614  z_ = r_;
615  }
616 
617  // rTz_new = r'*z;
618  MVT::MvTransMv( one, *r_, *z_, rTz );
619 
620  // beta = rTz_new/rTz_old;
621  (*Beta_)(i_,0) = rTz(0,0) / (*rTz_old_)(0,0);
622 
623  // rTz_old = rTz_new;
624  (*rTz_old_)(0,0) = rTz(0,0);
625 
626  // get pointer for next p
627  index.resize( 1 );
628  index[0] = i_+1;
629  pnext_ = MVT::CloneViewNonConst( *P_, index );
630 
631  if (existU_) {
632  // mu = UTAU \ (AU'*z);
633  Teuchos::SerialDenseMatrix<int,ScalarType> mu( Teuchos::View, *Delta_, recycleBlocks_, 1, 0, i_ );
634  MVT::MvTransMv( one, *AU_, *z_, mu );
635  char TRANS = 'N';
636  int info;
637  lapack.GETRS( TRANS, recycleBlocks_, 1, LUUTAU_->values(), LUUTAU_->stride(), &(*ipiv_)[0], mu.values(), mu.stride(), &info );
638  TEUCHOS_TEST_FOR_EXCEPTION(info != 0, RCGIterLAPACKFailure,
639  "Belos::RCGIter::solve(): LAPACK GETRS failed to compute a solution.");
640  // p = -(U*mu) + (beta*p) + z (in two steps)
641  // p = (beta*p) + z;
642  MVT::MvAddMv( (*Beta_)(i_,0), *p_, one, *z_, *pnext_ );
643  // pnext = -(U*mu) + (one)*pnext;
644  MVT::MvTimesMatAddMv( -one, *U_, mu, one, *pnext_ );
645  }
646  else {
647  // p = (beta*p) + z;
648  MVT::MvAddMv( (*Beta_)(i_,0), *p_, one, *z_, *pnext_ );
649  }
650 
651  // Done with this view; release pointer
652  p_ = Teuchos::null;
653  pnext_ = Teuchos::null;
654 
655  // increment iteration count and dimension index
656  i_++;
657  iter_++;
658  curDim_++;
659 
660  } // end while (statusTest == false)
661 
662  }
663 
664 } // end Belos namespace
665 
666 #endif /* BELOS_RCG_ITER_HPP */
Belos::RCGIterState::existU
bool existU
Flag to indicate the recycle space should be used.
Definition: BelosRCGIter.hpp:112
Belos::RCGIterState::z
Teuchos::RCP< MV > z
The current preconditioned residual.
Definition: BelosRCGIter.hpp:109
Belos::RCGIterInitFailure::RCGIterInitFailure
RCGIterInitFailure(const std::string &what_arg)
Definition: BelosRCGIter.hpp:159
Belos::RCGIter::getCurrentUpdate
Teuchos::RCP< MV > getCurrentUpdate() const
Get the current update to the linear system.
Definition: BelosRCGIter.hpp:291
BelosConfigDefs.hpp
Belos header file which uses auto-configuration information to include necessary C++ headers.
Belos::RCGIter::initialize
void initialize()
Initialize the solver with the initial vectors from the linear problem or random data.
Definition: BelosRCGIter.hpp:264
Belos::RCGIter::~RCGIter
virtual ~RCGIter()
Destructor.
Definition: BelosRCGIter.hpp:224
Belos::OperatorTraits
Class which defines basic traits for the operator type.
Definition: BelosOperatorTraits.hpp:109
Belos::OutputManager
Belos's basic output manager for sending information of select verbosity levels to the appropriate ou...
Definition: BelosIteration.hpp:64
BelosLinearProblem.hpp
Class which describes the linear problem to be solved by the iterative solver.
Belos::RCGIter::setSize
void setSize(int recycleBlocks, int numBlocks)
Set the maximum number of blocks used by the iterative solver and the number of recycled vectors.
Definition: BelosRCGIter.hpp:442
BelosStatusTest.hpp
Pure virtual base class for defining the status testing capabilities of Belos.
Belos::RCGIter::SCT
Teuchos::ScalarTraits< ScalarType > SCT
Definition: BelosRCGIter.hpp:205
Belos::TRANS
Definition: BelosTypes.hpp:82
Belos::Iteration
Definition: BelosIteration.hpp:73
Belos::RCGIter::resetNumIters
void resetNumIters(int iter=0)
Reset the iteration count.
Definition: BelosRCGIter.hpp:279
Belos::RCGIter::getNativeResiduals
Teuchos::RCP< const MV > getNativeResiduals(std::vector< MagnitudeType > *norms) const
Get the norms of the residuals native to the solver.
Definition: BelosRCGIter.hpp:283
Belos::RCGIterState::Alpha
Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > Alpha
Coefficients arising in RCG iteration.
Definition: BelosRCGIter.hpp:119
Belos::RCGIterLAPACKFailure::RCGIterLAPACKFailure
RCGIterLAPACKFailure(const std::string &what_arg)
Definition: BelosRCGIter.hpp:189
Belos::RCGIter::RCGIter
RCGIter(const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &problem, const Teuchos::RCP< OutputManager< ScalarType > > &printer, const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &tester, Teuchos::ParameterList &params)
RCGIter constructor with linear problem, solver utilities, and parameter list of solver options.
Definition: BelosRCGIter.hpp:412
Belos::RCGIterState::Delta
Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > Delta
Solutions to local least-squares problems.
Definition: BelosRCGIter.hpp:125
Belos::RCGIterState::D
Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > D
Definition: BelosRCGIter.hpp:121
Belos::Passed
Definition: BelosTypes.hpp:188
Belos::RCGIter::MagnitudeType
SCT::magnitudeType MagnitudeType
Definition: BelosRCGIter.hpp:206
Belos::LinearProblem
A linear system to solve, and its associated information.
Definition: BelosIteration.hpp:61
Belos::RCGIterState::curDim
int curDim
The current dimension of the reduction.
Definition: BelosRCGIter.hpp:97
Belos::RCGIter::getRecycledBlocks
int getRecycledBlocks() const
Get the maximum number of recycled blocks used by the iterative solver in solving this linear problem...
Definition: BelosRCGIter.hpp:318
Belos::RCGIter::getNumBlocks
int getNumBlocks() const
Get the maximum number of blocks used by the iterative solver in solving this linear problem.
Definition: BelosRCGIter.hpp:312
Belos::RCGIterLAPACKFailure
RCGIterLAPACKFailure is thrown when a nonzero return value is passed back from an LAPACK routine.
Definition: BelosRCGIter.hpp:188
BelosOutputManager.hpp
Class which manages the output and verbosity of the Belos solvers.
Belos
Definition: Belos_Details_EBelosSolverType.cpp:45
Belos::RCGIter::getBlockSize
int getBlockSize() const
Get the blocksize to be used by the iterative solver in solving this linear problem.
Definition: BelosRCGIter.hpp:324
Belos::RCGIter::getCurSubspaceDim
int getCurSubspaceDim() const
Get the dimension of the search subspace used to generate the current solution to the linear problem.
Definition: BelosRCGIter.hpp:294
Belos::RCGIter::setRecycledBlocks
void setRecycledBlocks(int recycleBlocks)
Set the maximum number of recycled blocks used by the iterative solver.
Definition: BelosRCGIter.hpp:321
Belos::RCGIter::setNumBlocks
void setNumBlocks(int numBlocks)
Set the maximum number of blocks used by the iterative solver.
Definition: BelosRCGIter.hpp:315
Belos::RCGIterState::rTz_old
Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > rTz_old
Definition: BelosRCGIter.hpp:122
Belos::RCGIterFailure
RCGIterFailure is thrown when the RCGIter object is unable to compute the next iterate in the RCGIter...
Definition: BelosRCGIter.hpp:168
Belos::RCGIterState::ipiv
Teuchos::RCP< std::vector< int > > ipiv
Data from LU factorization of U^T A U.
Definition: BelosRCGIter.hpp:130
Belos::RCGIter::setBlockSize
void setBlockSize(int blockSize)
Set the blocksize.
Definition: BelosRCGIter.hpp:327
Belos::RCGIter::isInitialized
bool isInitialized()
States whether the solver has been initialized or not.
Definition: BelosRCGIter.hpp:336
Belos::RCGIter::iterate
void iterate()
This method performs RCG iterations until the status test indicates the need to stop or an error occu...
Definition: BelosRCGIter.hpp:541
BelosOperatorTraits.hpp
Class which defines basic traits for the operator type.
Belos::RCGIter::MVT
MultiVecTraits< ScalarType, MV > MVT
Definition: BelosRCGIter.hpp:203
Belos::RCGIterFailure::RCGIterFailure
RCGIterFailure(const std::string &what_arg)
Definition: BelosRCGIter.hpp:169
BelosMatOrthoManager.hpp
Templated virtual class for providing orthogonalization/orthonormalization methods with matrix-based ...
Belos::RCGIterState::P
Teuchos::RCP< MV > P
The current Krylov basis.
Definition: BelosRCGIter.hpp:100
Belos::RCGIter
This class implements the RCG iteration, where a single-std::vector Krylov subspace is constructed.
Definition: BelosRCGIter.hpp:196
Belos::RCGIter::getNumIters
int getNumIters() const
Get the current iteration count.
Definition: BelosRCGIter.hpp:276
Belos::RCGIterState::r
Teuchos::RCP< MV > r
The current residual.
Definition: BelosRCGIter.hpp:106
Belos::RCGIter::OPT
OperatorTraits< ScalarType, MV, OP > OPT
Definition: BelosRCGIter.hpp:204
Belos::StatusTest
A pure virtual class for defining the status tests for the Belos iterative solvers.
Definition: BelosIteration.hpp:67
Belos::RCGIterState::AU
Teuchos::RCP< MV > AU
Definition: BelosRCGIter.hpp:115
Belos::RCGIterOrthoFailure::RCGIterOrthoFailure
RCGIterOrthoFailure(const std::string &what_arg)
Definition: BelosRCGIter.hpp:179
Belos::BelosError
Parent class to all Belos exceptions.
Definition: BelosTypes.hpp:60
BelosMultiVecTraits.hpp
Declaration of basic traits for the multivector type.
Belos::RCGIterState::U
Teuchos::RCP< MV > U
The recycled subspace and its image.
Definition: BelosRCGIter.hpp:115
Belos::RCGIterState::LUUTAU
Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > LUUTAU
The LU factorization of the matrix U^T A U
Definition: BelosRCGIter.hpp:128
Belos::RCGIterInitFailure
RCGIterInitFailure is thrown when the RCGIter object is unable to generate an initial iterate in the ...
Definition: BelosRCGIter.hpp:158
BelosTypes.hpp
Collection of types and exceptions used within the Belos solvers.
Belos::RCGIterState::Ap
Teuchos::RCP< MV > Ap
A times current search vector.
Definition: BelosRCGIter.hpp:103
Belos::RCGIter::getProblem
const LinearProblem< ScalarType, MV, OP > & getProblem() const
Get a constant reference to the linear problem.
Definition: BelosRCGIter.hpp:309
Belos::RCGIterState::Beta
Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > Beta
Definition: BelosRCGIter.hpp:120
Belos::RCGIterState::RCGIterState
RCGIterState()
Definition: BelosRCGIter.hpp:133
Belos::RCGIterOrthoFailure
RCGIterOrthoFailure is thrown when the RCGIter object is unable to compute independent direction vect...
Definition: BelosRCGIter.hpp:178
Belos::RCGIter::getMaxSubspaceDim
int getMaxSubspaceDim() const
Get the maximum dimension allocated for the search subspace.
Definition: BelosRCGIter.hpp:300
Belos::MultiVecTraits
Traits class which defines basic operations on multivectors.
Definition: BelosMultiVecTraits.hpp:129
Belos::RCGIterState
Structure to contain pointers to RCGIter state variables.
Definition: BelosRCGIter.hpp:92

Generated on Thu Feb 27 2020 16:06:46 for Belos by doxygen 1.8.16