Belos Version of the Day
Loading...
Searching...
No Matches
BelosGCRODRIter.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Belos: Block Linear Solvers Package
4//
5// Copyright 2004-2016 NTESS and the Belos contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef BELOS_GCRODR_ITER_HPP
11#define BELOS_GCRODR_ITER_HPP
12
17#include "BelosConfigDefs.hpp"
18#include "BelosTypes.hpp"
20
24#include "BelosStatusTest.hpp"
28
29#include "Teuchos_BLAS.hpp"
30#include "Teuchos_ScalarTraits.hpp"
31#include "Teuchos_ParameterList.hpp"
32#include "Teuchos_TimeMonitor.hpp"
33
46namespace Belos {
47
49
50
55 template <class ScalarType, class MV, class DM>
61 int curDim;
62
64 Teuchos::RCP<MV> V;
65
67 Teuchos::RCP<MV> Z;
68
70 Teuchos::RCP<MV> U, C;
71
74 Teuchos::RCP<DM> H2;
75
81 Teuchos::RCP<DM> H;
82
85 Teuchos::RCP<DM> B;
86
87 GCRODRIterState() : curDim(0), V(Teuchos::null), Z(Teuchos::null),
88 U(Teuchos::null), C(Teuchos::null),
89 H2(Teuchos::null), H(Teuchos::null),
90 B(Teuchos::null)
91 {}
92 };
93
95
97
98
111 public:
113 };
114
122 public:
124 };
125
127
128
129 template<class ScalarType, class MV, class OP, class DM>
130 class GCRODRIter : virtual public GCRODRIteration<ScalarType,MV,OP,DM> {
131
132 public:
133
134 //
135 // Convenience typedefs
136 //
140 typedef Teuchos::ScalarTraits<ScalarType> SCT;
141 typedef typename SCT::magnitudeType MagnitudeType;
142
144
145
155 const Teuchos::RCP<OutputManager<ScalarType> > &printer,
156 const Teuchos::RCP<StatusTest<ScalarType,MV,OP,DM> > &tester,
157 const Teuchos::RCP<MatOrthoManager<ScalarType,MV,OP,DM> > &ortho,
158 Teuchos::ParameterList &params );
159
161 virtual ~GCRODRIter() {};
163
164
166
167
189 void iterate();
190
213
221
231 state.curDim = curDim_;
232 state.V = V_;
233 state.Z = Teuchos::null;
234 state.U = U_;
235 state.C = C_;
236 state.H2 = H2_;
237 state.H = H_;
238 state.B = B_;
239
240 return state;
241 }
242
244
245
247
248
250 int getNumIters() const { return iter_; }
251
253 void resetNumIters( int iter = 0 ) { iter_ = iter; }
254
257 Teuchos::RCP<const MV> getNativeResiduals( std::vector<MagnitudeType> *norms ) const;
258
260
265 Teuchos::RCP<MV> getCurrentUpdate() const;
266
268
271 void updateLSQR( int dim = -1 );
272
274 int getCurSubspaceDim() const {
275 if (!initialized_) return 0;
276 return curDim_;
277 };
278
280 int getMaxSubspaceDim() const { return numBlocks_; }
281
283
284
286
287
289 const LinearProblem<ScalarType,MV,OP,DM>& getProblem() const { return *lp_; }
290
292 int getNumBlocks() const { return numBlocks_; }
293
295 void setNumBlocks(int numBlocks) { setSize( recycledBlocks_, numBlocks ); };
296
298 int getBlockSize() const { return 1; }
299
302 TEUCHOS_TEST_FOR_EXCEPTION(blockSize!=1,std::invalid_argument,"Belos::GCRODRIter::setBlockSize(): Cannot use a block size that is not one.");
303 }
304
307 // only call resize if size changed
308 if ( recycledBlocks_ != recycledBlocks )
309 recycledBlocks_ = recycledBlocks;
310 if ( numBlocks_ != numBlocks ) {
311 numBlocks_ = numBlocks;
312 cs_.resize( numBlocks_+1 );
313 sn_.resize( numBlocks_+1 );
314 z_ = DMT::Create( numBlocks_+1, 1, false );
315 R_ = DMT::Create( numBlocks_+1, numBlocks, false );
316 }
317 }
318
320 bool isInitialized() { return initialized_; }
321
323
324 private:
325
326 //
327 // Internal methods
328 //
329
330 //
331 // Classes inputed through constructor that define the linear problem to be solved.
332 //
333 const Teuchos::RCP<LinearProblem<ScalarType,MV,OP,DM> > lp_;
334 const Teuchos::RCP<OutputManager<ScalarType> > om_;
335 const Teuchos::RCP<StatusTest<ScalarType,MV,OP,DM> > stest_;
336 const Teuchos::RCP<OrthoManager<ScalarType,MV,DM> > ortho_;
337
338 //
339 // Algorithmic parameters
340 //
341 // numBlocks_ is the size of the allocated space for the Krylov basis, in blocks.
342 int numBlocks_;
343
344 // recycledBlocks_ is the size of the allocated space for the recycled subspace, in blocks.
345 int recycledBlocks_;
346
347 // Storage for QR factorization of the least squares system.
348 std::vector<ScalarType> sn_;
349 std::vector<MagnitudeType> cs_;
350
351 //
352 // Current solver state
353 //
354 // initialized_ specifies that the basis vectors have been initialized and the iterate() routine
355 // is capable of running; _initialize is controlled by the initialize() member method
356 // For the implications of the state of initialized_, please see documentation for initialize()
357 bool initialized_;
358
359 // Current subspace dimension, and number of iterations performed.
360 int curDim_, iter_;
361
362 // Pointer to the (0,0) position of the upper Hessenberg matrix.
363 int ptrH00_;
364 //
365 // State Storage
366 //
367 // Krylov vectors.
368 Teuchos::RCP<MV> V_;
369 //
370 // Recycled subspace vectors.
371 Teuchos::RCP<MV> U_, C_;
372 //
373 // Global projected matrix, including H_ and B_
374 Teuchos::RCP<DM> H2_;
375 //
376 // Projected matrices
377 // H_ : Projected matrix from the Krylov factorization AV = VH + FE^T
378 Teuchos::RCP<DM> H_;
379 //
380 // B_ : Projected matrix from the recycled subspace B = C^H*A*V
381 Teuchos::RCP<DM> B_;
382 //
383 // QR decomposition of Projected matrices for solving the least squares system HY = B.
384 // R_: Upper triangular reduction of H
385 // z_: Q applied to right-hand side of the least squares system
386 Teuchos::RCP<DM> R_;
387 Teuchos::RCP<DM> z_;
388 };
389
391 // Constructor.
392 template<class ScalarType, class MV, class OP, class DM>
394 const Teuchos::RCP<OutputManager<ScalarType> > &printer,
395 const Teuchos::RCP<StatusTest<ScalarType,MV,OP,DM> > &tester,
396 const Teuchos::RCP<MatOrthoManager<ScalarType,MV,OP,DM> > &ortho,
397 Teuchos::ParameterList &params ):
398 lp_(problem), om_(printer), stest_(tester), ortho_(ortho) {
399 numBlocks_ = 0;
400 recycledBlocks_ = 0;
401 initialized_ = false;
402 curDim_ = 0;
403 iter_ = 0;
404 ptrH00_ = 0;
405 V_ = Teuchos::null;
406 U_ = Teuchos::null;
407 C_ = Teuchos::null;
408 H2_ = Teuchos::null;
409 H_ = Teuchos::null;
410 B_ = Teuchos::null;
411
412 // Get the maximum number of blocks allowed for this Krylov subspace
413 TEUCHOS_TEST_FOR_EXCEPTION(!params.isParameter("Num Blocks"), std::invalid_argument, "Belos::GCRODRIter::constructor: mandatory parameter \"Num Blocks\" is not specified.");
414 int nb = Teuchos::getParameter<int>(params, "Num Blocks");
415
416 TEUCHOS_TEST_FOR_EXCEPTION(!params.isParameter("Recycled Blocks"), std::invalid_argument,"Belos::GCRODRIter::constructor: mandatory parameter \"Recycled Blocks\" is not specified.");
417 int rb = Teuchos::getParameter<int>(params, "Recycled Blocks");
418
419 TEUCHOS_TEST_FOR_EXCEPTION(nb <= 0, std::invalid_argument, "Belos::GCRODRIter() was passed a non-positive argument for \"Num Blocks\".");
420 TEUCHOS_TEST_FOR_EXCEPTION(rb >= nb, std::invalid_argument, "Belos::GCRODRIter() the number of recycled blocks is larger than the allowable subspace.");
421
422 numBlocks_ = nb;
423 recycledBlocks_ = rb;
424 cs_.resize( numBlocks_+1 );
425 sn_.resize( numBlocks_+1 );
426 z_ = DMT::Create( numBlocks_+1, 1, false );
427 R_ = DMT::Create( numBlocks_+1, numBlocks_, false );
428
429 }
430
432 // Get the current update from this subspace.
433 template<class ScalarType, class MV, class OP, class DM>
435 //
436 // If this is the first iteration of the Arnoldi factorization,
437 // there is no update, so return Teuchos::null.
438 //
439 Teuchos::RCP<MV> currentUpdate = Teuchos::null;
440 if (curDim_==0) {
441 return currentUpdate;
442 } else {
443 const ScalarType one = Teuchos::ScalarTraits<ScalarType>::one();
444 const ScalarType zero = Teuchos::ScalarTraits<ScalarType>::zero();
445 Teuchos::BLAS<int,ScalarType> blas;
446 currentUpdate = MVT::Clone( *V_, 1 );
447 //
448 // Make a view and then copy the RHS of the least squares problem. DON'T OVERWRITE IT!
449 //
450 Teuchos::RCP<DM> y = DMT::SubviewCopy(*z_, curDim_, 1);
451 DMT::SyncDeviceToHost( *y );
452 DMT::SyncDeviceToHost( *R_ );
453 //
454 // Solve the least squares problem.
455 //
456 blas.TRSM( Teuchos::LEFT_SIDE, Teuchos::UPPER_TRI, Teuchos::NO_TRANS,
457 Teuchos::NON_UNIT_DIAG, curDim_, 1, one,
458 DMT::GetConstRawHostPtr(*R_), DMT::GetStride(*R_),
459 DMT::GetRawHostPtr(*y), DMT::GetStride(*y) );
460 //
461 // Compute the current update from the Krylov basis; V(:,1:curDim_)*y.
462 //
463 std::vector<int> index(curDim_);
464 for ( int i=0; i<curDim_; i++ ) index[i] = i;
465 Teuchos::RCP<const MV> Vjp1 = MVT::CloneView( *V_, index );
466 MVT::MvTimesMatAddMv( one, *Vjp1, *y, zero, *currentUpdate );
467 //
468 // Add in portion of update from recycled subspace U; U(:,1:recycledBlocks_)*B*y.
469 //
470 if (U_ != Teuchos::null) {
471 Teuchos::RCP<DM> z = DMT::Create( recycledBlocks_, 1 );
472 DMT::SyncDeviceToHost( *H2_ );
473 blas.GEMM( Teuchos::NO_TRANS, Teuchos::NO_TRANS, recycledBlocks_, 1, curDim_, one,
474 DMT::GetConstRawHostPtr(*B_), DMT::GetStride(*B_),
475 DMT::GetConstRawHostPtr(*y), DMT::GetStride(*y),
476 zero, DMT::GetRawHostPtr(*z), DMT::GetStride(*z));
477 DMT::SyncHostToDevice( *z );
478 MVT::MvTimesMatAddMv( -one, *U_, *z, one, *currentUpdate );
479 }
480 }
481 std::vector<MagnitudeType> normUpdate( 1 );
482 MVT::MvNorm( *currentUpdate, normUpdate );
483
484 return currentUpdate;
485 }
486
487
489 // Get the native residuals stored in this iteration.
490 // Note: This method does not return a MultiVector of the residual vectors, only return Teuchos::null
491 template<class ScalarType, class MV, class OP, class DM>
492 Teuchos::RCP<const MV> GCRODRIter<ScalarType,MV,OP,DM>::getNativeResiduals( std::vector<MagnitudeType> *norms ) const {
493 //
494 // NOTE: Make sure the incoming std::vector is the correct size!
495 //
496 if ( norms && (int)norms->size()==0 )
497 norms->resize( 1 );
498
499 if (norms) {
500 DMT::SyncDeviceToHost( *z_ );
501 const ScalarType curNativeResid = DMT::ValueConst(*z_,curDim_,0);
502 (*norms)[0] = SCT::magnitude (curNativeResid);
503 }
504 return Teuchos::null;
505 }
506
507
508
510 // Initialize this iteration object
511 template<class ScalarType, class MV, class OP, class DM>
513
514 if (newstate.V != Teuchos::null && newstate.H2 != Teuchos::null) {
515 curDim_ = newstate.curDim;
516 V_ = newstate.V;
517 U_ = newstate.U;
518 C_ = newstate.C;
519 H2_ = newstate.H2;
520 // There is no recycled space, so this iteration is creating the first one.
521 if (newstate.U == Teuchos::null) {
522 ptrH00_ = recycledBlocks_+1;
523 H_ = DMT::Subview( *H2_, numBlocks_+1, numBlocks_, ptrH00_, ptrH00_ );
524 B_ = Teuchos::null;
525 }
526 else {
527 ptrH00_ = recycledBlocks_;
528 H_ = DMT::Subview( *H2_, numBlocks_+1, numBlocks_, ptrH00_, ptrH00_ );
529 B_ = DMT::Subview( *H2_, recycledBlocks_, numBlocks_, 0, ptrH00_ );
530 }
531 }
532 else {
533 TEUCHOS_TEST_FOR_EXCEPTION(newstate.V == Teuchos::null,std::invalid_argument,"Belos::GCRODRIter::initialize(): GCRODRIterState does not have V initialized.");
534 TEUCHOS_TEST_FOR_EXCEPTION(newstate.H2 == Teuchos::null,std::invalid_argument,"Belos::GCRODRIter::initialize(): GCRODRIterState does not have H2 initialized.");
535 }
536
537 // the solver is initialized
538 initialized_ = true;
539
540 }
541
542
544 // Iterate until the status test informs us we should stop.
545 template<class ScalarType, class MV, class OP, class DM>
547
548 TEUCHOS_TEST_FOR_EXCEPTION( initialized_ == false, GCRODRIterInitFailure,"Belos::GCRODRIter::iterate(): GCRODRIter class not initialized." );
549
550 // Force call to setsize to ensure internal storage is correct dimension
551 setSize( recycledBlocks_, numBlocks_ );
552
553 Teuchos::RCP<MV> Vnext;
554 Teuchos::RCP<const MV> Vprev;
555 std::vector<int> curind(1);
556
557 // z_ must be zeroed out in order to compute Givens rotations correctly
558 DMT::PutScalar(*z_);
559
560 // Orthonormalize the new V_0
561 curind[0] = 0;
562 Vnext = MVT::CloneViewNonConst(*V_,curind);
563 // Orthonormalize first column
564 // First, get a view of the first element of z_ to hold the orthonormalization coefficients
565 Teuchos::RCP<DM> z0 = DMT::Subview( *z_, 1, 1 );
566 int rank = ortho_->normalize( *Vnext, z0 );
567 TEUCHOS_TEST_FOR_EXCEPTION(rank != 1,GCRODRIterOrthoFailure, "Belos::GCRODRIter::iterate(): couldn't generate basis of full rank.");
568
569 std::vector<int> prevind(numBlocks_+1);
570
572 // iterate until the status test tells us to stop.
573 //
574 // also break if our basis is full
575 //
576 if (U_ == Teuchos::null) { // iterate without recycle space (because none is available yet)
577 while (stest_->checkStatus(this) != Passed && curDim_+1 <= numBlocks_) {
578 iter_++;
579 int lclDim = curDim_ + 1;
580
581 // Get next index in basis
582 curind[0] = lclDim;
583 Vnext = MVT::CloneViewNonConst(*V_,curind);
584
585 // Get previous index in basis
586 curind[0] = curDim_;
587 Vprev = MVT::CloneView(*V_,curind);
588
589 // Compute the next vector in the Krylov basis: Vnext = Op*Vprev
590 lp_->apply(*Vprev,*Vnext);
591
592 // Remove all previous Krylov basis vectors from Vnext and put coefficients in H and R.
593
594 // Get a view of all the previous vectors
595 prevind.resize(lclDim);
596 for (int i=0; i<lclDim; i++) { prevind[i] = i; }
597 Vprev = MVT::CloneView(*V_,prevind);
598 Teuchos::Array<Teuchos::RCP<const MV> > AVprev(1, Vprev);
599
600 // Get a view of the part of the Hessenberg matrix needed to hold the ortho coeffs.
601 Teuchos::RCP<DM> subH = DMT::Subview(*H2_, lclDim, 1, ptrH00_, ptrH00_+curDim_);
602 Teuchos::Array<Teuchos::RCP<DM> > AsubH( 1, subH );
603
604 // Get a view of the part of the Hessenberg matrix needed to hold the norm coeffs.
605 Teuchos::RCP<DM> subR = DMT::Subview(*H2_, 1, 1, ptrH00_+lclDim, ptrH00_+curDim_);
606
607 // Project out the previous Krylov vectors and normalize the next vector.
608 rank = ortho_->projectAndNormalize(*Vnext, AsubH, subR, AVprev);
609
610 // Copy over the coefficients to R just in case we run into an error.
611 Teuchos::RCP<DM> subR2 = DMT::Subview(*R_, lclDim+1, 1, 0, curDim_);
612 Teuchos::RCP<const DM> subH2 = DMT::SubviewConst(*H2_, lclDim+1, 1, ptrH00_, ptrH00_+curDim_);
613 DMT::Assign(*subR2, *subH2);
614 subR2 = Teuchos::null;
615
616 TEUCHOS_TEST_FOR_EXCEPTION(rank != 1,GCRODRIterOrthoFailure, "Belos::GCRODRIter::iterate(): couldn't generate basis of full rank.");
617
618 // Update the QR factorization of the upper Hessenberg matrix
619 updateLSQR();
620
621 // Update basis dim
622 curDim_++;
623 } // end while (statusTest == false)
624 }
625 else { // iterate with recycle space
626 while (stest_->checkStatus(this) != Passed && curDim_+1 <= numBlocks_) {
627 iter_++;
628 int lclDim = curDim_ + 1;
629
630 // Get the current part of the basis.
631 curind[0] = lclDim;
632 Vnext = MVT::CloneViewNonConst(*V_,curind);
633
634 // Get a view of the previous vectors.
635 // This is used for orthogonalization and for computing V^H K H
636 curind[0] = curDim_;
637 Vprev = MVT::CloneView(*V_,curind);
638
639 // Compute the next std::vector in the Krylov basis: Vnext = Op*Vprev
640 lp_->apply(*Vprev,*Vnext);
641 Vprev = Teuchos::null;
642
643 DMT::SyncHostToDevice(*H2_);
644
645 // First, remove the recycled subspace (C) from Vnext and put coefficients in B.
646 Teuchos::Array<Teuchos::RCP<const MV> > C(1, C_);
647 Teuchos::RCP<DM> subB = DMT::Subview(*H2_, recycledBlocks_, 1, 0, ptrH00_+curDim_);
648 Teuchos::RCP<DM> tmpB = DMT::Create(recycledBlocks_, 1);
649 Teuchos::Array<Teuchos::RCP<DM> > AsubB( 1, subB );
650
651 // Project out the recycled subspace.
652 ortho_->project( *Vnext, AsubB, C );
653
654 // Now, remove all previous Krylov basis vectors from Vnext and put coefficients in H and R.
655 // Get a view of all the previous vectors
656 prevind.resize(lclDim);
657 for (int i=0; i<lclDim; i++) { prevind[i] = i; }
658 Vprev = MVT::CloneView(*V_,prevind);
659 Teuchos::Array<Teuchos::RCP<const MV> > AVprev(1, Vprev);
660
661 // Get a view of the part of the Hessenberg matrix needed to hold the ortho coeffs.
662 Teuchos::RCP<DM> subH = DMT::Subview(*H2_, lclDim, 1, ptrH00_, ptrH00_+curDim_);
663 Teuchos::Array<Teuchos::RCP<DM> > AsubH(1, subH);
664
665 // Get a view of the part of the Hessenberg matrix needed to hold the norm coeffs.
666 Teuchos::RCP<DM> subR = DMT::Subview(*H2_, 1, 1, ptrH00_+lclDim, ptrH00_+curDim_);
667
668 // Project out the previous Krylov vectors and normalize the next vector.
669 rank = ortho_->projectAndNormalize(*Vnext, AsubH, subR, AVprev);
670
671 // Copy over the coefficients to R just in case we run into an error.
672 Teuchos::RCP<DM> subR2 = DMT::Subview(*R_, lclDim+1, 1, 0, curDim_);
673 Teuchos::RCP<const DM> subH2 = DMT::SubviewConst(*H2_, lclDim+1, 1, ptrH00_, ptrH00_+curDim_);
674 DMT::Assign(*subR2, *subH2);
675 subR2 = Teuchos::null;
676
677 TEUCHOS_TEST_FOR_EXCEPTION(rank != 1,GCRODRIterOrthoFailure, "Belos::GCRODRIter::iterate(): couldn't generate basis of full rank.");
678
679 // Update the QR factorization of the upper Hessenberg matrix
680 updateLSQR();
681
682 // Update basis dim
683 curDim_++;
684
685 } // end while (statusTest == false)
686 } // end if (U_ == Teuchos::null)
687
688 }
689
690
691 template<class ScalarType, class MV, class OP, class DM>
693
694 int i;
695 const ScalarType zero = Teuchos::ScalarTraits<ScalarType>::zero();
696
697 // Get correct dimension based on input "dim"
698 // Remember that ortho failures result in an exit before updateLSQR() is called.
699 // Therefore, it is possible that dim == curDim_.
700 int curDim = curDim_;
701 if ( (dim >= curDim_) && (dim < getMaxSubspaceDim()) )
702 curDim = dim;
703
704 Teuchos::BLAS<int, ScalarType> blas;
705 //
706 // Apply previous transformations and compute new transformation to reduce upper-Hessenberg
707 // system to upper-triangular form.
708 //
709 // QR factorization of Least-Squares system with Givens rotations
710 //
711 DMT::SyncDeviceToHost(*R_);
712 DMT::SyncDeviceToHost(*z_);
713 //
714 for (i=0; i<curDim; i++) {
715 //
716 // Apply previous Givens rotations to new column of Hessenberg matrix
717 //
718 blas.ROT( 1, &(DMT::Value(*R_,i,curDim)), 1, &(DMT::Value(*R_,i+1, curDim)), 1, &cs_[i], &sn_[i] );
719
720 }
721 //
722 // Calculate new Givens rotation
723 //
724 blas.ROTG( &(DMT::Value(*R_,curDim,curDim)), &(DMT::Value(*R_,curDim+1,curDim)), &cs_[curDim], &sn_[curDim] );
725 DMT::Value(*R_,curDim+1,curDim) = zero;
726 //
727 // Update RHS w/ new transformation
728 //
729 blas.ROT( 1, &(DMT::Value(*z_,curDim,0)), 1, &(DMT::Value(*z_,curDim+1,0)), 1, &cs_[curDim], &sn_[curDim] );
730 //
731 DMT::SyncHostToDevice(*R_);
732 DMT::SyncHostToDevice(*z_);
733 //
734 } // end updateLSQR()
735
736} // end Belos namespace
737
738#endif /* BELOS_GCRODR_ITER_HPP */
Belos header file which uses auto-configuration information to include necessary C++ headers.
Common interface for GCRODR-like iteration classes.
Class which describes the linear problem to be solved by the iterative solver.
Templated virtual class for providing orthogonalization/orthonormalization methods with matrix-based ...
Declaration of basic traits for the multivector type.
Class which defines basic traits for the operator type.
Class which manages the output and verbosity of the Belos solvers.
Pure virtual base class for defining the status testing capabilities of Belos.
Collection of types and exceptions used within the Belos solvers.
Parent class to all Belos exceptions.
This class implements the GCRODR iteration, where a single-vector Krylov subspace is constructed....
Teuchos::ScalarTraits< ScalarType > SCT
int getCurSubspaceDim() const
Get the dimension of the search subspace used to generate the current solution to the linear problem.
int getNumBlocks() const
Get the maximum number of blocks used by the iterative solver in solving this linear problem.
GCRODRIter(const Teuchos::RCP< LinearProblem< ScalarType, MV, OP, DM > > &problem, const Teuchos::RCP< OutputManager< ScalarType > > &printer, const Teuchos::RCP< StatusTest< ScalarType, MV, OP, DM > > &tester, const Teuchos::RCP< MatOrthoManager< ScalarType, MV, OP, DM > > &ortho, Teuchos::ParameterList &params)
GCRODRIter constructor with linear problem, solver utilities, and parameter list of solver options.
GCRODRIterState< ScalarType, MV, DM > getState() const
Get the current state of the linear solver.
SCT::magnitudeType MagnitudeType
Teuchos::RCP< MV > getCurrentUpdate() const
Get the current update to the linear system.
void setNumBlocks(int numBlocks)
Set the maximum number of blocks used by the iterative solver.
void setBlockSize(int blockSize)
Set the blocksize.
const LinearProblem< ScalarType, MV, OP, DM > & getProblem() const
Get a constant reference to the linear problem.
void setSize(int recycledBlocks, int numBlocks)
Set the maximum number of blocks used by the iterative solver and the number of recycled vectors.
int getMaxSubspaceDim() const
Get the maximum dimension allocated for the search subspace.
MultiVecTraits< ScalarType, MV, DM > MVT
bool isInitialized()
States whether the solver has been initialized or not.
DenseMatTraits< ScalarType, DM > DMT
int getBlockSize() const
Get the blocksize to be used by the iterative solver in solving this linear problem.
virtual ~GCRODRIter()
Destructor.
void iterate()
This method performs block Gmres iterations until the status test indicates the need to stop or an er...
Teuchos::RCP< const MV > getNativeResiduals(std::vector< MagnitudeType > *norms) const
Get the norms of the residuals native to the solver.
void updateLSQR(int dim=-1)
Method for updating QR factorization of upper Hessenberg matrix.
void initialize()
Initialize the solver with empty data. Calling this method will result in error, as GCRODRIter must b...
int getNumIters() const
Get the current iteration count.
void resetNumIters(int iter=0)
Reset the iteration count.
OperatorTraits< ScalarType, MV, OP > OPT
GCRODRIterInitFailure is thrown when the GCRODRIter object is unable to generate an initial iterate i...
GCRODRIterInitFailure(const std::string &what_arg)
GCRODRIterOrthoFailure is thrown when the GCRODRIter object is unable to compute independent directio...
GCRODRIterOrthoFailure(const std::string &what_arg)
Common base interface for GCRODRIter and FGCRODRIter.
Alternative run-time polymorphic interface for operators.
Operator()
Default constructor (does nothing).
Structure to contain pointers to GCRODRIter state variables.
Teuchos::RCP< DM > H
The current Hessenberg matrix.
Teuchos::RCP< DM > H2
The global projection matrix including Krylov subpace and recycled subspace.
Teuchos::RCP< DM > B
The projection of the Krylov subspace against the recycled subspace.
int curDim
The current dimension of the reduction.
Teuchos::RCP< MV > V
The current Krylov basis.
Teuchos::RCP< MV > U
The recycled subspace and its projection.
Teuchos::RCP< MV > Z
Optional flexible correction basis. Used by FGCRODRIter.

Generated for Belos by doxygen 1.9.8