15#ifndef BELOS_IMGS_ORTHOMANAGER_HPP
16#define BELOS_IMGS_ORTHOMANAGER_HPP
31#include "Teuchos_SerialDenseMatrix.hpp"
32#include "Teuchos_SerialDenseVector.hpp"
34#include "Teuchos_as.hpp"
35#ifdef BELOS_TEUCHOS_TIME_MONITOR
36#include "Teuchos_TimeMonitor.hpp"
42 template<
class ScalarType,
class MV,
class OP>
46 template<
class ScalarType,
class MV,
class OP>
49 template<
class ScalarType,
class MV,
class OP>
54 typedef typename Teuchos::ScalarTraits<ScalarType>::magnitudeType MagnitudeType;
55 typedef typename Teuchos::ScalarTraits<MagnitudeType> MGT;
56 typedef Teuchos::ScalarTraits<ScalarType> SCT;
66 Teuchos::RCP<const OP>
Op = Teuchos::null,
76#ifdef BELOS_TEUCHOS_TIME_MONITOR
78 ss << label_ +
": IMGS[" << max_ortho_steps_ <<
"]";
80 std::string
orthoLabel =
ss.str() +
": Orthogonalization";
86 std::string
normLabel =
ss.str() +
": Ortho (Norm)";
89 std::string
ipLabel =
ss.str() +
": Ortho (Inner Product)";
96 const std::string&
label =
"Belos",
97 Teuchos::RCP<const OP>
Op = Teuchos::null) :
106#ifdef BELOS_TEUCHOS_TIME_MONITOR
107 std::stringstream
ss;
108 ss << label_ +
": IMGS[" << max_ortho_steps_ <<
"]";
110 std::string
orthoLabel =
ss.str() +
": Orthogonalization";
116 std::string
normLabel =
ss.str() +
": Ortho (Norm)";
119 std::string
ipLabel =
ss.str() +
": Ortho (Inner Product)";
133 using Teuchos::Exceptions::InvalidParameterName;
134 using Teuchos::ParameterList;
135 using Teuchos::parameterList;
140 if (
plist.is_null()) {
181 params->remove (
"depTol");
202 Teuchos::RCP<const Teuchos::ParameterList>
205 if (defaultParams_.is_null()) {
209 return defaultParams_;
263 Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > > C,
264 Teuchos::ArrayView<Teuchos::RCP<const MV> >
Q)
const;
270 Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > > C,
271 Teuchos::ArrayView<Teuchos::RCP<const MV> >
Q)
const {
302 Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > B)
const;
307 int normalize ( MV &
X, Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > B )
const {
356 Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > > C,
357 Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > B,
358 Teuchos::ArrayView<Teuchos::RCP<const MV> >
Q)
const;
368 typename Teuchos::ScalarTraits<ScalarType>::magnitudeType
377 typename Teuchos::ScalarTraits<ScalarType>::magnitudeType
383 typename Teuchos::ScalarTraits<ScalarType>::magnitudeType
392 typename Teuchos::ScalarTraits<ScalarType>::magnitudeType
406 const std::string&
getLabel()
const {
return label_; }
432 int max_ortho_steps_;
434 MagnitudeType blk_tol_;
436 MagnitudeType sing_tol_;
440#ifdef BELOS_TEUCHOS_TIME_MONITOR
445 mutable Teuchos::RCP<Teuchos::ParameterList> defaultParams_;
448 int findBasis(MV &
X, Teuchos::RCP<MV>
MX,
449 Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > C,
453 bool blkOrtho1 ( MV &
X, Teuchos::RCP<MV>
MX,
454 Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > > C,
455 Teuchos::ArrayView<Teuchos::RCP<const MV> >
Q)
const;
458 bool blkOrtho ( MV &
X, Teuchos::RCP<MV>
MX,
459 Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > > C,
460 Teuchos::ArrayView<Teuchos::RCP<const MV> >
Q)
const;
475 int blkOrthoSing ( MV &
X, Teuchos::RCP<MV>
MX,
476 Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > > C,
477 Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > B,
478 Teuchos::ArrayView<Teuchos::RCP<const MV> >
QQ)
const;
482 template<
class ScalarType,
class MV,
class OP>
485 template<
class ScalarType,
class MV,
class OP>
486 const typename IMGSOrthoManager<ScalarType,MV,OP>::MagnitudeType
488 = 10*Teuchos::ScalarTraits<typename IMGSOrthoManager<ScalarType,MV,OP>::MagnitudeType>::squareroot(
489 Teuchos::ScalarTraits<
typename IMGSOrthoManager<ScalarType,MV,OP>::MagnitudeType>::eps() );
491 template<
class ScalarType,
class MV,
class OP>
492 const typename IMGSOrthoManager<ScalarType,MV,OP>::MagnitudeType
494 = 10*Teuchos::ScalarTraits<typename IMGSOrthoManager<ScalarType,MV,OP>::MagnitudeType>::eps();
496 template<
class ScalarType,
class MV,
class OP>
499 template<
class ScalarType,
class MV,
class OP>
500 const typename IMGSOrthoManager<ScalarType,MV,OP>::MagnitudeType
502 = Teuchos::ScalarTraits<typename IMGSOrthoManager<ScalarType,MV,OP>::MagnitudeType>::zero();
504 template<
class ScalarType,
class MV,
class OP>
505 const typename IMGSOrthoManager<ScalarType,MV,OP>::MagnitudeType
507 = Teuchos::ScalarTraits<typename IMGSOrthoManager<ScalarType,MV,OP>::MagnitudeType>::zero();
511 template<
class ScalarType,
class MV,
class OP>
514 if (
label != label_) {
516#ifdef BELOS_TEUCHOS_TIME_MONITOR
517 std::stringstream
ss;
518 ss << label_ +
": IMGS[" << max_ortho_steps_ <<
"]";
520 std::string
orthoLabel =
ss.str() +
": Orthogonalization";
526 std::string
normLabel =
ss.str() +
": Ortho (Norm)";
529 std::string
ipLabel =
ss.str() +
": Ortho (Inner Product)";
537 template<
class ScalarType,
class MV,
class OP>
538 typename Teuchos::ScalarTraits<ScalarType>::magnitudeType
541 int rank = MVT::GetNumberVecs(
X);
542 Teuchos::SerialDenseMatrix<int,ScalarType>
xTx(
rank,
rank);
547 return xTx.normFrobenius();
552 template<
class ScalarType,
class MV,
class OP>
553 typename Teuchos::ScalarTraits<ScalarType>::magnitudeType
555 int r1 = MVT::GetNumberVecs(
X1);
556 int r2 = MVT::GetNumberVecs(
X2);
557 Teuchos::SerialDenseMatrix<int,ScalarType>
xTx(
r2,
r1);
559 return xTx.normFrobenius();
564 template<
class ScalarType,
class MV,
class OP>
569 Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > > C,
570 Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > B,
571 Teuchos::ArrayView<Teuchos::RCP<const MV> >
Q)
const
573 using Teuchos::Array;
575 using Teuchos::is_null;
578 using Teuchos::SerialDenseMatrix;
582#ifdef BELOS_TEUCHOS_TIME_MONITOR
587 const MagnitudeType
ZERO = MGT::zero();
590 int xc = MVT::GetNumberVecs(
X );
608 for (size_type
k = 0;
k <
nq; ++
k)
610 const int numRows = MVT::GetNumberVecs (*
Q[
k]);
619 "IMGS orthogonalization: failed to reshape "
620 "C[" <<
k <<
"] (the array of block "
621 "coefficients resulting from projecting X "
622 "against Q[1:" <<
nq <<
"]).");
628 if (
MX == Teuchos::null) {
630 MX = MVT::Clone(
X,MVT::GetNumberVecs(
X));
631 OPT::Apply(*(this->_Op),
X,*
MX);
636 MX = Teuchos::rcp( &
X,
false );
639 int mxc = MVT::GetNumberVecs( *
MX );
646 for (
int i=0;
i<
nq;
i++) {
647 numbas += MVT::GetNumberVecs( *
Q[
i] );
652 "Belos::IMGSOrthoManager::projectAndNormalize(): Size of X must be consistant with size of B" );
655 "Belos::IMGSOrthoManager::projectAndNormalize(): MVT returned negative dimensions for X,MX" );
658 "Belos::IMGSOrthoManager::projectAndNormalize(): Size of X must be consistant with size of MX" );
668 tmpX = MVT::CloneCopy(
X);
680 if ( B == Teuchos::null ) {
681 B = Teuchos::rcp(
new Teuchos::SerialDenseMatrix<int,ScalarType>(
xc,
xc) );
683 std::vector<ScalarType>
diag(
xc);
685#ifdef BELOS_TEUCHOS_TIME_MONITOR
690 (*B)(0,0) = SCT::squareroot(SCT::magnitude(
diag[0]));
692 if (SCT::magnitude((*B)(0,0)) >
ZERO) {
694 MVT::MvScale(
X,
ONE/(*B)(0,0) );
697 MVT::MvScale( *
MX,
ONE/(*B)(0,0) );
713 MVT::Assign( *
tmpX,
X );
720 rank = findBasis(
X,
MX, B,
false );
728 MVT::Assign( *
tmpX,
X );
738 "Belos::IMGSOrthoManager::projectAndNormalize(): Debug error in rank variable." );
748 template<
class ScalarType,
class MV,
class OP>
750 MV &
X, Teuchos::RCP<MV>
MX,
751 Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > B )
const {
753#ifdef BELOS_TEUCHOS_TIME_MONITOR
758 return findBasis(
X,
MX, B,
true);
764 template<
class ScalarType,
class MV,
class OP>
766 MV &
X, Teuchos::RCP<MV>
MX,
767 Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > > C,
768 Teuchos::ArrayView<Teuchos::RCP<const MV> >
Q)
const {
784#ifdef BELOS_TEUCHOS_TIME_MONITOR
788 int xc = MVT::GetNumberVecs(
X );
791 std::vector<int>
qcs(
nq);
793 if (
nq == 0 ||
xc == 0 ||
xr == 0) {
805 if (
MX == Teuchos::null) {
807 MX = MVT::Clone(
X,MVT::GetNumberVecs(
X));
808 OPT::Apply(*(this->_Op),
X,*
MX);
813 MX = Teuchos::rcp( &
X,
false );
815 int mxc = MVT::GetNumberVecs( *
MX );
820 "Belos::IMGSOrthoManager::project(): MVT returned negative dimensions for X,MX" );
823 "Belos::IMGSOrthoManager::project(): Size of X not consistant with MX,Q" );
826 for (
int i=0;
i<
nq;
i++) {
828 "Belos::IMGSOrthoManager::project(): Q lengths not mutually consistant" );
829 qcs[
i] = MVT::GetNumberVecs( *
Q[
i] );
831 "Belos::IMGSOrthoManager::project(): Q has less rows than columns" );
834 if ( C[
i] == Teuchos::null ) {
835 C[
i] = Teuchos::rcp(
new Teuchos::SerialDenseMatrix<int,ScalarType>(
qcs[
i],
xc) );
839 "Belos::IMGSOrthoManager::project(): Size of Q not consistant with size of C" );
844 blkOrtho(
X,
MX, C,
Q );
851 template<
class ScalarType,
class MV,
class OP>
853 MV &
X, Teuchos::RCP<MV>
MX,
854 Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > B,
873 const MagnitudeType
ZERO = SCT::magnitude(SCT::zero());
875 int xc = MVT::GetNumberVecs(
X );
889 if (
MX == Teuchos::null) {
891 MX = MVT::Clone(
X,
xc);
892 OPT::Apply(*(this->_Op),
X,*
MX);
899 if ( B == Teuchos::null ) {
900 B = Teuchos::rcp(
new Teuchos::SerialDenseMatrix<int,ScalarType>(
xc,
xc) );
903 int mxc = (this->_hasOp) ? MVT::GetNumberVecs( *
MX ) :
xc;
908 "Belos::IMGSOrthoManager::findBasis(): X must be non-empty" );
910 "Belos::IMGSOrthoManager::findBasis(): Size of X not consistant with size of B" );
912 "Belos::IMGSOrthoManager::findBasis(): Size of X not consistant with size of MX" );
914 "Belos::IMGSOrthoManager::findBasis(): Size of X not feasible for normalization" );
916 "Belos::IMGSOrthoManager::findBasis(): Invalid howMany parameter" );
932 std::vector<int> index(1);
934 Teuchos::RCP<MV>
Xj = MVT::CloneViewNonConst(
X, index );
935 Teuchos::RCP<MV>
MXj;
936 if ((this->_hasOp)) {
938 MXj = MVT::CloneViewNonConst( *
MX, index );
951 Teuchos::SerialDenseVector<int,ScalarType>
product(
numX);
952 Teuchos::SerialDenseVector<int,ScalarType>
P2(1);
960#ifdef BELOS_TEUCHOS_TIME_MONITOR
967 "Belos::IMGSOrthoManager::findBasis(): Negative definiteness discovered in inner product" );
973 prevX = MVT::CloneView(
X, index );
975 prevMX = MVT::CloneView( *
MX, index );
978 for (
int i=0;
i<max_ortho_steps_; ++
i) {
982#ifdef BELOS_TEUCHOS_TIME_MONITOR
991#ifdef BELOS_TEUCHOS_TIME_MONITOR
1002#ifdef BELOS_TEUCHOS_TIME_MONITOR
1020#ifdef BELOS_TEUCHOS_TIME_MONITOR
1034 if ( SCT::magnitude(
newDot[0]) < SCT::magnitude(sing_tol_*
oldDot[0]) ) {
1039 std::cout <<
"Belos::IMGSOrthoManager::findBasis() --> Random for column " <<
numX << std::endl;
1042 Teuchos::RCP<MV>
tempXj = MVT::Clone(
X, 1 );
1044 MVT::MvRandom( *
tempXj );
1053#ifdef BELOS_TEUCHOS_TIME_MONITOR
1063 prevX = MVT::CloneView(
X, index );
1065 prevMX = MVT::CloneView( *
MX, index );
1070#ifdef BELOS_TEUCHOS_TIME_MONITOR
1076#ifdef BELOS_TEUCHOS_TIME_MONITOR
1082#ifdef BELOS_TEUCHOS_TIME_MONITOR
1098#ifdef BELOS_TEUCHOS_TIME_MONITOR
1104 if ( SCT::magnitude(
newDot[0]) >= SCT::magnitude(
oldDot[0]*sing_tol_) ) {
1120 if ( SCT::magnitude(
newDot[0]) < SCT::magnitude(
oldDot[0]*blk_tol_) ) {
1160 template<
class ScalarType,
class MV,
class OP>
1162 IMGSOrthoManager<ScalarType, MV, OP>::blkOrtho1 ( MV &X, Teuchos::RCP<MV> MX,
1163 Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > > C,
1164 Teuchos::ArrayView<Teuchos::RCP<const MV> > Q)
const
1167 int xc = MVT::GetNumberVecs(
X );
1170 std::vector<int>
qcs(
nq );
1171 for (
int i=0;
i<
nq;
i++) {
1172 qcs[
i] = MVT::GetNumberVecs( *
Q[
i] );
1176 std::vector<int> index(1);
1177 Teuchos::RCP<const MV>
tempQ;
1179 Teuchos::Array<Teuchos::RCP<MV> >
MQ(
nq);
1181 for (
int i=0;
i<
nq;
i++) {
1187 tempQ = MVT::CloneView( *
Q[
i], index );
1188 Teuchos::SerialDenseMatrix<int,ScalarType>
tempC( Teuchos::View, *C[
i], 1, 1,
ii, 0 );
1192#ifdef BELOS_TEUCHOS_TIME_MONITOR
1199#ifdef BELOS_TEUCHOS_TIME_MONITOR
1209 OPT::Apply( *(this->_Op),
X, *
MX);
1214 OPT::Apply( *(this->_Op), *
Q[
i], *
MQ[
i] );
1221 for (
int j = 1;
j < max_ortho_steps_; ++
j) {
1223 for (
int i=0;
i<
nq;
i++) {
1225 Teuchos::SerialDenseMatrix<int,ScalarType>
C2(
qcs[
i],1);
1231 tempQ = MVT::CloneView( *
Q[
i], index );
1232 Teuchos::SerialDenseMatrix<int,ScalarType>
tempC( Teuchos::View, *C[
i], 1, 1,
ii, 0 );
1233 Teuchos::SerialDenseMatrix<int,ScalarType>
tempC2( Teuchos::View,
C2, 1, 1,
ii, 0 );
1237#ifdef BELOS_TEUCHOS_TIME_MONITOR
1244#ifdef BELOS_TEUCHOS_TIME_MONITOR
1260 OPT::Apply( *(this->_Op),
X, *
MX);
1271 template<
class ScalarType,
class MV,
class OP>
1273 IMGSOrthoManager<ScalarType, MV, OP>::blkOrtho ( MV &X, Teuchos::RCP<MV> MX,
1274 Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > > C,
1275 Teuchos::ArrayView<Teuchos::RCP<const MV> > Q)
const
1278 int xc = MVT::GetNumberVecs(
X );
1282 std::vector<int>
qcs(
nq );
1283 for (
int i=0;
i<
nq;
i++) {
1284 qcs[
i] = MVT::GetNumberVecs( *
Q[
i] );
1290 std::vector<ScalarType>
oldDot(
xc );
1292#ifdef BELOS_TEUCHOS_TIME_MONITOR
1298 std::vector<int> index(1);
1299 Teuchos::Array<Teuchos::RCP<MV> >
MQ(
nq);
1300 Teuchos::RCP<const MV>
tempQ;
1303 for (
int i=0;
i<
nq;
i++) {
1309 tempQ = MVT::CloneView( *
Q[
i], index );
1310 Teuchos::SerialDenseMatrix<int,ScalarType>
tempC( Teuchos::View, *C[
i], 1,
xc,
ii, 0 );
1314#ifdef BELOS_TEUCHOS_TIME_MONITOR
1321#ifdef BELOS_TEUCHOS_TIME_MONITOR
1331 OPT::Apply( *(this->_Op),
X, *
MX);
1336 OPT::Apply( *(this->_Op), *
Q[
i], *
MQ[
i] );
1343 for (
int j = 1;
j < max_ortho_steps_; ++
j) {
1345 for (
int i=0;
i<
nq;
i++) {
1346 Teuchos::SerialDenseMatrix<int,ScalarType>
C2(
qcs[
i],
xc);
1352 tempQ = MVT::CloneView( *
Q[
i], index );
1353 Teuchos::SerialDenseMatrix<int,ScalarType>
tempC( Teuchos::View, *C[
i], 1,
xc,
ii, 0 );
1354 Teuchos::SerialDenseMatrix<int,ScalarType>
tempC2( Teuchos::View,
C2, 1,
xc,
ii, 0 );
1358#ifdef BELOS_TEUCHOS_TIME_MONITOR
1365#ifdef BELOS_TEUCHOS_TIME_MONITOR
1380 OPT::Apply( *(this->_Op),
X, *
MX);
1387 std::vector<ScalarType>
newDot(
xc);
1389#ifdef BELOS_TEUCHOS_TIME_MONITOR
1396 for (
int i=0;
i<
xc;
i++){
1397 if (SCT::magnitude(
newDot[
i]) < SCT::magnitude(
oldDot[
i] * blk_tol_)) {
1406 template<
class ScalarType,
class MV,
class OP>
1408 IMGSOrthoManager<ScalarType, MV, OP>::blkOrthoSing ( MV &X, Teuchos::RCP<MV> MX,
1409 Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > > C,
1410 Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > B,
1411 Teuchos::ArrayView<Teuchos::RCP<const MV> > QQ)
const
1413 Teuchos::Array<Teuchos::RCP<const MV> >
Q (
QQ);
1419 int xc = MVT::GetNumberVecs(
X );
1420 std::vector<int>
indX( 1 );
1423 std::vector<int>
qcs(
nq );
1424 for (
int i=0;
i<
nq;
i++) {
1425 qcs[
i] = MVT::GetNumberVecs( *
Q[
i] );
1429 Teuchos::RCP<const MV>
lastQ;
1430 Teuchos::RCP<MV>
Xj,
MXj;
1431 Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> >
lastC;
1434 for (
int j=0;
j<
xc;
j++) {
1440 std::vector<int> index(
j );
1444 lastQ = MVT::CloneView(
X, index );
1449 qcs.push_back( MVT::GetNumberVecs( *
lastQ ) );
1454 Xj = MVT::CloneViewNonConst(
X,
indX );
1456 MXj = MVT::CloneViewNonConst( *
MX,
indX );
1464#ifdef BELOS_TEUCHOS_TIME_MONITOR
1470 Teuchos::Array<Teuchos::RCP<MV> >
MQ(
Q.size());
1471 Teuchos::RCP<const MV>
tempQ;
1474 for (
int i=0;
i<
Q.size();
i++) {
1482 Teuchos::SerialDenseMatrix<int,ScalarType>
tempC( Teuchos::View, *C[
i], 1, 1,
ii,
j );
1494 OPT::Apply( *(this->_Op), *
Xj, *
MXj);
1499 OPT::Apply( *(this->_Op), *
Q[
i], *
MQ[
i] );
1500 Teuchos::SerialDenseMatrix<int,ScalarType>
tempC( Teuchos::View, *C[
i],
qcs[
i], 1, 0,
j );
1509 for (
int i=0;
i<
Q.size();
i++) {
1510 Teuchos::SerialDenseMatrix<int,ScalarType>
C2(
qcs[
i], 1 );
1518 Teuchos::SerialDenseMatrix<int,ScalarType>
tempC2( Teuchos::View,
C2, 1, 1,
ii );
1526 Teuchos::SerialDenseMatrix<int,ScalarType>
tempC( Teuchos::View, *C[
i],
qcs[
i], 1, 0,
j );
1537 OPT::Apply( *(this->_Op), *
Xj, *
MXj);
1546#ifdef BELOS_TEUCHOS_TIME_MONITOR
1553 if (SCT::magnitude(
newDot[0]) < SCT::magnitude(
oldDot[0]*sing_tol_)) {
1572 Teuchos::RCP<MV>
tempXj = MVT::Clone(
X, 1 );
1574 MVT::MvRandom( *
tempXj );
1583#ifdef BELOS_TEUCHOS_TIME_MONITOR
1591 for (
int i=0;
i<
Q.size();
i++) {
1592 Teuchos::SerialDenseMatrix<int,ScalarType>
product(
qcs[
i], 1 );
1599 Teuchos::SerialDenseMatrix<int,ScalarType>
tempC( Teuchos::View,
product, 1, 1,
ii );
1623#ifdef BELOS_TEUCHOS_TIME_MONITOR
1630 if ( SCT::magnitude(
newDot[0]) >= SCT::magnitude(
oldDot[0]*sing_tol_) ) {
1659 template<
class ScalarType,
class MV,
class OP>
1662 using Teuchos::ParameterList;
1663 using Teuchos::parameterList;
1671 "Maximum number of orthogonalization passes (includes the "
1672 "first). Default is 2, since \"twice is enough\" for Krylov "
1675 "Block reorthogonalization threshold.");
1677 "Singular block detection threshold.");
1682 template<
class ScalarType,
class MV,
class OP>
1685 using Teuchos::ParameterList;
1690 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 multiple steps ...
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &plist)
const std::string & getLabel() const
This method returns the label being used by the timers in the orthogonalization manager.
static const MagnitudeType blk_tol_fast_
Block reorthogonalization threshold (fast).
int normalize(MV &X, Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > B) const
This method calls normalize(X,Teuchos::null,B); see documentation for that function.
IMGSOrthoManager(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.
~IMGSOrthoManager()
Destructor.
Teuchos::ScalarTraits< ScalarType >::magnitudeType orthonormError(const MV &X) const
This method computes the error in orthonormality of a multivector, measured as the Frobenius norm of ...
int normalize(MV &X, Teuchos::RCP< MV > MX, Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > B) const
This method takes a multivector X and attempts to compute an orthonormal basis for ,...
void setLabel(const std::string &label)
This method sets the label used by the timers in the orthogonalization manager.
static const int max_ortho_steps_fast_
Max number of (re)orthogonalization steps, including the first (fast).
void project(MV &X, Teuchos::Array< Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > > C, Teuchos::ArrayView< Teuchos::RCP< const MV > > Q) const
This method calls project(X,Teuchos::null,C,Q); see documentation for that function.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
void project(MV &X, Teuchos::RCP< MV > MX, Teuchos::Array< Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > > 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 MagnitudeType sing_tol_default_
Singular block detection threshold (default).
static const int max_ortho_steps_default_
Max number of (re)orthogonalization steps, including the first (default).
static const MagnitudeType sing_tol_fast_
Singular block detection threshold (fast).
static const MagnitudeType blk_tol_default_
Block reorthogonalization threshold (default).
MagnitudeType getBlkTol() const
Return parameter for block re-orthogonalization threshhold.
MagnitudeType getSingTol() const
Return parameter for singular block detection.
void setSingTol(const MagnitudeType sing_tol)
Set parameter for singular block detection.
IMGSOrthoManager(const std::string &label="Belos", Teuchos::RCP< const OP > Op=Teuchos::null, const int max_ortho_steps=max_ortho_steps_default_, const MagnitudeType blk_tol=blk_tol_default_, const MagnitudeType sing_tol=sing_tol_default_)
Constructor specifying re-orthogonalization tolerance.
void setBlkTol(const MagnitudeType blk_tol)
Set parameter for block re-orthogonalization threshhold.
virtual int projectAndNormalizeWithMxImpl(MV &X, Teuchos::RCP< MV > MX, Teuchos::Array< Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > > C, Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > 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 .
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...
Belos's templated virtual class for providing routines for orthogonalization and orthonormzalition of...
void innerProd(const MV &X, const MV &Y, Teuchos::SerialDenseMatrix< int, ScalarType > &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 > getIMGSFastParameters()
"Fast" but possibly unsafe or less accurate parameters.
Teuchos::RCP< Teuchos::ParameterList > getIMGSDefaultParameters()
"Default" parameters for robustness and accuracy.