Belos Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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"
63 #include "Teuchos_ScalarTraits.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 
101 
104 
107 
110 
112  bool existU;
113 
116 
123 
126 
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  //
207 
209 
210 
219  const Teuchos::RCP<OutputManager<ScalarType> > &printer,
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 
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  //
352 
353  //
354  // Algorithmic parameters
355  //
356  // numBlocks_ is the size of the allocated space for the Krylov basis, in blocks.
358 
359  // recycleBlocks_ is the size of the allocated space for the recycled subspace, in blocks.
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()
369 
370  // Current subspace dimension, and number of iterations performed.
372 
373  //
374  // State Storage
375  //
376  // Search vectors
378  //
379  // A times current search vector
381  //
382  // Residual vector
384  //
385  // Preconditioned residual
387  //
388  // Flag to indicate that the recycle space should be used
389  bool existU_;
390  // Recycled subspace and its image
392  //
393  // Coefficients arising in RCG iteration
395  //
396  // Solutions to local least-squares problems
398  //
399  // The LU factorization of the matrix U^T A U
401  //
402  // Data from LU factorization of UTAU
404  //
405  // The scalar r'*z
407  };
408 
410  // Constructor.
411  template<class ScalarType, class MV, class OP>
413  const Teuchos::RCP<OutputManager<ScalarType> > &printer,
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
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);
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  //
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 );
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 */
const Teuchos::RCP< OutputManager< ScalarType > > om_
ScalarType * values() const
Teuchos::RCP< MV > r
The current residual.
Collection of types and exceptions used within the Belos solvers.
Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > rTz_old
Belos&#39;s basic output manager for sending information of select verbosity levels to the appropriate ou...
Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > Alpha_
Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > rTz_old_
Teuchos::RCP< MV > P
The current Krylov basis.
Teuchos::RCP< std::vector< int > > ipiv
Data from LU factorization of U^T A U.
Class which manages the output and verbosity of the Belos solvers.
void setNumBlocks(int numBlocks)
Set the maximum number of blocks used by the iterative solver.
Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > Beta_
RCGIterOrthoFailure(const std::string &what_arg)
Teuchos::RCP< MV > AU
int getNumBlocks() const
Get the maximum number of blocks used by the iterative solver in solving this linear problem...
RCGIterFailure is thrown when the RCGIter object is unable to compute the next iterate in the RCGIter...
RCGIterOrthoFailure is thrown when the RCGIter object is unable to compute independent direction vect...
Teuchos::RCP< MV > getCurrentUpdate() const
Get the current update to the linear system.
Pure virtual base class for defining the status testing capabilities of Belos.
Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > D_
Teuchos::RCP< MV > U
The recycled subspace and its image.
Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > LUUTAU
The LU factorization of the matrix U^T A U.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > Beta
Declaration of basic traits for the multivector type.
This class implements the RCG iteration, where a single-std::vector Krylov subspace is constructed...
int getRecycledBlocks() const
Get the maximum number of recycled blocks used by the iterative solver in solving this linear problem...
const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > lp_
int getMaxSubspaceDim() const
Get the maximum dimension allocated for the search subspace.
const LinearProblem< ScalarType, MV, OP > & getProblem() const
Get a constant reference to the linear problem.
OperatorTraits< ScalarType, MV, OP > OPT
int getNumIters() const
Get the current iteration count.
A pure virtual class for defining the status tests for the Belos iterative solvers.
Class which defines basic traits for the operator type.
MultiVecTraits< ScalarType, MV > MVT
virtual ~RCGIter()
Destructor.
RCGIterLAPACKFailure(const std::string &what_arg)
Traits class which defines basic operations on multivectors.
void setSize(int recycleBlocks, int numBlocks)
Set the maximum number of blocks used by the iterative solver and the number of recycled vectors...
bool isParameter(const std::string &name) const
const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > stest_
Structure to contain pointers to RCGIter state variables.
bool existU
Flag to indicate the recycle space should be used.
Teuchos::RCP< MV > z
The current preconditioned residual.
Teuchos::RCP< MV > Ap
A times current search vector.
RCGIterInitFailure(const std::string &what_arg)
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...
int getBlockSize() const
Get the blocksize to be used by the iterative solver in solving this linear problem.
Teuchos::RCP< MV > U_
A linear system to solve, and its associated information.
Class which describes the linear problem to be solved by the iterative solver.
RCGIterFailure(const std::string &what_arg)
Teuchos::RCP< MV > P_
Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > Alpha
Coefficients arising in RCG iteration.
TransListIter iter
Teuchos::RCP< MV > Ap_
RCGIterInitFailure is thrown when the RCGIter object is unable to generate an initial iterate in the ...
Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > LUUTAU_
Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > Delta_
int getCurSubspaceDim() const
Get the dimension of the search subspace used to generate the current solution to the linear problem...
void GETRS(const char &TRANS, const OrdinalType &n, const OrdinalType &nrhs, const ScalarType *A, const OrdinalType &lda, const OrdinalType *IPIV, ScalarType *B, const OrdinalType &ldb, OrdinalType *info) const
int curDim
The current dimension of the reduction.
void setRecycledBlocks(int recycleBlocks)
Set the maximum number of recycled blocks used by the iterative solver.
void initialize()
Initialize the solver with the initial vectors from the linear problem or random data.
Teuchos::RCP< MV > AU_
Class which defines basic traits for the operator type.
Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > D
void iterate()
This method performs RCG iterations until the status test indicates the need to stop or an error occu...
Parent class to all Belos exceptions.
Definition: BelosTypes.hpp:60
void resetNumIters(int iter=0)
Reset the iteration count.
Teuchos::RCP< std::vector< int > > ipiv_
RCGIterLAPACKFailure is thrown when a nonzero return value is passed back from an LAPACK routine...
void setBlockSize(int blockSize)
Set the blocksize.
Teuchos::RCP< const MV > getNativeResiduals(std::vector< MagnitudeType > *) const
Get the norms of the residuals native to the solver.
Belos header file which uses auto-configuration information to include necessary C++ headers...
Teuchos::ScalarTraits< ScalarType > SCT
Teuchos::RCP< MV > r_
bool isInitialized()
States whether the solver has been initialized or not.
Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > Delta
Solutions to local least-squares problems.
OrdinalType stride() const
Teuchos::RCP< MV > z_
Templated virtual class for providing orthogonalization/orthonormalization methods with matrix-based ...
SCT::magnitudeType MagnitudeType