Belos  Version of the Day
BelosBlockCGIter.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_BLOCK_CG_ITER_HPP
43 #define BELOS_BLOCK_CG_ITER_HPP
44 
49 #include "BelosConfigDefs.hpp"
50 #include "BelosTypes.hpp"
51 #include "BelosCGIteration.hpp"
52 
53 #include "BelosLinearProblem.hpp"
54 #include "BelosMatOrthoManager.hpp"
55 #include "BelosOutputManager.hpp"
56 #include "BelosStatusTest.hpp"
57 #include "BelosOperatorTraits.hpp"
58 #include "BelosMultiVecTraits.hpp"
59 
60 #include "Teuchos_BLAS.hpp"
61 #include "Teuchos_LAPACK.hpp"
62 #include "Teuchos_SerialDenseMatrix.hpp"
63 #include "Teuchos_SerialDenseVector.hpp"
64 #include "Teuchos_SerialSymDenseMatrix.hpp"
65 #include "Teuchos_SerialSpdDenseSolver.hpp"
66 #include "Teuchos_ScalarTraits.hpp"
67 #include "Teuchos_ParameterList.hpp"
68 #include "Teuchos_TimeMonitor.hpp"
69 
70 namespace Belos {
71 
77 
80 template<class ScalarType, class MV, class OP,
81  const bool lapackSupportsScalarType =
83 class BlockCGIter : virtual public CGIteration<ScalarType, MV, OP> {
84 public:
87  typedef Teuchos::ScalarTraits<ScalarType> SCT;
88  typedef typename SCT::magnitudeType MagnitudeType;
89 
90  BlockCGIter( const Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > & /* problem */,
91  const Teuchos::RCP<OutputManager<ScalarType> > & /* printer */,
92  const Teuchos::RCP<StatusTest<ScalarType,MV,OP> > & /* tester */,
93  const Teuchos::RCP<MatOrthoManager<ScalarType,MV,OP> > & /* ortho */,
94  Teuchos::ParameterList & /* params */ )
95  {
96  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Stub");
97  }
98 
99  virtual ~BlockCGIter() {}
100 
101  void iterate () {
102  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Stub");
103  }
104 
106  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Stub");
107  }
108 
109  void initialize () {
110  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Stub");
111  }
112 
114  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Stub");
115  }
116 
117  int getNumIters() const {
118  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Stub");
119  }
120 
121  void resetNumIters( int iter=0 ) {
122  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Stub");
123  }
124 
125  Teuchos::RCP<const MV>
126  getNativeResiduals (std::vector<MagnitudeType>* /* norms */) const {
127  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Stub");
128  }
129 
130  Teuchos::RCP<MV> getCurrentUpdate() const {
131  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Stub");
132  }
133 
135  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Stub");
136  }
137 
138  int getBlockSize() const {
139  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Stub");
140  }
141 
142  void setBlockSize(int blockSize) {
143  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Stub");
144  }
145 
146  bool isInitialized() {
147  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Stub");
148  }
149 
150 private:
151  void setStateSize() {
152  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Stub");
153  }
154 };
155 
160 template<class ScalarType, class MV, class OP>
161 class BlockCGIter<ScalarType, MV, OP, true> :
162  virtual public CGIteration<ScalarType,MV,OP>
163 {
164 public:
165  //
166  // Convenience typedefs
167  //
170  typedef Teuchos::ScalarTraits<ScalarType> SCT;
171  typedef typename SCT::magnitudeType MagnitudeType;
172 
174 
175 
181  BlockCGIter( const Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > &problem,
182  const Teuchos::RCP<OutputManager<ScalarType> > &printer,
183  const Teuchos::RCP<StatusTest<ScalarType,MV,OP> > &tester,
184  const Teuchos::RCP<MatOrthoManager<ScalarType,MV,OP> > &ortho,
185  Teuchos::ParameterList &params );
186 
188  virtual ~BlockCGIter() {};
190 
191 
193 
194 
207  void iterate();
208 
224 
228  void initialize()
229  {
231  initializeCG(empty);
232  }
233 
242  state.R = R_;
243  state.P = P_;
244  state.AP = AP_;
245  state.Z = Z_;
246  return state;
247  }
248 
250 
251 
253 
254 
256  int getNumIters() const { return iter_; }
257 
259  void resetNumIters( int iter=0 ) { iter_ = iter; }
260 
263  Teuchos::RCP<const MV> getNativeResiduals( std::vector<MagnitudeType> *norms ) const { return R_; }
264 
266 
268  Teuchos::RCP<MV> getCurrentUpdate() const { return Teuchos::null; }
269 
271 
273 
274 
276  const LinearProblem<ScalarType,MV,OP>& getProblem() const { return *lp_; }
277 
279  int getBlockSize() const { return blockSize_; }
280 
282  void setBlockSize(int blockSize);
283 
285  bool isInitialized() { return initialized_; }
286 
288 
289  private:
290 
291  //
292  // Internal methods
293  //
295  void setStateSize();
296 
297  //
298  // Classes inputed through constructor that define the linear problem to be solved.
299  //
300  const Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > lp_;
301  const Teuchos::RCP<OutputManager<ScalarType> > om_;
302  const Teuchos::RCP<StatusTest<ScalarType,MV,OP> > stest_;
303  const Teuchos::RCP<OrthoManager<ScalarType,MV> > ortho_;
304 
305  //
306  // Algorithmic parameters
307  //
308  // blockSize_ is the solver block size.
309  int blockSize_;
310 
311  //
312  // Current solver state
313  //
314  // initialized_ specifies that the basis vectors have been initialized and the iterate() routine
315  // is capable of running; _initialize is controlled by the initialize() member method
316  // For the implications of the state of initialized_, please see documentation for initialize()
317  bool initialized_;
318 
319  // stateStorageInitialized_ specified that the state storage has be initialized.
320  // This initialization may be postponed if the linear problem was generated without
321  // the right-hand side or solution vectors.
322  bool stateStorageInitialized_;
323 
324  // Current subspace dimension, and number of iterations performed.
325  int iter_;
326 
327  //
328  // State Storage
329  //
330  // Residual
331  Teuchos::RCP<MV> R_;
332  //
333  // Preconditioned residual
334  Teuchos::RCP<MV> Z_;
335  //
336  // Direction std::vector
337  Teuchos::RCP<MV> P_;
338  //
339  // Operator applied to direction std::vector
340  Teuchos::RCP<MV> AP_;
341 
342 };
343 
344  template<class ScalarType, class MV, class OP>
346  BlockCGIter (const Teuchos::RCP<LinearProblem<ScalarType,MV,OP> >& problem,
347  const Teuchos::RCP<OutputManager<ScalarType> >& printer,
348  const Teuchos::RCP<StatusTest<ScalarType,MV,OP> >& tester,
349  const Teuchos::RCP<MatOrthoManager<ScalarType,MV,OP> >& ortho,
350  Teuchos::ParameterList& params) :
351  lp_(problem),
352  om_(printer),
353  stest_(tester),
354  ortho_(ortho),
355  blockSize_(0),
356  initialized_(false),
357  stateStorageInitialized_(false),
358  iter_(0)
359  {
360  // Set the block size and allocate data
361  int bs = params.get("Block Size", 1);
362  setBlockSize( bs );
363  }
364 
365  template <class ScalarType, class MV, class OP>
367  {
368  if (! stateStorageInitialized_) {
369  // Check if there is any multivector to clone from.
370  Teuchos::RCP<const MV> lhsMV = lp_->getLHS();
371  Teuchos::RCP<const MV> rhsMV = lp_->getRHS();
372  if (lhsMV == Teuchos::null && rhsMV == Teuchos::null) {
373  stateStorageInitialized_ = false;
374  return;
375  }
376  else {
377  // Initialize the state storage If the subspace has not be
378  // initialized before, generate it using the LHS or RHS from
379  // lp_.
380  if (R_ == Teuchos::null || MVT::GetNumberVecs(*R_)!=blockSize_) {
381  // Get the multivector that is not null.
382  Teuchos::RCP<const MV> tmp = ( (rhsMV!=Teuchos::null)? rhsMV: lhsMV );
383  TEUCHOS_TEST_FOR_EXCEPTION
384  (tmp == Teuchos::null,std:: invalid_argument,
385  "Belos::BlockCGIter::setStateSize: LinearProblem lacks "
386  "multivectors from which to clone.");
387  R_ = MVT::Clone (*tmp, blockSize_);
388  Z_ = MVT::Clone (*tmp, blockSize_);
389  P_ = MVT::Clone (*tmp, blockSize_);
390  AP_ = MVT::Clone (*tmp, blockSize_);
391  }
392 
393  // State storage has now been initialized.
394  stateStorageInitialized_ = true;
395  }
396  }
397  }
398 
399  template <class ScalarType, class MV, class OP>
401  {
402  // This routine only allocates space; it doesn't not perform any computation
403  // any change in size will invalidate the state of the solver.
404  TEUCHOS_TEST_FOR_EXCEPTION
405  (blockSize <= 0, std::invalid_argument, "Belos::BlockGmresIter::"
406  "setBlockSize: blockSize = " << blockSize << " <= 0.");
407  if (blockSize == blockSize_) {
408  return; // do nothing
409  }
410  if (blockSize!=blockSize_) {
411  stateStorageInitialized_ = false;
412  }
413  blockSize_ = blockSize;
414  initialized_ = false;
415  // Use the current blockSize_ to initialize the state storage.
416  setStateSize ();
417  }
418 
419  template <class ScalarType, class MV, class OP>
422  {
423  const char prefix[] = "Belos::BlockCGIter::initialize: ";
424 
425  // Initialize the state storage if it isn't already.
426  if (! stateStorageInitialized_) {
427  setStateSize();
428  }
429 
430  TEUCHOS_TEST_FOR_EXCEPTION
431  (! stateStorageInitialized_, std::invalid_argument,
432  prefix << "Cannot initialize state storage!");
433 
434  // NOTE: In BlockCGIter R_, the initial residual, is required!!!
435  const char errstr[] = "Specified multivectors must have a consistent "
436  "length and width.";
437 
438  // Create convenience variables for zero and one.
439  const MagnitudeType zero = Teuchos::ScalarTraits<MagnitudeType>::zero();
440 
441  if (newstate.R != Teuchos::null) {
442 
443  TEUCHOS_TEST_FOR_EXCEPTION
444  (MVT::GetGlobalLength(*newstate.R) != MVT::GetGlobalLength(*R_),
445  std::invalid_argument, prefix << errstr );
446  TEUCHOS_TEST_FOR_EXCEPTION
447  (MVT::GetNumberVecs(*newstate.R) != blockSize_,
448  std::invalid_argument, prefix << errstr );
449 
450  // Copy basis vectors from newstate into V
451  if (newstate.R != R_) {
452  // copy over the initial residual (unpreconditioned).
453  MVT::Assign( *newstate.R, *R_ );
454  }
455  // Compute initial direction vectors
456  // Initially, they are set to the preconditioned residuals
457  //
458  if ( lp_->getLeftPrec() != Teuchos::null ) {
459  lp_->applyLeftPrec( *R_, *Z_ );
460  if ( lp_->getRightPrec() != Teuchos::null ) {
461  Teuchos::RCP<MV> tmp = MVT::Clone( *Z_, blockSize_ );
462  lp_->applyRightPrec( *Z_, *tmp );
463  Z_ = tmp;
464  }
465  }
466  else if ( lp_->getRightPrec() != Teuchos::null ) {
467  lp_->applyRightPrec( *R_, *Z_ );
468  }
469  else {
470  Z_ = R_;
471  }
472  MVT::Assign( *Z_, *P_ );
473  }
474  else {
475  TEUCHOS_TEST_FOR_EXCEPTION
476  (newstate.R == Teuchos::null, std::invalid_argument,
477  prefix << "BlockCGStateIterState does not have initial residual.");
478  }
479 
480  // The solver is initialized
481  initialized_ = true;
482  }
483 
484  template <class ScalarType, class MV, class OP>
486  {
487  const char prefix[] = "Belos::BlockCGIter::iterate: ";
488 
489  //
490  // Allocate/initialize data structures
491  //
492  if (initialized_ == false) {
493  initialize();
494  }
495  // Allocate data needed for LAPACK work.
496  int info = 0;
497  //char UPLO = 'U';
498  //(void) UPLO; // silence "unused variable" compiler warnings
499  bool uplo = true;
500  Teuchos::LAPACK<int,ScalarType> lapack;
501 
502  // Allocate memory for scalars.
503  Teuchos::SerialDenseMatrix<int,ScalarType> alpha( blockSize_, blockSize_ );
504  Teuchos::SerialDenseMatrix<int,ScalarType> beta( blockSize_, blockSize_ );
505  Teuchos::SerialDenseMatrix<int,ScalarType> rHz( blockSize_, blockSize_ ),
506  rHz_old( blockSize_, blockSize_ ), pAp( blockSize_, blockSize_ );
507  Teuchos::SerialSymDenseMatrix<int,ScalarType> pApHerm(Teuchos::View, uplo, pAp.values(), blockSize_, blockSize_);
508 
509  // Create dense spd solver.
510  Teuchos::SerialSpdDenseSolver<int,ScalarType> lltSolver;
511 
512  // Create convenience variables for zero and one.
513  const ScalarType one = Teuchos::ScalarTraits<ScalarType>::one();
514 
515  // Get the current solution std::vector.
516  Teuchos::RCP<MV> cur_soln_vec = lp_->getCurrLHSVec();
517 
518  // Check that the current solution std::vector has blockSize_ columns.
519  TEUCHOS_TEST_FOR_EXCEPTION
520  (MVT::GetNumberVecs(*cur_soln_vec) != blockSize_, CGIterateFailure,
521  prefix << "Current linear system does not have the right number of vectors!" );
522  int rank = ortho_->normalize( *P_, Teuchos::null );
523  TEUCHOS_TEST_FOR_EXCEPTION
524  (rank != blockSize_, CGIterationOrthoFailure,
525  prefix << "Failed to compute initial block of orthonormal direction vectors.");
526 
527  //
528  // Iterate until the status test tells us to stop.
529  //
530  while (stest_->checkStatus(this) != Passed) {
531  // Increment the iteration
532  iter_++;
533 
534  // Multiply the current direction std::vector by A and store in Ap_
535  lp_->applyOp( *P_, *AP_ );
536 
537  // Compute alpha := <P_,R_> / <P_,AP_>
538  // 1) Compute P^T * A * P = pAp and P^T * R
539  // 2) Compute the Cholesky Factorization of pAp
540  // 3) Back and forward solves to compute alpha
541  //
542  MVT::MvTransMv( one, *P_, *R_, alpha );
543  MVT::MvTransMv( one, *P_, *AP_, pAp );
544 
545  // Compute Cholesky factorization of pAp
546  lltSolver.setMatrix( Teuchos::rcp(&pApHerm, false) );
547  lltSolver.factorWithEquilibration( true );
548  info = lltSolver.factor();
549  TEUCHOS_TEST_FOR_EXCEPTION
550  (info != 0, CGIterationLAPACKFailure,
551  prefix << "Failed to compute Cholesky factorization using LAPACK routine POTRF.");
552 
553  // Compute alpha by performing a back and forward solve with the
554  // Cholesky factorization in pAp.
555  lltSolver.setVectors (Teuchos::rcpFromRef (alpha), Teuchos::rcpFromRef (alpha));
556  info = lltSolver.solve();
557  TEUCHOS_TEST_FOR_EXCEPTION
558  (info != 0, CGIterationLAPACKFailure,
559  prefix << "Failed to compute alpha using Cholesky factorization (POTRS).");
560 
561  // Update the solution std::vector X := X + alpha * P_
562  MVT::MvTimesMatAddMv( one, *P_, alpha, one, *cur_soln_vec );
563  lp_->updateSolution();
564 
565  // Compute the new residual R_ := R_ - alpha * AP_
566  MVT::MvTimesMatAddMv( -one, *AP_, alpha, one, *R_ );
567 
568  // Compute the new preconditioned residual, Z_.
569  if ( lp_->getLeftPrec() != Teuchos::null ) {
570  lp_->applyLeftPrec( *R_, *Z_ );
571  if ( lp_->getRightPrec() != Teuchos::null ) {
572  Teuchos::RCP<MV> tmp = MVT::Clone( *Z_, blockSize_ );
573  lp_->applyRightPrec( *Z_, *tmp );
574  Z_ = tmp;
575  }
576  }
577  else if ( lp_->getRightPrec() != Teuchos::null ) {
578  lp_->applyRightPrec( *R_, *Z_ );
579  }
580  else {
581  Z_ = R_;
582  }
583 
584  // Compute beta := <AP_,Z_> / <P_,AP_>
585  // 1) Compute AP_^T * Z_
586  // 2) Compute the Cholesky Factorization of pAp (already have)
587  // 3) Back and forward solves to compute beta
588 
589  // Compute <AP_,Z>
590  MVT::MvTransMv( -one, *AP_, *Z_, beta );
591 
592  lltSolver.setVectors( Teuchos::rcp( &beta, false ), Teuchos::rcp( &beta, false ) );
593  info = lltSolver.solve();
594  TEUCHOS_TEST_FOR_EXCEPTION
595  (info != 0, CGIterationLAPACKFailure,
596  prefix << "Failed to compute beta using Cholesky factorization (POTRS).");
597 
598  // Compute the new direction vectors P_ = Z_ + P_ * beta
599  Teuchos::RCP<MV> Pnew = MVT::CloneCopy( *Z_ );
600  MVT::MvTimesMatAddMv(one, *P_, beta, one, *Pnew);
601  P_ = Pnew;
602 
603  // Compute orthonormal block of new direction vectors.
604  rank = ortho_->normalize( *P_, Teuchos::null );
605  TEUCHOS_TEST_FOR_EXCEPTION
606  (rank != blockSize_, CGIterationOrthoFailure,
607  prefix << "Failed to compute block of orthonormal direction vectors.");
608 
609  } // end while (sTest_->checkStatus(this) != Passed)
610  }
611 
612 } // namespace Belos
613 
614 #endif /* BELOS_BLOCK_CG_ITER_HPP */
Teuchos::RCP< const MV > R
The current residual.
Collection of types and exceptions used within the Belos solvers.
Belos&#39;s basic output manager for sending information of select verbosity levels to the appropriate ou...
Class which manages the output and verbosity of the Belos solvers.
Teuchos::ScalarTraits< ScalarType > SCT
int getNumIters() const
Get the current iteration count.
void initialize()
Initialize the solver with the initial vectors from the linear problem or random data.
int getBlockSize() const
Get the blocksize to be used by the iterative solver in solving this linear problem.
BlockCGIter(const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &, const Teuchos::RCP< OutputManager< ScalarType > > &, const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &, const Teuchos::RCP< MatOrthoManager< ScalarType, MV, OP > > &, Teuchos::ParameterList &)
Teuchos::RCP< MV > getCurrentUpdate() const
Get the current update to the linear system.
Structure to contain pointers to CGIteration state variables.
Pure virtual base class which augments the basic interface for a conjugate gradient linear solver ite...
void resetNumIters(int iter=0)
Reset the iteration count.
Pure virtual base class for defining the status testing capabilities of Belos.
MultiVecTraits< ScalarType, MV > MVT
Teuchos::RCP< MV > getCurrentUpdate() const
Get the current update to the linear system.
Declaration of basic traits for the multivector type.
const LinearProblem< ScalarType, MV, OP > & getProblem() const
Get a constant reference to the linear problem.
Teuchos::ScalarTraits< ScalarType > SCT
int getBlockSize() const
Get the block size to be used by the iterative solver in solving this linear problem.
static void MvTransMv(const ScalarType alpha, const MV &A, const MV &mv, Teuchos::SerialDenseMatrix< int, ScalarType > &B)
Compute a dense matrix B through the matrix-matrix multiply .
A pure virtual class for defining the status tests for the Belos iterative solvers.
Class which defines basic traits for the operator type.
CGIterateFailure is thrown when the CGIteration object is unable to compute the next iterate in the C...
Teuchos::RCP< const MV > AP
The matrix A applied to current decent direction vector.
static int GetNumberVecs(const MV &mv)
Obtain the number of vectors in mv.
static void Assign(const MV &A, MV &mv)
mv := A
Traits class which defines basic operations on multivectors.
OperatorTraits< ScalarType, MV, OP > OPT
const LinearProblem< ScalarType, MV, OP > & getProblem() const
Get a constant reference to the linear problem.
void initializeCG(CGIterationState< ScalarType, MV > &)
Initialize the solver to an iterate, providing a complete state.
CGIterationLAPACKFailure is thrown when a nonzero return value is passed back from an LAPACK routine...
static Teuchos::RCP< MV > Clone(const MV &mv, const int numvecs)
Creates a new empty MV containing numvecs columns.
void iterate()
This method performs linear solver iterations until the status test indicates the need to stop or an ...
A linear system to solve, and its associated information.
Class which describes the linear problem to be solved by the iterative solver.
CGIterationState< ScalarType, MV > getState() const
Get the current state of the linear solver.
Teuchos::RCP< const MV > getNativeResiduals(std::vector< MagnitudeType > *norms) const
Get the norms of the residuals native to the solver.
SCT::magnitudeType MagnitudeType
Type traits class that says whether Teuchos::LAPACK has a valid implementation for the given ScalarTy...
static Teuchos::RCP< MV > CloneCopy(const MV &mv)
Creates a new MV and copies contents of mv into the new vector (deep copy).
static void MvTimesMatAddMv(const ScalarType alpha, const MV &A, const Teuchos::SerialDenseMatrix< int, ScalarType > &B, const ScalarType beta, MV &mv)
Update mv with .
bool isInitialized()
States whether the solver has been initialized or not.
bool isInitialized()
States whether the solver has been initialized or not.
void resetNumIters(int iter=0)
Reset the iteration count to iter.
Teuchos::RCP< const MV > getNativeResiduals(std::vector< MagnitudeType > *) const
Teuchos::RCP< const MV > Z
The current preconditioned residual.
CGIterationState< ScalarType, MV > getState() const
Get the current state of the linear solver.
OperatorTraits< ScalarType, MV, OP > OPT
static ptrdiff_t GetGlobalLength(const MV &mv)
Return the number of rows in the given multivector mv.
CGIterationOrthoFailure is thrown when the CGIteration object is unable to compute independent direct...
void setBlockSize(int blockSize)
Set the blocksize to be used by the iterative solver in solving this linear problem.
void initialize()
Initialize the solver with the initial vectors from the linear problem or random data.
Class which defines basic traits for the operator type.
int getNumIters() const
Get the current iteration count.
Belos&#39;s templated virtual class for providing routines for orthogonalization and orthonormzalition of...
Belos header file which uses auto-configuration information to include necessary C++ headers...
Teuchos::RCP< const MV > P
The current decent direction vector.
Templated virtual class for providing orthogonalization/orthonormalization methods with matrix-based ...
Stub implementation of BlockCGIter, for ScalarType types for which Teuchos::LAPACK does NOT have a va...

Generated on Mon Feb 5 2018 15:01:51 for Belos by doxygen 1.8.13