Belos Version of the Day
Loading...
Searching...
No Matches
BelosStatusTestGenResSubNorm.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_STATUS_TEST_GEN_RESSUBNORM_H
11#define BELOS_STATUS_TEST_GEN_RESSUBNORM_H
12
22
23#ifdef HAVE_BELOS_THYRA
24#include <Thyra_MultiVectorBase.hpp>
25#include <Thyra_MultiVectorStdOps.hpp>
26#include <Thyra_ProductMultiVectorBase.hpp>
27#endif
28
37namespace Belos {
38
39template <class ScalarType, class MV, class OP, class DM = DefaultDenseMatrix<int,ScalarType>>
40class StatusTestGenResSubNorm: public StatusTestResNorm<ScalarType,MV,OP,DM> {
41
42 public:
43 // Convenience typedefs
44 typedef Teuchos::ScalarTraits<ScalarType> SCT;
45 typedef typename SCT::magnitudeType MagnitudeType;
47
49
50
64 StatusTestGenResSubNorm( MagnitudeType /* Tolerance */, size_t /* subIdx */, int /* quorum */ = -1, bool /* showMaxResNormOnly */ = false ) {
66 "StatusTestGenResSubNorm::StatusTestGenResSubNorm(): StatusTestGenResSubNorm only available for blocked operators (e.g., Thyra).");
67 }
68
72
74
75
77
83 int defineResForm( NormType /* TypeOfNorm */) {
85 "StatusTestGenResSubNorm::defineResForm(): StatusTestGenResSubNorm only available for blocked operators (e.g., Thyra).");
87 }
88
90
110 int defineScaleForm( ScaleType /* TypeOfScaling */, NormType /* TypeOfNorm */, MagnitudeType /* ScaleValue */ = Teuchos::ScalarTraits<MagnitudeType>::one()) {
112 "StatusTestGenResSubNorm::defineScaleForm(): StatusTestGenResSubNorm only available for blocked operators (e.g., Thyra).");
114 }
115
117
120 int setTolerance(MagnitudeType /* tolerance */) { return 0; }
121
123
125 int setSubIdx ( size_t subIdx ) { return 0;}
126
129 int setQuorum(int /* quorum */) { return 0; }
130
132 int setShowMaxResNormOnly(bool /* showMaxResNormOnly */) { return 0; }
133
135
137
138
146
150
152
153
155 void reset() { }
156
158
160
161
163 void print(std::ostream& /* os */, int /* indent */ = 0) const { }
164
166 void printStatus(std::ostream& /* os */, StatusType /* type */) const { }
168
170
171
175 Teuchos::RCP<MV> getSolution() { return Teuchos::null; }
176
179 int getQuorum() const { return -1; }
180
182 size_t getSubIdx() const { return 0; }
183
185 bool getShowMaxResNormOnly() { return false; }
186
188 std::vector<int> convIndices() { return std::vector<int>(0); }
189
191 MagnitudeType getTolerance() const {return SCT::magnitude(SCT::zero());};
192
194 const std::vector<MagnitudeType>* getTestValue() const {return NULL;};
195
197 const std::vector<MagnitudeType>* getResNormValue() const {return NULL;};
198
200 const std::vector<MagnitudeType>* getScaledNormValue() const {return NULL;};
201
204 bool getLOADetected() const { return false; }
205
207
208
211
221
224
226 std::string description() const
227 { return std::string(""); }
229};
230
231#ifdef HAVE_BELOS_THYRA
232
233// specialization for Thyra
234template <class ScalarType>
235class StatusTestGenResSubNorm<ScalarType,Thyra::MultiVectorBase<ScalarType>,Thyra::LinearOpBase<ScalarType>,DefaultDenseMatrix<int,ScalarType> >
236 : public StatusTestResNorm<ScalarType,Thyra::MultiVectorBase<ScalarType>,Thyra::LinearOpBase<ScalarType>,DefaultDenseMatrix<int,ScalarType> > {
237
238 public:
239 // Convenience typedefs
240 typedef Thyra::MultiVectorBase<ScalarType> MV;
241 typedef Thyra::LinearOpBase<ScalarType> OP;
242 typedef DefaultDenseMatrix<int,ScalarType> DM;
243
244 typedef Teuchos::ScalarTraits<ScalarType> SCT;
245 typedef typename SCT::magnitudeType MagnitudeType;
246 typedef MultiVecTraits<ScalarType,MV,DM> MVT;
247 typedef OperatorTraits<ScalarType,MV,OP> OT;
248
250
251
264 StatusTestGenResSubNorm( MagnitudeType Tolerance, size_t subIdx, int quorum = -1, bool showMaxResNormOnly = false )
265 : tolerance_(Tolerance),
266 subIdx_(subIdx),
267 quorum_(quorum),
268 showMaxResNormOnly_(showMaxResNormOnly),
269 resnormtype_(TwoNorm),
270 scaletype_(NormOfInitRes),
271 scalenormtype_(TwoNorm),
272 scalevalue_(Teuchos::ScalarTraits<MagnitudeType>::one ()),
273 status_(Undefined),
274 curBlksz_(0),
275 curNumRHS_(0),
276 curLSNum_(0),
277 numrhs_(0),
278 firstcallCheckStatus_(true),
279 firstcallDefineResForm_(true),
280 firstcallDefineScaleForm_(true) { }
281
283 virtual ~StatusTestGenResSubNorm() { };
285
287
288
290
296 int defineResForm(NormType TypeOfNorm) {
297 TEUCHOS_TEST_FOR_EXCEPTION(firstcallDefineResForm_==false,StatusTestError,
298 "StatusTestGenResSubNorm::defineResForm(): The residual form has already been defined.");
299 firstcallDefineResForm_ = false;
300
301 resnormtype_ = TypeOfNorm;
302
303 return(0);
304 }
305
307
327 int defineScaleForm( ScaleType TypeOfScaling, NormType TypeOfNorm, MagnitudeType ScaleValue = Teuchos::ScalarTraits<MagnitudeType>::one()) {
328 TEUCHOS_TEST_FOR_EXCEPTION(firstcallDefineScaleForm_==false,StatusTestError,
329 "StatusTestGenResSubNorm::defineScaleForm(): The scaling type has already been defined.");
330 firstcallDefineScaleForm_ = false;
331
332 scaletype_ = TypeOfScaling;
333 scalenormtype_ = TypeOfNorm;
334 scalevalue_ = ScaleValue;
335
336 return(0);
337 }
338
340
343 int setTolerance(MagnitudeType tolerance) {tolerance_ = tolerance; return(0);}
344
346
348 int setSubIdx ( size_t subIdx ) { subIdx_ = subIdx; return(0);}
349
352 int setQuorum(int quorum) {quorum_ = quorum; return(0);}
353
355 int setShowMaxResNormOnly(bool showMaxResNormOnly) {showMaxResNormOnly_ = showMaxResNormOnly; return(0);}
356
358
360
361
368 StatusType checkStatus(Iteration<ScalarType,MV,OP,DM>* iSolver) {
369 MagnitudeType zero = Teuchos::ScalarTraits<MagnitudeType>::zero();
370 const LinearProblem<ScalarType,MV,OP,DM>& lp = iSolver->getProblem();
371 // Compute scaling term (done once for each block that's being solved)
372 if (firstcallCheckStatus_) {
373 StatusType status = firstCallCheckStatusSetup(iSolver);
374 if(status==Failed) {
375 status_ = Failed;
376 return(status_);
377 }
378 }
379
380 //
381 // This section computes the norm of the residual vector
382 //
383 if ( curLSNum_ != lp.getLSNumber() ) {
384 //
385 // We have moved on to the next rhs block
386 //
387 curLSNum_ = lp.getLSNumber();
388 curLSIdx_ = lp.getLSIndex();
389 curBlksz_ = (int)curLSIdx_.size();
390 int validLS = 0;
391 for (int i=0; i<curBlksz_; ++i) {
392 if (curLSIdx_[i] > -1 && curLSIdx_[i] < numrhs_)
393 validLS++;
394 }
395 curNumRHS_ = validLS;
396 curSoln_ = Teuchos::null;
397 //
398 } else {
399 //
400 // We are in the same rhs block, return if we are converged
401 //
402 if (status_==Passed) { return status_; }
403 }
404
405 //
406 // Request the true residual for this block of right-hand sides.
407 //
408 Teuchos::RCP<MV> cur_update = iSolver->getCurrentUpdate();
409 curSoln_ = lp.updateSolution( cur_update );
410 Teuchos::RCP<MV> cur_res = MVT::Clone( *curSoln_, MVT::GetNumberVecs( *curSoln_ ) );
411 lp.computeCurrResVec( &*cur_res, &*curSoln_ );
412 std::vector<MagnitudeType> tmp_resvector( MVT::GetNumberVecs( *cur_res ) );
413 MvSubNorm( *cur_res, subIdx_, tmp_resvector, resnormtype_ );
414
415 typename std::vector<int>::iterator pp = curLSIdx_.begin();
416 for (int i=0; pp<curLSIdx_.end(); ++pp, ++i) {
417 // Check if this index is valid
418 if (*pp != -1)
419 resvector_[*pp] = tmp_resvector[i];
420 }
421
422 //
423 // Compute the new linear system residuals for testing.
424 // (if any of them don't meet the tolerance or are NaN, then we exit with that status)
425 //
426 if ( scalevector_.size() > 0 ) {
427 typename std::vector<int>::iterator p = curLSIdx_.begin();
428 for (; p<curLSIdx_.end(); ++p) {
429 // Check if this index is valid
430 if (*p != -1) {
431 // Scale the std::vector accordingly
432 if ( scalevector_[ *p ] != zero ) {
433 // Don't intentionally divide by zero.
434 testvector_[ *p ] = resvector_[ *p ] / scalevector_[ *p ] / scalevalue_;
435 } else {
436 testvector_[ *p ] = resvector_[ *p ] / scalevalue_;
437 }
438 }
439 }
440 }
441 else {
442 typename std::vector<int>::iterator ppp = curLSIdx_.begin();
443 for (; ppp<curLSIdx_.end(); ++ppp) {
444 // Check if this index is valid
445 if (*ppp != -1)
446 testvector_[ *ppp ] = resvector_[ *ppp ] / scalevalue_;
447 }
448 }
449 // Check status of new linear system residuals and see if we have the quorum.
450 int have = 0;
451 ind_.resize( curLSIdx_.size() );
452 typename std::vector<int>::iterator p2 = curLSIdx_.begin();
453 for (; p2<curLSIdx_.end(); ++p2) {
454 // Check if this index is valid
455 if (*p2 != -1) {
456 // Check if any of the residuals are larger than the tolerance.
457 if (testvector_[ *p2 ] > tolerance_) {
458 // do nothing.
459 } else if (testvector_[ *p2 ] <= tolerance_) {
460 ind_[have] = *p2;
461 have++;
462 } else {
463 // Throw an std::exception if a NaN is found.
464 status_ = Failed;
465 TEUCHOS_TEST_FOR_EXCEPTION(true,StatusTestNaNError,"StatusTestGenResSubNorm::checkStatus(): NaN has been detected.");
466 }
467 }
468 }
469 ind_.resize(have);
470 int need = (quorum_ == -1) ? curNumRHS_: quorum_;
471 status_ = (have >= need) ? Passed : Failed;
472 // Return the current status
473 return status_;
474 }
475
477 StatusType getStatus() const {return(status_);};
479
481
482
484 void reset() {
485 status_ = Undefined;
486 curBlksz_ = 0;
487 curLSNum_ = 0;
488 curLSIdx_.resize(0);
489 numrhs_ = 0;
490 ind_.resize(0);
491 firstcallCheckStatus_ = true;
492 curSoln_ = Teuchos::null;
493 }
494
496
498
499
501 void print(std::ostream& os, int indent = 0) const {
502 os.setf(std::ios_base::scientific);
503 for (int j = 0; j < indent; j ++)
504 os << ' ';
505 printStatus(os, status_);
506 os << resFormStr();
507 if (status_==Undefined)
508 os << ", tol = " << tolerance_ << std::endl;
509 else {
510 os << std::endl;
511 if(showMaxResNormOnly_ && curBlksz_ > 1) {
512 const MagnitudeType maxRelRes = *std::max_element(
513 testvector_.begin()+curLSIdx_[0],testvector_.begin()+curLSIdx_[curBlksz_-1]
514 );
515 for (int j = 0; j < indent + 13; j ++)
516 os << ' ';
517 os << "max{residual["<<curLSIdx_[0]<<"..."<<curLSIdx_[curBlksz_-1]<<"]} = " << maxRelRes
518 << ( maxRelRes <= tolerance_ ? " <= " : " > " ) << tolerance_ << std::endl;
519 }
520 else {
521 for ( int i=0; i<numrhs_; i++ ) {
522 for (int j = 0; j < indent + 13; j ++)
523 os << ' ';
524 os << "residual [ " << i << " ] = " << testvector_[ i ];
525 os << ((testvector_[i]<tolerance_) ? " < " : (testvector_[i]==tolerance_) ? " == " : (testvector_[i]>tolerance_) ? " > " : " " ) << tolerance_ << std::endl;
526 }
527 }
528 }
529 os << std::endl;
530 }
531
533 void printStatus(std::ostream& os, StatusType type) const {
534 os << std::left << std::setw(13) << std::setfill('.');
535 switch (type) {
536 case Passed:
537 os << "Converged";
538 break;
539 case Failed:
540 os << "Unconverged";
541 break;
542 case Undefined:
543 default:
544 os << "**";
545 break;
546 }
547 os << std::left << std::setfill(' ');
548 return;
549 }
551
553
554
556 Teuchos::RCP<MV> getSolution() { return curSoln_; }
557
560 int getQuorum() const { return quorum_; }
561
563 size_t getSubIdx() const { return subIdx_; }
564
566 bool getShowMaxResNormOnly() { return showMaxResNormOnly_; }
567
569 std::vector<int> convIndices() { return ind_; }
570
572 MagnitudeType getTolerance() const {return(tolerance_);};
573
575 const std::vector<MagnitudeType>* getTestValue() const {return(&testvector_);};
576
578 const std::vector<MagnitudeType>* getResNormValue() const {return(&resvector_);};
579
581 const std::vector<MagnitudeType>* getScaledNormValue() const {return(&scalevector_);};
582
585 bool getLOADetected() const { return false; }
586
588
589
592
598 StatusType firstCallCheckStatusSetup(Iteration<ScalarType,MV,OP,DM>* iSolver) {
599 int i;
600 MagnitudeType zero = Teuchos::ScalarTraits<MagnitudeType>::zero();
601 MagnitudeType one = Teuchos::ScalarTraits<MagnitudeType>::one();
602 const LinearProblem<ScalarType,MV,OP,DM>& lp = iSolver->getProblem();
603 // Compute scaling term (done once for each block that's being solved)
604 if (firstcallCheckStatus_) {
605 //
606 // Get some current solver information.
607 //
608 firstcallCheckStatus_ = false;
609
610 if (scaletype_== NormOfRHS) {
611 Teuchos::RCP<const MV> rhs = lp.getRHS();
612 numrhs_ = MVT::GetNumberVecs( *rhs );
613 scalevector_.resize( numrhs_ );
614 MvSubNorm( *rhs, subIdx_, scalevector_, scalenormtype_ );
615 }
616 else if (scaletype_==NormOfInitRes) {
617 Teuchos::RCP<const MV> init_res = lp.getInitResVec();
618 numrhs_ = MVT::GetNumberVecs( *init_res );
619 scalevector_.resize( numrhs_ );
620 MvSubNorm( *init_res, subIdx_, scalevector_, scalenormtype_ );
621 }
622 else if (scaletype_==NormOfPrecInitRes) {
623 Teuchos::RCP<const MV> init_res = lp.getInitPrecResVec();
624 numrhs_ = MVT::GetNumberVecs( *init_res );
625 scalevector_.resize( numrhs_ );
626 MvSubNorm( *init_res, subIdx_, scalevector_, scalenormtype_ );
627 }
628 else if (scaletype_==NormOfFullInitRes) {
629 Teuchos::RCP<const MV> init_res = lp.getInitResVec();
630 numrhs_ = MVT::GetNumberVecs( *init_res );
631 scalevector_.resize( numrhs_ );
632 MVT::MvNorm( *init_res, scalevector_, scalenormtype_ );
633 scalevalue_ = Teuchos::ScalarTraits<MagnitudeType>::one();
634 }
635 else if (scaletype_==NormOfFullPrecInitRes) {
636 Teuchos::RCP<const MV> init_res = lp.getInitPrecResVec();
637 numrhs_ = MVT::GetNumberVecs( *init_res );
638 scalevector_.resize( numrhs_ );
639 MVT::MvNorm( *init_res, scalevector_, scalenormtype_ );
640 scalevalue_ = Teuchos::ScalarTraits<MagnitudeType>::one();
641 }
642 else if (scaletype_==NormOfFullScaledInitRes) {
643 Teuchos::RCP<const MV> init_res = lp.getInitResVec();
644 numrhs_ = MVT::GetNumberVecs( *init_res );
645 scalevector_.resize( numrhs_ );
646 MVT::MvNorm( *init_res, scalevector_, scalenormtype_ );
647 MvScalingRatio( *init_res, subIdx_, scalevalue_ );
648 }
649 else if (scaletype_==NormOfFullScaledPrecInitRes) {
650 Teuchos::RCP<const MV> init_res = lp.getInitPrecResVec();
651 numrhs_ = MVT::GetNumberVecs( *init_res );
652 scalevector_.resize( numrhs_ );
653 MVT::MvNorm( *init_res, scalevector_, scalenormtype_ );
654 MvScalingRatio( *init_res, subIdx_, scalevalue_ );
655 }
656 else {
657 numrhs_ = MVT::GetNumberVecs( *(lp.getRHS()) );
658 }
659
660 resvector_.resize( numrhs_ );
661 testvector_.resize( numrhs_ );
662
663 curLSNum_ = lp.getLSNumber();
664 curLSIdx_ = lp.getLSIndex();
665 curBlksz_ = (int)curLSIdx_.size();
666 int validLS = 0;
667 for (i=0; i<curBlksz_; ++i) {
668 if (curLSIdx_[i] > -1 && curLSIdx_[i] < numrhs_)
669 validLS++;
670 }
671 curNumRHS_ = validLS;
672 //
673 // Initialize the testvector.
674 for (i=0; i<numrhs_; i++) { testvector_[i] = one; }
675
676 // Return an error if the scaling is zero.
677 if (scalevalue_ == zero) {
678 return Failed;
679 }
680 }
681 return Undefined;
682 }
684
687
689 std::string description() const
690 {
691 std::ostringstream oss;
692 oss << "Belos::StatusTestGenResSubNorm<>: " << resFormStr();
693 oss << ", tol = " << tolerance_;
694 return oss.str();
695 }
697
698 protected:
699
700 private:
701
703
704
705 std::string resFormStr() const
706 {
707 std::ostringstream oss;
708 oss << "(";
709 oss << ((resnormtype_==OneNorm) ? "1-Norm" : (resnormtype_==TwoNorm) ? "2-Norm" : "Inf-Norm");
710 oss << " Exp";
711 oss << " Res Vec [" << subIdx_ << "]) ";
712
713 // If there is no residual scaling, return current string.
714 if (scaletype_!=None)
715 {
716 // Insert division sign.
717 oss << "/ ";
718
719 // Determine output string for scaling, if there is any.
720 if (scaletype_==UserProvided)
721 oss << " (User Scale)";
722 else {
723 oss << "(";
724 oss << ((scalenormtype_==OneNorm) ? "1-Norm" : (resnormtype_==TwoNorm) ? "2-Norm" : "Inf-Norm");
725 if (scaletype_==NormOfInitRes)
726 oss << " Res0 [" << subIdx_ << "]";
727 else if (scaletype_==NormOfPrecInitRes)
728 oss << " Prec Res0 [" << subIdx_ << "]";
729 else if (scaletype_==NormOfFullInitRes)
730 oss << " Full Res0 [" << subIdx_ << "]";
731 else if (scaletype_==NormOfFullPrecInitRes)
732 oss << " Full Prec Res0 [" << subIdx_ << "]";
733 else if (scaletype_==NormOfFullScaledInitRes)
734 oss << " scaled Full Res0 [" << subIdx_ << "]";
735 else if (scaletype_==NormOfFullScaledPrecInitRes)
736 oss << " scaled Full Prec Res0 [" << subIdx_ << "]";
737 else
738 oss << " RHS [" << subIdx_ << "]";
739 oss << ")";
740 }
741 }
742
743 // TODO add a tagging name
744
745 return oss.str();
746 }
747
749
751
752
753 // calculate norm of partial multivector
754 void MvSubNorm( const MV& mv, size_t block, std::vector<typename Teuchos::ScalarTraits<ScalarType>::magnitudeType>& normVec, NormType type = TwoNorm) {
755 Teuchos::RCP<const MV> input = Teuchos::rcpFromRef(mv);
756
757 typedef typename Thyra::ProductMultiVectorBase<ScalarType> TPMVB;
758 Teuchos::RCP<const TPMVB> thyProdVec = Teuchos::rcp_dynamic_cast<const TPMVB>(input);
759
760 TEUCHOS_TEST_FOR_EXCEPTION(thyProdVec == Teuchos::null, std::invalid_argument,
761 "Belos::StatusTestGenResSubNorm::MvSubNorm (Thyra specialization): "
762 "mv must be a Thyra::ProductMultiVector, but is of type " << thyProdVec);
763
764 Teuchos::RCP<const MV> thySubVec = thyProdVec->getMultiVectorBlock(block);
765
766 MVT::MvNorm(*thySubVec,normVec,type);
767 }
768
769 // calculate ration of sub-vector length to full vector length (for scalevalue_)
770 void MvScalingRatio( const MV& mv, size_t block, MagnitudeType& lengthRatio) {
771 Teuchos::RCP<const MV> input = Teuchos::rcpFromRef(mv);
772
773 typedef typename Thyra::ProductMultiVectorBase<ScalarType> TPMVB;
774 Teuchos::RCP<const TPMVB> thyProdVec = Teuchos::rcp_dynamic_cast<const TPMVB>(input);
775
776 TEUCHOS_TEST_FOR_EXCEPTION(thyProdVec == Teuchos::null, std::invalid_argument,
777 "Belos::StatusTestGenResSubNorm::MvScalingRatio (Thyra specialization): "
778 "mv must be a Thyra::ProductMultiVector, but is of type " << thyProdVec);
779
780 Teuchos::RCP<const MV> thySubVec = thyProdVec->getMultiVectorBlock(block);
781
782 lengthRatio = Teuchos::as<MagnitudeType>(thySubVec->range()->dim()) / Teuchos::as<MagnitudeType>(thyProdVec->range()->dim());
783 }
784
786
788
789
791 MagnitudeType tolerance_;
792
794 size_t subIdx_;
795
797 int quorum_;
798
800 bool showMaxResNormOnly_;
801
803 NormType resnormtype_;
804
806 ScaleType scaletype_;
807
809 NormType scalenormtype_;
810
812 MagnitudeType scalevalue_;
813
815 std::vector<MagnitudeType> scalevector_;
816
818 std::vector<MagnitudeType> resvector_;
819
821 std::vector<MagnitudeType> testvector_;
822
824 std::vector<int> ind_;
825
827 Teuchos::RCP<MV> curSoln_;
828
830 StatusType status_;
831
833 int curBlksz_;
834
836 int curNumRHS_;
837
839 std::vector<int> curLSIdx_;
840
842 int curLSNum_;
843
845 int numrhs_;
846
848 bool firstcallCheckStatus_;
849
851 bool firstcallDefineResForm_;
852
854 bool firstcallDefineScaleForm_;
855
857
858};
859
860#endif // HAVE_BELOS_THYRA
861
862} // end namespace Belos
863
864#endif /* BELOS_STATUS_TEST_RESSUBNORM_H */
Class which describes the linear problem to be solved by the iterative solver.
Declaration of basic traits for the multivector type.
Class which defines basic traits for the operator type.
Belos::StatusTest abstract class for specifying a residual norm stopping criteria.
Alternative run-time polymorphic interface for operators.
Exception thrown to signal error in a status test during Belos::StatusTest::checkStatus().
An implementation of StatusTestResNorm using a family of norms of subvectors of the residual vectors.
int setTolerance(MagnitudeType)
Set the value of the tolerance.
int setQuorum(int)
Sets the number of residuals that must pass the convergence test before Passed is returned.
Teuchos::RCP< MV > getSolution()
Returns the current solution estimate that was computed for the most recent residual test.
const std::vector< MagnitudeType > * getScaledNormValue() const
Returns the scaled norm value, .
StatusType checkStatus(Iteration< ScalarType, MV, OP, DM > *)
Check convergence status: Passed, Failed, or Undefined.
StatusType firstCallCheckStatusSetup(Iteration< ScalarType, MV, OP, DM > *iSolver)
Call to setup initial scaling vector.
int getQuorum() const
Returns the number of residuals that must pass the convergence test before Passed is returned.
int defineResForm(NormType)
Define norm of the residual.
size_t getSubIdx() const
Returns the index of the block row the norms are calculated for.
void reset()
Resets the internal configuration to the initial state.
bool getShowMaxResNormOnly()
Returns whether the only maximum residual norm is displayed when the print() method is called.
StatusTestGenResSubNorm(MagnitudeType, size_t, int=-1, bool=false)
Constructor.
StatusType getStatus() const
Return the result of the most recent CheckStatus call.
bool getLOADetected() const
Returns a boolean indicating a loss of accuracy has been detected in computing the residual.
Teuchos::ScalarTraits< ScalarType > SCT
void print(std::ostream &, int=0) const
Output formatted description of stopping test to output stream.
int defineScaleForm(ScaleType, NormType, MagnitudeType=Teuchos::ScalarTraits< MagnitudeType >::one())
Define form of the scaling, its norm, its optional weighting vector, or, alternatively,...
MultiVecTraits< ScalarType, MV, DM > MVT
std::vector< int > convIndices()
Returns the std::vector containing the indices of the residuals that passed the test.
void printStatus(std::ostream &, StatusType) const
Print message for each status specific to this stopping test.
const std::vector< MagnitudeType > * getTestValue() const
Returns the test value, , computed in most recent call to CheckStatus.
std::string description() const
Method to return description of the maximum iteration status test
const std::vector< MagnitudeType > * getResNormValue() const
Returns the residual norm value, , computed in most recent call to CheckStatus.
MagnitudeType getTolerance() const
Returns the value of the tolerance, , set in the constructor.
int setShowMaxResNormOnly(bool)
Set whether the only maximum residual norm is displayed when the print() method is called.
int setSubIdx(size_t subIdx)
Set the block index of which we want to check the norm of the sub-residuals.
An abstract class of StatusTest for stopping criteria using residual norms.
NormType
The type of vector norm to compute.
StatusType
Whether the StatusTest wants iteration to stop.
Teuchos::SerialDenseMatrix< Ordinal, Scalar > DefaultDenseMatrix
ScaleType
The type of scaling to use on the residual norm value.
@ UserProvided
@ NormOfFullInitRes
@ NormOfFullPrecInitRes
@ NormOfFullScaledPrecInitRes
@ NormOfFullScaledInitRes
@ NormOfPrecInitRes
@ NormOfInitRes
@ NormOfRHS

Generated for Belos by doxygen 1.9.8