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  void setDoCondEst(bool val){
151  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Stub");
152  }
153 
154 
155 private:
156  void setStateSize() {
157  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Stub");
158  }
159 };
160 
165 template<class ScalarType, class MV, class OP>
166 class BlockCGIter<ScalarType, MV, OP, true> :
167  virtual public CGIteration<ScalarType,MV,OP>
168 {
169 public:
170  //
171  // Convenience typedefs
172  //
175  typedef Teuchos::ScalarTraits<ScalarType> SCT;
176  typedef typename SCT::magnitudeType MagnitudeType;
177 
179 
180 
186  BlockCGIter( const Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > &problem,
187  const Teuchos::RCP<OutputManager<ScalarType> > &printer,
188  const Teuchos::RCP<StatusTest<ScalarType,MV,OP> > &tester,
189  const Teuchos::RCP<MatOrthoManager<ScalarType,MV,OP> > &ortho,
190  Teuchos::ParameterList &params );
191 
193  virtual ~BlockCGIter() {};
195 
196 
198 
199 
212  void iterate();
213 
229 
233  void initialize()
234  {
236  initializeCG(empty);
237  }
238 
247  state.R = R_;
248  state.P = P_;
249  state.AP = AP_;
250  state.Z = Z_;
251  return state;
252  }
253 
255 
256 
258 
259 
261  int getNumIters() const { return iter_; }
262 
264  void resetNumIters( int iter=0 ) { iter_ = iter; }
265 
268  Teuchos::RCP<const MV> getNativeResiduals( std::vector<MagnitudeType> *norms ) const { return R_; }
269 
271 
273  Teuchos::RCP<MV> getCurrentUpdate() const { return Teuchos::null; }
274 
276 
278 
279 
281  const LinearProblem<ScalarType,MV,OP>& getProblem() const { return *lp_; }
282 
284  int getBlockSize() const { return blockSize_; }
285 
287  void setBlockSize(int blockSize);
288 
290  bool isInitialized() { return initialized_; }
291 
293  void setDoCondEst(bool val){/*ignored*/}
294 
296  Teuchos::ArrayView<MagnitudeType> getDiag() {
297  Teuchos::ArrayView<MagnitudeType> temp;
298  return temp;
299  }
300 
302  Teuchos::ArrayView<MagnitudeType> getOffDiag() {
303  Teuchos::ArrayView<MagnitudeType> temp;
304  return temp;
305  }
307 
308  private:
309 
310  //
311  // Internal methods
312  //
314  void setStateSize();
315 
316  //
317  // Classes inputed through constructor that define the linear problem to be solved.
318  //
319  const Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > lp_;
320  const Teuchos::RCP<OutputManager<ScalarType> > om_;
321  const Teuchos::RCP<StatusTest<ScalarType,MV,OP> > stest_;
322  const Teuchos::RCP<OrthoManager<ScalarType,MV> > ortho_;
323 
324  //
325  // Algorithmic parameters
326  //
327  // blockSize_ is the solver block size.
328  int blockSize_;
329 
330  //
331  // Current solver state
332  //
333  // initialized_ specifies that the basis vectors have been initialized and the iterate() routine
334  // is capable of running; _initialize is controlled by the initialize() member method
335  // For the implications of the state of initialized_, please see documentation for initialize()
336  bool initialized_;
337 
338  // stateStorageInitialized_ specified that the state storage has be initialized.
339  // This initialization may be postponed if the linear problem was generated without
340  // the right-hand side or solution vectors.
341  bool stateStorageInitialized_;
342 
343  // Current subspace dimension, and number of iterations performed.
344  int iter_;
345 
346  //
347  // State Storage
348  //
349  // Residual
350  Teuchos::RCP<MV> R_;
351  //
352  // Preconditioned residual
353  Teuchos::RCP<MV> Z_;
354  //
355  // Direction std::vector
356  Teuchos::RCP<MV> P_;
357  //
358  // Operator applied to direction std::vector
359  Teuchos::RCP<MV> AP_;
360 
361 };
362 
363  template<class ScalarType, class MV, class OP>
365  BlockCGIter (const Teuchos::RCP<LinearProblem<ScalarType,MV,OP> >& problem,
366  const Teuchos::RCP<OutputManager<ScalarType> >& printer,
367  const Teuchos::RCP<StatusTest<ScalarType,MV,OP> >& tester,
368  const Teuchos::RCP<MatOrthoManager<ScalarType,MV,OP> >& ortho,
369  Teuchos::ParameterList& params) :
370  lp_(problem),
371  om_(printer),
372  stest_(tester),
373  ortho_(ortho),
374  blockSize_(0),
375  initialized_(false),
376  stateStorageInitialized_(false),
377  iter_(0)
378  {
379  // Set the block size and allocate data
380  int bs = params.get("Block Size", 1);
381  setBlockSize( bs );
382  }
383 
384  template <class ScalarType, class MV, class OP>
386  {
387  if (! stateStorageInitialized_) {
388  // Check if there is any multivector to clone from.
389  Teuchos::RCP<const MV> lhsMV = lp_->getLHS();
390  Teuchos::RCP<const MV> rhsMV = lp_->getRHS();
391  if (lhsMV == Teuchos::null && rhsMV == Teuchos::null) {
392  stateStorageInitialized_ = false;
393  return;
394  }
395  else {
396  // Initialize the state storage If the subspace has not be
397  // initialized before, generate it using the LHS or RHS from
398  // lp_.
399  if (R_ == Teuchos::null || MVT::GetNumberVecs(*R_)!=blockSize_) {
400  // Get the multivector that is not null.
401  Teuchos::RCP<const MV> tmp = ( (rhsMV!=Teuchos::null)? rhsMV: lhsMV );
402  TEUCHOS_TEST_FOR_EXCEPTION
403  (tmp == Teuchos::null,std:: invalid_argument,
404  "Belos::BlockCGIter::setStateSize: LinearProblem lacks "
405  "multivectors from which to clone.");
406  R_ = MVT::Clone (*tmp, blockSize_);
407  Z_ = MVT::Clone (*tmp, blockSize_);
408  P_ = MVT::Clone (*tmp, blockSize_);
409  AP_ = MVT::Clone (*tmp, blockSize_);
410  }
411 
412  // State storage has now been initialized.
413  stateStorageInitialized_ = true;
414  }
415  }
416  }
417 
418  template <class ScalarType, class MV, class OP>
420  {
421  // This routine only allocates space; it doesn't not perform any computation
422  // any change in size will invalidate the state of the solver.
423  TEUCHOS_TEST_FOR_EXCEPTION
424  (blockSize <= 0, std::invalid_argument, "Belos::BlockGmresIter::"
425  "setBlockSize: blockSize = " << blockSize << " <= 0.");
426  if (blockSize == blockSize_) {
427  return; // do nothing
428  }
429  if (blockSize!=blockSize_) {
430  stateStorageInitialized_ = false;
431  }
432  blockSize_ = blockSize;
433  initialized_ = false;
434  // Use the current blockSize_ to initialize the state storage.
435  setStateSize ();
436  }
437 
438  template <class ScalarType, class MV, class OP>
441  {
442  const char prefix[] = "Belos::BlockCGIter::initialize: ";
443 
444  // Initialize the state storage if it isn't already.
445  if (! stateStorageInitialized_) {
446  setStateSize();
447  }
448 
449  TEUCHOS_TEST_FOR_EXCEPTION
450  (! stateStorageInitialized_, std::invalid_argument,
451  prefix << "Cannot initialize state storage!");
452 
453  // NOTE: In BlockCGIter R_, the initial residual, is required!!!
454  const char errstr[] = "Specified multivectors must have a consistent "
455  "length and width.";
456 
457  // Create convenience variables for zero and one.
458  //const MagnitudeType zero = Teuchos::ScalarTraits<MagnitudeType>::zero(); // unused
459 
460  if (newstate.R != Teuchos::null) {
461 
462  TEUCHOS_TEST_FOR_EXCEPTION
463  (MVT::GetGlobalLength(*newstate.R) != MVT::GetGlobalLength(*R_),
464  std::invalid_argument, prefix << errstr );
465  TEUCHOS_TEST_FOR_EXCEPTION
466  (MVT::GetNumberVecs(*newstate.R) != blockSize_,
467  std::invalid_argument, prefix << errstr );
468 
469  // Copy basis vectors from newstate into V
470  if (newstate.R != R_) {
471  // copy over the initial residual (unpreconditioned).
472  MVT::Assign( *newstate.R, *R_ );
473  }
474  // Compute initial direction vectors
475  // Initially, they are set to the preconditioned residuals
476  //
477  if ( lp_->getLeftPrec() != Teuchos::null ) {
478  lp_->applyLeftPrec( *R_, *Z_ );
479  if ( lp_->getRightPrec() != Teuchos::null ) {
480  Teuchos::RCP<MV> tmp = MVT::Clone( *Z_, blockSize_ );
481  lp_->applyRightPrec( *Z_, *tmp );
482  Z_ = tmp;
483  }
484  }
485  else if ( lp_->getRightPrec() != Teuchos::null ) {
486  lp_->applyRightPrec( *R_, *Z_ );
487  }
488  else {
489  Z_ = R_;
490  }
491  MVT::Assign( *Z_, *P_ );
492  }
493  else {
494  TEUCHOS_TEST_FOR_EXCEPTION
495  (newstate.R == Teuchos::null, std::invalid_argument,
496  prefix << "BlockCGStateIterState does not have initial residual.");
497  }
498 
499  // The solver is initialized
500  initialized_ = true;
501  }
502 
503  template <class ScalarType, class MV, class OP>
505  {
506  const char prefix[] = "Belos::BlockCGIter::iterate: ";
507 
508  //
509  // Allocate/initialize data structures
510  //
511  if (initialized_ == false) {
512  initialize();
513  }
514  // Allocate data needed for LAPACK work.
515  int info = 0;
516  //char UPLO = 'U';
517  //(void) UPLO; // silence "unused variable" compiler warnings
518  bool uplo = true;
519  Teuchos::LAPACK<int,ScalarType> lapack;
520 
521  // Allocate memory for scalars.
522  Teuchos::SerialDenseMatrix<int,ScalarType> alpha( blockSize_, blockSize_ );
523  Teuchos::SerialDenseMatrix<int,ScalarType> beta( blockSize_, blockSize_ );
524  Teuchos::SerialDenseMatrix<int,ScalarType> rHz( blockSize_, blockSize_ ),
525  rHz_old( blockSize_, blockSize_ ), pAp( blockSize_, blockSize_ );
526  Teuchos::SerialSymDenseMatrix<int,ScalarType> pApHerm(Teuchos::View, uplo, pAp.values(), blockSize_, blockSize_);
527 
528  // Create dense spd solver.
529  Teuchos::SerialSpdDenseSolver<int,ScalarType> lltSolver;
530 
531  // Create convenience variable for one.
532  const ScalarType one = Teuchos::ScalarTraits<ScalarType>::one();
533 
534  // Get the current solution std::vector.
535  Teuchos::RCP<MV> cur_soln_vec = lp_->getCurrLHSVec();
536 
537  // Check that the current solution std::vector has blockSize_ columns.
538  TEUCHOS_TEST_FOR_EXCEPTION
539  (MVT::GetNumberVecs(*cur_soln_vec) != blockSize_, CGIterateFailure,
540  prefix << "Current linear system does not have the right number of vectors!" );
541  int rank = ortho_->normalize( *P_, Teuchos::null );
542  TEUCHOS_TEST_FOR_EXCEPTION
543  (rank != blockSize_, CGIterationOrthoFailure,
544  prefix << "Failed to compute initial block of orthonormal direction vectors.");
545 
546  //
547  // Iterate until the status test tells us to stop.
548  //
549  while (stest_->checkStatus(this) != Passed) {
550  // Increment the iteration
551  iter_++;
552 
553  // Multiply the current direction std::vector by A and store in Ap_
554  lp_->applyOp( *P_, *AP_ );
555 
556  // Compute alpha := <P_,R_> / <P_,AP_>
557  // 1) Compute P^T * A * P = pAp and P^T * R
558  // 2) Compute the Cholesky Factorization of pAp
559  // 3) Back and forward solves to compute alpha
560  //
561  MVT::MvTransMv( one, *P_, *R_, alpha );
562  MVT::MvTransMv( one, *P_, *AP_, pAp );
563 
564  // Compute Cholesky factorization of pAp
565  lltSolver.setMatrix( Teuchos::rcp(&pApHerm, false) );
566  lltSolver.factorWithEquilibration( true );
567  info = lltSolver.factor();
568  TEUCHOS_TEST_FOR_EXCEPTION
569  (info != 0, CGIterationLAPACKFailure,
570  prefix << "Failed to compute Cholesky factorization using LAPACK routine POTRF.");
571 
572  // Compute alpha by performing a back and forward solve with the
573  // Cholesky factorization in pAp.
574  lltSolver.setVectors (Teuchos::rcpFromRef (alpha), Teuchos::rcpFromRef (alpha));
575  info = lltSolver.solve();
576  TEUCHOS_TEST_FOR_EXCEPTION
577  (info != 0, CGIterationLAPACKFailure,
578  prefix << "Failed to compute alpha using Cholesky factorization (POTRS).");
579 
580  // Update the solution std::vector X := X + alpha * P_
581  MVT::MvTimesMatAddMv( one, *P_, alpha, one, *cur_soln_vec );
582  lp_->updateSolution();
583 
584  // Compute the new residual R_ := R_ - alpha * AP_
585  MVT::MvTimesMatAddMv( -one, *AP_, alpha, one, *R_ );
586 
587  // Compute the new preconditioned residual, Z_.
588  if ( lp_->getLeftPrec() != Teuchos::null ) {
589  lp_->applyLeftPrec( *R_, *Z_ );
590  if ( lp_->getRightPrec() != Teuchos::null ) {
591  Teuchos::RCP<MV> tmp = MVT::Clone( *Z_, blockSize_ );
592  lp_->applyRightPrec( *Z_, *tmp );
593  Z_ = tmp;
594  }
595  }
596  else if ( lp_->getRightPrec() != Teuchos::null ) {
597  lp_->applyRightPrec( *R_, *Z_ );
598  }
599  else {
600  Z_ = R_;
601  }
602 
603  // Compute beta := <AP_,Z_> / <P_,AP_>
604  // 1) Compute AP_^T * Z_
605  // 2) Compute the Cholesky Factorization of pAp (already have)
606  // 3) Back and forward solves to compute beta
607 
608  // Compute <AP_,Z>
609  MVT::MvTransMv( -one, *AP_, *Z_, beta );
610 
611  lltSolver.setVectors( Teuchos::rcp( &beta, false ), Teuchos::rcp( &beta, false ) );
612  info = lltSolver.solve();
613  TEUCHOS_TEST_FOR_EXCEPTION
614  (info != 0, CGIterationLAPACKFailure,
615  prefix << "Failed to compute beta using Cholesky factorization (POTRS).");
616 
617  // Compute the new direction vectors P_ = Z_ + P_ * beta
618  Teuchos::RCP<MV> Pnew = MVT::CloneCopy( *Z_ );
619  MVT::MvTimesMatAddMv(one, *P_, beta, one, *Pnew);
620  P_ = Pnew;
621 
622  // Compute orthonormal block of new direction vectors.
623  rank = ortho_->normalize( *P_, Teuchos::null );
624  TEUCHOS_TEST_FOR_EXCEPTION
625  (rank != blockSize_, CGIterationOrthoFailure,
626  prefix << "Failed to compute block of orthonormal direction vectors.");
627 
628  } // end while (sTest_->checkStatus(this) != Passed)
629  }
630 
631 } // namespace Belos
632 
633 #endif /* BELOS_BLOCK_CG_ITER_HPP */
Belos::BlockCGIter::getCurrentUpdate
Teuchos::RCP< MV > getCurrentUpdate() const
Get the current update to the linear system.
Definition: BelosBlockCGIter.hpp:130
Belos::CGIterateFailure
CGIterateFailure is thrown when the CGIteration object is unable to compute the next iterate in the C...
Definition: BelosCGIteration.hpp:106
Belos::BlockCGIter< ScalarType, MV, OP, true >::setDoCondEst
void setDoCondEst(bool val)
Sets whether or not to store the diagonal for condition estimation.
Definition: BelosBlockCGIter.hpp:293
Belos::BlockCGIter::initializeCG
void initializeCG(CGIterationState< ScalarType, MV > &)
Initialize the solver to an iterate, providing a complete state.
Definition: BelosBlockCGIter.hpp:105
BelosConfigDefs.hpp
Belos header file which uses auto-configuration information to include necessary C++ headers.
Belos::BlockCGIter< ScalarType, MV, OP, true >::isInitialized
bool isInitialized()
States whether the solver has been initialized or not.
Definition: BelosBlockCGIter.hpp:290
Belos::BlockCGIter< ScalarType, MV, OP, true >::getState
CGIterationState< ScalarType, MV > getState() const
Get the current state of the linear solver.
Definition: BelosBlockCGIter.hpp:245
Belos::CGIterationState::AP
Teuchos::RCP< const MV > AP
The matrix A applied to current decent direction vector.
Definition: BelosCGIteration.hpp:75
Belos::BlockCGIter::getNumIters
int getNumIters() const
Get the current iteration count.
Definition: BelosBlockCGIter.hpp:117
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.
BelosStatusTest.hpp
Pure virtual base class for defining the status testing capabilities of Belos.
Belos::BlockCGIter< ScalarType, MV, OP, true >::getNativeResiduals
Teuchos::RCP< const MV > getNativeResiduals(std::vector< MagnitudeType > *norms) const
Get the norms of the residuals native to the solver.
Definition: BelosBlockCGIter.hpp:268
Belos::BlockCGIter::MagnitudeType
SCT::magnitudeType MagnitudeType
Definition: BelosBlockCGIter.hpp:88
Belos::BlockCGIter::getProblem
const LinearProblem< ScalarType, MV, OP > & getProblem() const
Get a constant reference to the linear problem.
Definition: BelosBlockCGIter.hpp:134
Belos::MultiVecTraits::Assign
static void Assign(const MV &A, MV &mv)
mv := A
Definition: BelosMultiVecTraits.hpp:327
Belos::CGIterationState::Z
Teuchos::RCP< const MV > Z
The current preconditioned residual.
Definition: BelosCGIteration.hpp:69
Belos::BlockCGIter< ScalarType, MV, OP, true >::resetNumIters
void resetNumIters(int iter=0)
Reset the iteration count.
Definition: BelosBlockCGIter.hpp:264
Belos::CGIterationState::P
Teuchos::RCP< const MV > P
The current decent direction vector.
Definition: BelosCGIteration.hpp:72
Belos::CGIterationOrthoFailure
CGIterationOrthoFailure is thrown when the CGIteration object is unable to compute independent direct...
Definition: BelosCGIteration.hpp:116
Belos::BlockCGIter::getNativeResiduals
Teuchos::RCP< const MV > getNativeResiduals(std::vector< MagnitudeType > *) const
Definition: BelosBlockCGIter.hpp:126
Belos::CGIterationLAPACKFailure
CGIterationLAPACKFailure is thrown when a nonzero return value is passed back from an LAPACK routine.
Definition: BelosCGIteration.hpp:126
Belos::BlockCGIter::getState
CGIterationState< ScalarType, MV > getState() const
Get the current state of the linear solver.
Definition: BelosBlockCGIter.hpp:113
Belos::Passed
Definition: BelosTypes.hpp:188
Belos::MultiVecTraits::GetNumberVecs
static int GetNumberVecs(const MV &mv)
Obtain the number of vectors in mv.
Definition: BelosMultiVecTraits.hpp:218
Belos::LinearProblem
A linear system to solve, and its associated information.
Definition: BelosIteration.hpp:61
Belos::MultiVecTraits::MvTransMv
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 .
Definition: BelosMultiVecTraits.hpp:275
BelosOutputManager.hpp
Class which manages the output and verbosity of the Belos solvers.
Belos
Definition: Belos_Details_EBelosSolverType.cpp:45
Belos::BlockCGIter< ScalarType, MV, OP, true >::getBlockSize
int getBlockSize() const
Get the block size to be used by the iterative solver in solving this linear problem.
Definition: BelosBlockCGIter.hpp:284
Belos::CGIterationState
Structure to contain pointers to CGIteration state variables.
Definition: BelosCGIteration.hpp:63
Belos::Details::LapackSupportsScalar
Type traits class that says whether Teuchos::LAPACK has a valid implementation for the given ScalarTy...
Definition: BelosSolverManager.hpp:295
Belos::BlockCGIter::setBlockSize
void setBlockSize(int blockSize)
Set the blocksize to be used by the iterative solver in solving this linear problem.
Definition: BelosBlockCGIter.hpp:142
Belos::MultiVecTraits::Clone
static Teuchos::RCP< MV > Clone(const MV &mv, const int numvecs)
Creates a new empty MV containing numvecs columns.
Definition: BelosMultiVecTraits.hpp:138
Belos::MultiVecTraits::CloneCopy
static Teuchos::RCP< MV > CloneCopy(const MV &mv)
Creates a new MV and copies contents of mv into the new vector (deep copy).
Definition: BelosMultiVecTraits.hpp:145
Belos::CGIterationState::R
Teuchos::RCP< const MV > R
The current residual.
Definition: BelosCGIteration.hpp:66
Belos::BlockCGIter< ScalarType, MV, OP, true >::getOffDiag
Teuchos::ArrayView< MagnitudeType > getOffDiag()
Gets the off-diagonal for condition estimation (NOT_IMPLEMENTED)
Definition: BelosBlockCGIter.hpp:302
BelosOperatorTraits.hpp
Class which defines basic traits for the operator type.
BelosMatOrthoManager.hpp
Templated virtual class for providing orthogonalization/orthonormalization methods with matrix-based ...
Belos::BlockCGIter
Stub implementation of BlockCGIter, for ScalarType types for which Teuchos::LAPACK does NOT have a va...
Definition: BelosBlockCGIter.hpp:83
Belos::BlockCGIter< ScalarType, MV, OP, true >::SCT
Teuchos::ScalarTraits< ScalarType > SCT
Definition: BelosBlockCGIter.hpp:175
Belos::MatOrthoManager
Belos's templated virtual class for providing routines for orthogonalization and orthonormzalition of...
Definition: BelosIteration.hpp:70
Belos::MultiVecTraits::MvTimesMatAddMv
static void MvTimesMatAddMv(const ScalarType alpha, const MV &A, const Teuchos::SerialDenseMatrix< int, ScalarType > &B, const ScalarType beta, MV &mv)
Update mv with .
Definition: BelosMultiVecTraits.hpp:253
Belos::BlockCGIter< ScalarType, MV, OP, true >::initialize
void initialize()
Initialize the solver with the initial vectors from the linear problem or random data.
Definition: BelosBlockCGIter.hpp:233
Belos::StatusTest
A pure virtual class for defining the status tests for the Belos iterative solvers.
Definition: BelosIteration.hpp:67
Belos::BlockCGIter< ScalarType, MV, OP, true >::MagnitudeType
SCT::magnitudeType MagnitudeType
Definition: BelosBlockCGIter.hpp:176
Belos::BlockCGIter::initialize
void initialize()
Initialize the solver with the initial vectors from the linear problem or random data.
Definition: BelosBlockCGIter.hpp:109
Belos::BlockCGIter< ScalarType, MV, OP, true >::MVT
MultiVecTraits< ScalarType, MV > MVT
Definition: BelosBlockCGIter.hpp:173
Belos::BlockCGIter::OPT
OperatorTraits< ScalarType, MV, OP > OPT
Definition: BelosBlockCGIter.hpp:86
Belos::BlockCGIter< ScalarType, MV, OP, true >::~BlockCGIter
virtual ~BlockCGIter()
Destructor.
Definition: BelosBlockCGIter.hpp:193
BelosMultiVecTraits.hpp
Declaration of basic traits for the multivector type.
Belos::BlockCGIter< ScalarType, MV, OP, true >::getDiag
Teuchos::ArrayView< MagnitudeType > getDiag()
Gets the diagonal for condition estimation (NOT_IMPLEMENTED)
Definition: BelosBlockCGIter.hpp:296
Belos::BlockCGIter< ScalarType, MV, OP, true >::getCurrentUpdate
Teuchos::RCP< MV > getCurrentUpdate() const
Get the current update to the linear system.
Definition: BelosBlockCGIter.hpp:273
Belos::MultiVecTraits::GetGlobalLength
static ptrdiff_t GetGlobalLength(const MV &mv)
Return the number of rows in the given multivector mv.
Definition: BelosMultiVecTraits.hpp:214
Belos::BlockCGIter::~BlockCGIter
virtual ~BlockCGIter()
Definition: BelosBlockCGIter.hpp:99
BelosTypes.hpp
Collection of types and exceptions used within the Belos solvers.
Belos::CGIteration
Definition: BelosCGIteration.hpp:134
Belos::BlockCGIter< ScalarType, MV, OP, true >::getNumIters
int getNumIters() const
Get the current iteration count.
Definition: BelosBlockCGIter.hpp:261
Belos::BlockCGIter::isInitialized
bool isInitialized()
States whether the solver has been initialized or not.
Definition: BelosBlockCGIter.hpp:146
Belos::BlockCGIter< ScalarType, MV, OP, true >::OPT
OperatorTraits< ScalarType, MV, OP > OPT
Definition: BelosBlockCGIter.hpp:174
Belos::BlockCGIter< ScalarType, MV, OP, true >::getProblem
const LinearProblem< ScalarType, MV, OP > & getProblem() const
Get a constant reference to the linear problem.
Definition: BelosBlockCGIter.hpp:281
Belos::BlockCGIter::getBlockSize
int getBlockSize() const
Get the blocksize to be used by the iterative solver in solving this linear problem.
Definition: BelosBlockCGIter.hpp:138
Belos::BlockCGIter::iterate
void iterate()
This method performs linear solver iterations until the status test indicates the need to stop or an ...
Definition: BelosBlockCGIter.hpp:101
Belos::BlockCGIter::setDoCondEst
void setDoCondEst(bool val)
Sets whether or not to store the diagonal for condition estimation.
Definition: BelosBlockCGIter.hpp:150
Belos::MultiVecTraits
Traits class which defines basic operations on multivectors.
Definition: BelosMultiVecTraits.hpp:129
Belos::BlockCGIter::MVT
MultiVecTraits< ScalarType, MV > MVT
Definition: BelosBlockCGIter.hpp:85
Belos::BlockCGIter::BlockCGIter
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 &)
Definition: BelosBlockCGIter.hpp:90
Belos::BlockCGIter::SCT
Teuchos::ScalarTraits< ScalarType > SCT
Definition: BelosBlockCGIter.hpp:87
BelosCGIteration.hpp
Pure virtual base class which augments the basic interface for a conjugate gradient linear solver ite...
Belos::BlockCGIter::resetNumIters
void resetNumIters(int iter=0)
Reset the iteration count to iter.
Definition: BelosBlockCGIter.hpp:121

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