15#ifndef BELOS_DGKS_ORTHOMANAGER_HPP
16#define BELOS_DGKS_ORTHOMANAGER_HPP
33#include "Teuchos_as.hpp"
34#ifdef BELOS_TEUCHOS_TIME_MONITOR
35#include "Teuchos_TimeMonitor.hpp"
41 template<
class ScalarType,
class MV,
class OP,
class DM = DefaultDenseMatrix<
int,ScalarType>>
45 template<
class ScalarType,
class MV,
class OP,
class DM = DefaultDenseMatrix<
int,ScalarType>>
48 template<
class ScalarType,
class MV,
class OP,
class DM = DefaultDenseMatrix<
int,ScalarType>>
53 typedef typename Teuchos::ScalarTraits<ScalarType>::magnitudeType MagnitudeType;
54 typedef typename Teuchos::ScalarTraits<MagnitudeType> MGT;
55 typedef Teuchos::ScalarTraits<ScalarType> SCT;
66 Teuchos::RCP<const OP>
Op = Teuchos::null,
78#ifdef BELOS_TEUCHOS_TIME_MONITOR
80 ss << label_ +
": DGKS[" << max_blk_ortho_ <<
"]";
82 std::string
orthoLabel =
ss.str() +
": Orthogonalization";
88 std::string
normLabel =
ss.str() +
": Ortho (Norm)";
91 std::string
ipLabel =
ss.str() +
": Ortho (Inner Product)";
98 const std::string&
label =
"Belos",
99 Teuchos::RCP<const OP>
Op = Teuchos::null)
109#ifdef BELOS_TEUCHOS_TIME_MONITOR
110 std::stringstream
ss;
111 ss << label_ +
": DGKS[" << max_blk_ortho_ <<
"]";
113 std::string
orthoLabel =
ss.str() +
": Orthogonalization";
119 std::string
normLabel =
ss.str() +
": Ortho (Norm)";
122 std::string
ipLabel =
ss.str() +
": Ortho (Inner Product)";
137 using Teuchos::ParameterList;
138 using Teuchos::parameterList;
143 if (
plist.is_null()) {
157 const MagnitudeType
blkTol =
params->get<MagnitudeType> (
"blkTol");
158 const MagnitudeType
depTol =
params->get<MagnitudeType> (
"depTol");
159 const MagnitudeType
singTol =
params->get<MagnitudeType> (
"singTol");
169 Teuchos::RCP<const Teuchos::ParameterList>
172 if (defaultParams_.is_null()) {
176 return defaultParams_;
187 Teuchos::RCP<Teuchos::ParameterList>
params = this->getNonconstParameterList();
201 Teuchos::RCP<Teuchos::ParameterList>
params = this->getNonconstParameterList();
211 Teuchos::RCP<Teuchos::ParameterList>
params = this->getNonconstParameterList();
261 Teuchos::Array<Teuchos::RCP<DM>> C,
262 Teuchos::ArrayView<Teuchos::RCP<const MV>>
Q)
const;
268 Teuchos::Array<Teuchos::RCP<DM>> C,
269 Teuchos::ArrayView<Teuchos::RCP<const MV>>
Q)
const {
299 Teuchos::RCP<DM> B)
const;
368 Teuchos::Array<Teuchos::RCP<DM> > C,
370 Teuchos::ArrayView<Teuchos::RCP<const MV> >
Q)
const;
382 typename Teuchos::ScalarTraits<ScalarType>::magnitudeType
393 typename Teuchos::ScalarTraits<ScalarType>::magnitudeType
399 typename Teuchos::ScalarTraits<ScalarType>::magnitudeType
408 typename Teuchos::ScalarTraits<ScalarType>::magnitudeType
422 const std::string&
getLabel()
const {
return label_; }
454 MagnitudeType blk_tol_;
456 MagnitudeType dep_tol_;
458 MagnitudeType sing_tol_;
462#ifdef BELOS_TEUCHOS_TIME_MONITOR
467 mutable Teuchos::RCP<Teuchos::ParameterList> defaultParams_;
470 int findBasis(MV &
X, Teuchos::RCP<MV>
MX,
475 bool blkOrtho1 ( MV &
X, Teuchos::RCP<MV>
MX,
476 Teuchos::Array<Teuchos::RCP<DM>> C,
477 Teuchos::ArrayView<Teuchos::RCP<const MV> >
Q)
const;
480 bool blkOrtho ( MV &
X, Teuchos::RCP<MV>
MX,
481 Teuchos::Array<Teuchos::RCP<DM>> C,
482 Teuchos::ArrayView<Teuchos::RCP<const MV> >
Q)
const;
497 int blkOrthoSing ( MV &
X, Teuchos::RCP<MV>
MX,
498 Teuchos::Array<Teuchos::RCP<DM> > C,
500 Teuchos::ArrayView<Teuchos::RCP<const MV> >
QQ)
const;
504 template<
class ScalarType,
class MV,
class OP,
class DM>
507 template<
class ScalarType,
class MV,
class OP,
class DM>
508 const typename DGKSOrthoManager<ScalarType,MV,OP,DM>::MagnitudeType
510 = 10*Teuchos::ScalarTraits<typename DGKSOrthoManager<ScalarType,MV,OP,DM>::MagnitudeType>::squareroot(
511 Teuchos::ScalarTraits<
typename DGKSOrthoManager<ScalarType,MV,OP,DM>::MagnitudeType>::eps() );
513 template<
class ScalarType,
class MV,
class OP,
class DM>
514 const typename DGKSOrthoManager<ScalarType,MV,OP,DM>::MagnitudeType
516 = Teuchos::ScalarTraits<typename DGKSOrthoManager<ScalarType,MV,OP,DM>::MagnitudeType>::one()
517 / Teuchos::ScalarTraits<typename DGKSOrthoManager<ScalarType,MV,OP,DM>::MagnitudeType>::squareroot(
518 2*Teuchos::ScalarTraits<
typename DGKSOrthoManager<ScalarType,MV,OP,DM>::MagnitudeType>::one() );
520 template<
class ScalarType,
class MV,
class OP,
class DM>
521 const typename DGKSOrthoManager<ScalarType,MV,OP,DM>::MagnitudeType
523 = 10*Teuchos::ScalarTraits<typename DGKSOrthoManager<ScalarType,MV,OP,DM>::MagnitudeType>::eps();
525 template<
class ScalarType,
class MV,
class OP,
class DM>
528 template<
class ScalarType,
class MV,
class OP,
class DM>
529 const typename DGKSOrthoManager<ScalarType,MV,OP,DM>::MagnitudeType
531 = Teuchos::ScalarTraits<typename DGKSOrthoManager<ScalarType,MV,OP,DM>::MagnitudeType>::zero();
533 template<
class ScalarType,
class MV,
class OP,
class DM>
534 const typename DGKSOrthoManager<ScalarType,MV,OP,DM>::MagnitudeType
536 = Teuchos::ScalarTraits<typename DGKSOrthoManager<ScalarType,MV,OP,DM>::MagnitudeType>::zero();
538 template<
class ScalarType,
class MV,
class OP,
class DM>
539 const typename DGKSOrthoManager<ScalarType,MV,OP,DM>::MagnitudeType
541 = Teuchos::ScalarTraits<typename DGKSOrthoManager<ScalarType,MV,OP,DM>::MagnitudeType>::zero();
545 template<
class ScalarType,
class MV,
class OP,
class DM>
548 if (
label != label_) {
550#ifdef BELOS_TEUCHOS_TIME_MONITOR
551 std::stringstream
ss;
552 ss << label_ +
": DGKS[" << max_blk_ortho_ <<
"]";
554 std::string
orthoLabel =
ss.str() +
": Orthogonalization";
560 std::string
normLabel =
ss.str() +
": Ortho (Norm)";
563 std::string
ipLabel =
ss.str() +
": Ortho (Inner Product)";
571 template<
class ScalarType,
class MV,
class OP,
class DM>
572 typename Teuchos::ScalarTraits<ScalarType>::magnitudeType
575 int rank = MVT::GetNumberVecs(
X);
578#ifdef BELOS_TEUCHOS_TIME_MONITOR
583 DMT::SyncDeviceToHost(*
xTx);
587 DMT::SyncHostToDevice(*
xTx);
588 return DMT::NormFrobenius(*
xTx);
593 template<
class ScalarType,
class MV,
class OP,
class DM>
594 typename Teuchos::ScalarTraits<ScalarType>::magnitudeType
596 int r1 = MVT::GetNumberVecs(
X1);
597 int r2 = MVT::GetNumberVecs(
X2);
598 Teuchos::RCP<DM>
xTx = DMT::Create(
r2,
r1);
600#ifdef BELOS_TEUCHOS_TIME_MONITOR
605 return DMT::NormFrobenius(*
xTx);
610 template<
class ScalarType,
class MV,
class OP,
class DM>
615 Teuchos::Array<Teuchos::RCP<DM> > C,
617 Teuchos::ArrayView<Teuchos::RCP<const MV> >
Q)
const
619 using Teuchos::Array;
621 using Teuchos::is_null;
626#ifdef BELOS_TEUCHOS_TIME_MONITOR
631 const MagnitudeType
ZERO = SCT::magnitude(SCT::zero());
634 int xc = MVT::GetNumberVecs(
X );
642 B = DMT::Create(
xc,
xc);
652 for (size_type
k = 0;
k <
nq; ++
k)
654 const int numRows = MVT::GetNumberVecs (*
Q[
k]);
660 else if (DMT::GetNumRows(*C[
k]) !=
numRows || DMT::GetNumCols(*C[
k]) !=
numCols) {
667 if (
MX == Teuchos::null) {
669 MX = MVT::Clone(
X,MVT::GetNumberVecs(
X));
670 OPT::Apply(*(this->_Op),
X,*
MX);
675 MX = Teuchos::rcp( &
X,
false );
678 int mxc = MVT::GetNumberVecs( *
MX );
685 for (
int i=0;
i<
nq;
i++) {
686 numbas += MVT::GetNumberVecs( *
Q[
i] );
691 "Belos::DGKSOrthoManager::projectAndNormalize(): Size of X must be consistant with size of B" );
694 "Belos::DGKSOrthoManager::projectAndNormalize(): MVT returned negative dimensions for X,MX" );
697 "Belos::DGKSOrthoManager::projectAndNormalize(): Size of X must be consistant with size of MX" );
712 if ( B == Teuchos::null ) {
713 B = DMT::Create(
xc,
xc);
715 std::vector<ScalarType>
dot(1);
717#ifdef BELOS_TEUCHOS_TIME_MONITOR
720 MVT::MvDot(
X, *
MX,
dot );
724 Teuchos::RCP<DM>
B00 = DMT::Subview(*B,1,1);
740 tmpX = MVT::CloneCopy(
X);
754 MVT::Assign( *
tmpX,
X );
761 rank = findBasis(
X,
MX, B,
false );
768 MVT::Assign( *
tmpX,
X );
778 "Belos::DGKSOrthoManager::projectAndNormalize(): Debug error in rank variable." );
788 template<
class ScalarType,
class MV,
class OP,
class DM>
790 MV &
X, Teuchos::RCP<MV>
MX,
791 Teuchos::RCP<DM> B )
const {
793#ifdef BELOS_TEUCHOS_TIME_MONITOR
798 return findBasis(
X,
MX, B,
true);
805 template<
class ScalarType,
class MV,
class OP,
class DM>
807 MV &
X, Teuchos::RCP<MV>
MX,
808 Teuchos::Array<Teuchos::RCP<DM> > C,
809 Teuchos::ArrayView<Teuchos::RCP<const MV> >
Q)
const {
825#ifdef BELOS_TEUCHOS_TIME_MONITOR
829 int xc = MVT::GetNumberVecs(
X );
832 std::vector<int>
qcs(
nq);
834 if (
nq == 0 ||
xc == 0 ||
xr == 0) {
846 if (
MX == Teuchos::null) {
848 MX = MVT::Clone(
X,MVT::GetNumberVecs(
X));
849 OPT::Apply(*(this->_Op),
X,*
MX);
854 MX = Teuchos::rcp( &
X,
false );
856 int mxc = MVT::GetNumberVecs( *
MX );
861 "Belos::DGKSOrthoManager::project(): MVT returned negative dimensions for X,MX" );
864 "Belos::DGKSOrthoManager::project(): Size of X not consistant with MX,Q" );
867 for (
int i=0;
i<
nq;
i++) {
869 "Belos::DGKSOrthoManager::project(): Q lengths not mutually consistant" );
870 qcs[
i] = MVT::GetNumberVecs( *
Q[
i] );
872 "Belos::DGKSOrthoManager::project(): Q has less rows than columns" );
875 if ( C[
i] == Teuchos::null ) {
880 "Belos::DGKSOrthoManager::project(): Size of Q not consistant with size of C" );
885 blkOrtho(
X,
MX, C,
Q );
892 template<
class ScalarType,
class MV,
class OP,
class DM>
913 const MagnitudeType
ZERO = SCT::magnitude(SCT::zero());
915 int xc = MVT::GetNumberVecs(
X );
929 if (
MX == Teuchos::null) {
931 MX = MVT::Clone(
X,
xc);
932 OPT::Apply(*(this->_Op),
X,*
MX);
939 if ( B == Teuchos::null ) {
940 B = DMT::Create(
xc,
xc);
943 int mxc = (this->_hasOp) ? MVT::GetNumberVecs( *
MX ) :
xc;
948 "Belos::DGKSOrthoManager::findBasis(): X must be non-empty" );
950 "Belos::DGKSOrthoManager::findBasis(): Size of X not consistant with size of B" );
952 "Belos::DGKSOrthoManager::findBasis(): Size of X not consistant with size of MX" );
954 "Belos::DGKSOrthoManager::findBasis(): Size of X not feasible for normalization" );
956 "Belos::DGKSOrthoManager::findBasis(): Invalid howMany parameter" );
972 std::vector<int> index(1);
974 Teuchos::RCP<MV>
Xj = MVT::CloneViewNonConst(
X, index );
975 Teuchos::RCP<MV>
MXj;
976 if ((this->_hasOp)) {
978 MXj = MVT::CloneViewNonConst( *
MX, index );
1009#ifdef BELOS_TEUCHOS_TIME_MONITOR
1016 "Belos::DGKSOrthoManager::findBasis(): Negative definiteness discovered in inner product" );
1023#ifdef BELOS_TEUCHOS_TIME_MONITOR
1031#ifdef BELOS_TEUCHOS_TIME_MONITOR
1042#ifdef BELOS_TEUCHOS_TIME_MONITOR
1050#ifdef BELOS_TEUCHOS_TIME_MONITOR
1057 if ( MGT::squareroot(SCT::magnitude(
newDot[0])) < dep_tol_*MGT::squareroot(SCT::magnitude(
oldDot[0])) ) {
1060 Teuchos::RCP<DM>
P2 = DMT::Create(
numX,1);
1062#ifdef BELOS_TEUCHOS_TIME_MONITOR
1070#ifdef BELOS_TEUCHOS_TIME_MONITOR
1075 if ((this->_hasOp)) {
1076#ifdef BELOS_TEUCHOS_TIME_MONITOR
1087#ifdef BELOS_TEUCHOS_TIME_MONITOR
1101 if ( SCT::magnitude(
newDot[0]) < SCT::magnitude(sing_tol_*
oldDot[0]) ) {
1106 std::cout <<
"Belos::DGKSOrthoManager::findBasis() --> Random for column " <<
numX << std::endl;
1109 Teuchos::RCP<MV>
tempXj = MVT::Clone(
X, 1 );
1111 MVT::MvRandom( *
tempXj );
1120#ifdef BELOS_TEUCHOS_TIME_MONITOR
1128#ifdef BELOS_TEUCHOS_TIME_MONITOR
1134#ifdef BELOS_TEUCHOS_TIME_MONITOR
1140#ifdef BELOS_TEUCHOS_TIME_MONITOR
1148#ifdef BELOS_TEUCHOS_TIME_MONITOR
1154 if ( SCT::magnitude(
newDot[0]) >= SCT::magnitude(
oldDot[0]*sing_tol_) ) {
1170 if ( SCT::magnitude(
newDot[0]) < SCT::magnitude(
oldDot[0]*blk_tol_) ) {
1189 Teuchos::RCP<DM>
Bjj = DMT::Subview(*B,1,1,
j,
j);
1199 Teuchos::RCP<DM>
Bcolj = DMT::Subview(*B,
numX,1,0,
j);
1209 template<
class ScalarType,
class MV,
class OP,
class DM>
1211 DGKSOrthoManager<ScalarType, MV, OP, DM>::blkOrtho1 ( MV &X, Teuchos::RCP<MV> MX,
1212 Teuchos::Array<Teuchos::RCP<DM> > C,
1213 Teuchos::ArrayView<Teuchos::RCP<const MV> > Q)
const
1216 int xc = MVT::GetNumberVecs(
X );
1219 std::vector<int>
qcs(
nq );
1220 for (
int i=0;
i<
nq;
i++) {
1221 qcs[
i] = MVT::GetNumberVecs( *
Q[
i] );
1227#ifdef BELOS_TEUCHOS_TIME_MONITOR
1233 Teuchos::Array<Teuchos::RCP<MV> >
MQ(
nq);
1235 for (
int i=0;
i<
nq;
i++) {
1238#ifdef BELOS_TEUCHOS_TIME_MONITOR
1245#ifdef BELOS_TEUCHOS_TIME_MONITOR
1248 MVT::MvTimesMatAddMv( -
ONE, *
Q[
i], *C[
i],
ONE,
X );
1254 OPT::Apply( *(this->_Op),
X, *
MX);
1259 OPT::Apply( *(this->_Op), *
Q[
i], *
MQ[
i] );
1261#ifdef BELOS_TEUCHOS_TIME_MONITOR
1271#ifdef BELOS_TEUCHOS_TIME_MONITOR
1288 if ( MGT::squareroot(SCT::magnitude(
newDot[0])) < dep_tol_*MGT::squareroot(SCT::magnitude(
oldDot[0])) ) {
1291 for (
int i=0;
i<
nq;
i++) {
1292 Teuchos::RCP<DM>
C2 = DMT::Create(DMT::GetNumRows(*C[
i]),DMT::GetNumCols(*C[
i]));
1296#ifdef BELOS_TEUCHOS_TIME_MONITOR
1301 DMT::Add(*C[
i],*
C2);
1304#ifdef BELOS_TEUCHOS_TIME_MONITOR
1313#ifdef BELOS_TEUCHOS_TIME_MONITOR
1321 OPT::Apply( *(this->_Op),
X, *
MX);
1332 template<
class ScalarType,
class MV,
class OP,
class DM>
1334 DGKSOrthoManager<ScalarType, MV, OP, DM>::blkOrtho ( MV &X, Teuchos::RCP<MV> MX,
1335 Teuchos::Array<Teuchos::RCP<DM> > C,
1336 Teuchos::ArrayView<Teuchos::RCP<const MV> > Q)
const
1339 int xc = MVT::GetNumberVecs(
X );
1343 std::vector<int>
qcs(
nq );
1344 for (
int i=0;
i<
nq;
i++) {
1345 qcs[
i] = MVT::GetNumberVecs( *
Q[
i] );
1351 std::vector<ScalarType>
oldDot(
xc );
1353#ifdef BELOS_TEUCHOS_TIME_MONITOR
1359 Teuchos::Array<Teuchos::RCP<MV> >
MQ(
nq);
1361 for (
int i=0;
i<
nq;
i++) {
1364#ifdef BELOS_TEUCHOS_TIME_MONITOR
1371#ifdef BELOS_TEUCHOS_TIME_MONITOR
1374 MVT::MvTimesMatAddMv( -
ONE, *
Q[
i], *C[
i],
ONE,
X );
1380 OPT::Apply( *(this->_Op),
X, *
MX);
1385 OPT::Apply( *(this->_Op), *
Q[
i], *
MQ[
i] );
1387#ifdef BELOS_TEUCHOS_TIME_MONITOR
1397 for (
int j = 1;
j < max_blk_ortho_; ++
j) {
1399 for (
int i=0;
i<
nq;
i++) {
1400 Teuchos::RCP<DM>
C2 = DMT::Create(DMT::GetNumRows(*C[
i]),DMT::GetNumCols(*C[
i]));
1404#ifdef BELOS_TEUCHOS_TIME_MONITOR
1409 DMT::Add(*C[
i],*
C2);
1412#ifdef BELOS_TEUCHOS_TIME_MONITOR
1421#ifdef BELOS_TEUCHOS_TIME_MONITOR
1429 OPT::Apply( *(this->_Op),
X, *
MX);
1436 std::vector<ScalarType>
newDot(
xc);
1438#ifdef BELOS_TEUCHOS_TIME_MONITOR
1445 for (
int i=0;
i<
xc;
i++){
1446 if (SCT::magnitude(
newDot[
i]) < SCT::magnitude(
oldDot[
i] * blk_tol_)) {
1456 template<
class ScalarType,
class MV,
class OP,
class DM>
1458 DGKSOrthoManager<ScalarType, MV, OP, DM>::blkOrthoSing ( MV &X, Teuchos::RCP<MV> MX,
1459 Teuchos::Array<Teuchos::RCP<DM> > C,
1461 Teuchos::ArrayView<Teuchos::RCP<const MV> > QQ)
const
1463 Teuchos::Array<Teuchos::RCP<const MV> >
Q (
QQ);
1469 int xc = MVT::GetNumberVecs(
X );
1470 std::vector<int>
indX( 1 );
1473 std::vector<int>
qcs(
nq );
1474 for (
int i=0;
i<
nq;
i++) {
1475 qcs[
i] = MVT::GetNumberVecs( *
Q[
i] );
1479 Teuchos::RCP<const MV>
lastQ;
1480 Teuchos::RCP<MV>
Xj,
MXj;
1481 Teuchos::RCP<DM>
lastC = DMT::Create();
1484 for (
int j=0;
j<
xc;
j++) {
1490 std::vector<int> index(
j );
1494 lastQ = MVT::CloneView(
X, index );
1499 qcs.push_back( MVT::GetNumberVecs( *
lastQ ) );
1504 Xj = MVT::CloneViewNonConst(
X,
indX );
1506 MXj = MVT::CloneViewNonConst( *
MX,
indX );
1514#ifdef BELOS_TEUCHOS_TIME_MONITOR
1520 Teuchos::Array<Teuchos::RCP<MV> >
MQ(
Q.size());
1522 for (
int i=0;
i<
Q.size();
i++) {
1525 Teuchos::RCP<DM>
tempC = DMT::Subview(*C[
i],
qcs[
i], 1, 0,
j);
1529#ifdef BELOS_TEUCHOS_TIME_MONITOR
1536#ifdef BELOS_TEUCHOS_TIME_MONITOR
1545 OPT::Apply( *(this->_Op), *
Xj, *
MXj);
1550 OPT::Apply( *(this->_Op), *
Q[
i], *
MQ[
i] );
1552#ifdef BELOS_TEUCHOS_TIME_MONITOR
1563#ifdef BELOS_TEUCHOS_TIME_MONITOR
1572 if ( SCT::magnitude(
newDot[0]) < SCT::magnitude(
oldDot[0]*dep_tol_) ) {
1574 for (
int i=0;
i<
Q.size();
i++) {
1575 Teuchos::RCP<DM>
tempC = DMT::Subview(*C[
i],
qcs[
i], 1, 0,
j);
1576 Teuchos::RCP<DM>
C2 = DMT::Create(
qcs[
i],1);
1580#ifdef BELOS_TEUCHOS_TIME_MONITOR
1587#ifdef BELOS_TEUCHOS_TIME_MONITOR
1596#ifdef BELOS_TEUCHOS_TIME_MONITOR
1604 OPT::Apply( *(this->_Op), *
Xj, *
MXj);
1611#ifdef BELOS_TEUCHOS_TIME_MONITOR
1619 if (SCT::magnitude(
newDot[0]) < SCT::magnitude(
oldDot[0]*sing_tol_)) {
1634 Teuchos::RCP<DM>
Bjj = DMT::Subview(*B,1,1,
j,
j);
1639 Teuchos::RCP<MV>
tempXj = MVT::Clone(
X, 1 );
1641 MVT::MvRandom( *
tempXj );
1650#ifdef BELOS_TEUCHOS_TIME_MONITOR
1658 for (
int i=0;
i<
Q.size();
i++) {
1659 Teuchos::RCP<DM>
product = DMT::Create(
qcs[
i], 1 );
1663#ifdef BELOS_TEUCHOS_TIME_MONITOR
1669#ifdef BELOS_TEUCHOS_TIME_MONITOR
1678#ifdef BELOS_TEUCHOS_TIME_MONITOR
1695#ifdef BELOS_TEUCHOS_TIME_MONITOR
1702 if ( SCT::magnitude(
newDot[0]) >= SCT::magnitude(
oldDot[0]*sing_tol_) ) {
1706 Teuchos::RCP<DM>
Bjj = DMT::Subview(*B,1,1,
j,
j);
1732 template<
class ScalarType,
class MV,
class OP,
class DM>
1735 using Teuchos::ParameterList;
1736 using Teuchos::parameterList;
1744 "Maximum number of orthogonalization passes (includes the "
1745 "first). Default is 2, since \"twice is enough\" for Krylov "
1748 "Block reorthogonalization threshold.");
1750 "(Non-block) reorthogonalization threshold.");
1752 "Singular block detection threshold.");
1757 template<
class ScalarType,
class MV,
class OP,
class DM>
1760 using Teuchos::ParameterList;
1765 params->set (
"maxNumOrthogPasses",
Belos header file which uses auto-configuration information to include necessary C++ headers.
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.
An implementation of the Belos::MatOrthoManager that performs orthogonalization using (potentially) m...
int normalize(MV &X, Teuchos::RCP< DM > B) const
This method calls normalize(X,Teuchos::null,B); see documentation for that function.
static const MagnitudeType sing_tol_fast_
Singular block detection threshold (fast).
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &plist)
virtual int projectAndNormalizeWithMxImpl(MV &X, Teuchos::RCP< MV > MX, Teuchos::Array< Teuchos::RCP< DM > > C, Teuchos::RCP< DM > B, Teuchos::ArrayView< Teuchos::RCP< const MV > > Q) const
Given a set of bases Q[i] and a multivector X, this method computes an orthonormal basis for .
static const int max_blk_ortho_default_
Max number of (re)orthogonalization steps, including the first (default).
Teuchos::ScalarTraits< ScalarType >::magnitudeType orthogError(const MV &X1, const MV &X2) const
This method computes the error in orthogonality of two multivectors, measured as the Frobenius norm o...
int normalize(MV &X, Teuchos::RCP< MV > MX, Teuchos::RCP< DM > B) const
This method takes a multivector X and attempts to compute an orthonormal basis for ,...
static const MagnitudeType blk_tol_default_
Block reorthogonalization threshold (default).
void project(MV &X, Teuchos::RCP< MV > MX, Teuchos::Array< Teuchos::RCP< DM > > C, Teuchos::ArrayView< Teuchos::RCP< const MV > > Q) const
Given a list of (mutually and internally) orthonormal bases Q, this method takes a multivector X and ...
static const int max_blk_ortho_fast_
Max number of (re)orthogonalization steps, including the first (fast).
MagnitudeType getBlkTol() const
Return parameter for block re-orthogonalization threshhold.
void setLabel(const std::string &label)
This method sets the label used by the timers in the orthogonalization manager.
void setBlkTol(const MagnitudeType blk_tol)
Set parameter for block re-orthogonalization threshhold.
MagnitudeType getDepTol() const
Return parameter for re-orthogonalization threshhold.
~DGKSOrthoManager()
Destructor.
void project(MV &X, Teuchos::Array< Teuchos::RCP< DM > > C, Teuchos::ArrayView< Teuchos::RCP< const MV > > Q) const
This method calls project(X,Teuchos::null,C,Q); see documentation for that function.
static const MagnitudeType dep_tol_fast_
(Non-block) reorthogonalization threshold (fast).
Teuchos::ScalarTraits< ScalarType >::magnitudeType orthonormError(const MV &X) const
This method computes the error in orthonormality of a multivector.
DGKSOrthoManager(const std::string &label="Belos", Teuchos::RCP< const OP > Op=Teuchos::null, const int max_blk_ortho=max_blk_ortho_default_, const MagnitudeType blk_tol=blk_tol_default_, const MagnitudeType dep_tol=dep_tol_default_, const MagnitudeType sing_tol=sing_tol_default_)
Constructor specifying re-orthogonalization tolerance.
static const MagnitudeType blk_tol_fast_
Block reorthogonalization threshold (fast).
void setSingTol(const MagnitudeType sing_tol)
Set parameter for singular block detection.
const std::string & getLabel() const
This method returns the label being used by the timers in the orthogonalization manager.
static const MagnitudeType sing_tol_default_
Singular block detection threshold (default).
MagnitudeType getSingTol() const
Return parameter for singular block detection.
DGKSOrthoManager(const Teuchos::RCP< Teuchos::ParameterList > &plist, const std::string &label="Belos", Teuchos::RCP< const OP > Op=Teuchos::null)
Constructor that takes a list of parameters.
void setDepTol(const MagnitudeType dep_tol)
Set parameter for re-orthogonalization threshhold.
static const MagnitudeType dep_tol_default_
(Non-block) reorthogonalization threshold (default).
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Belos's templated virtual class for providing routines for orthogonalization and orthonormzalition of...
void innerProd(const MV &X, const MV &Y, DM &Z) const
Provides the inner product defining the orthogonality concepts, using the provided operator.
Alternative run-time polymorphic interface for operators.
Operator()
Default constructor (does nothing).
Teuchos::RCP< Teuchos::ParameterList > getDGKSDefaultParameters()
"Default" parameters for robustness and accuracy.
Teuchos::RCP< Teuchos::ParameterList > getDGKSFastParameters()
"Fast" but possibly unsafe or less accurate parameters.