47 #ifndef BELOS_IMGS_ORTHOMANAGER_HPP
48 #define BELOS_IMGS_ORTHOMANAGER_HPP
67 #ifdef BELOS_TEUCHOS_TIME_MONITOR
69 #endif // BELOS_TEUCHOS_TIME_MONITOR
74 template<
class ScalarType,
class MV,
class OP>
78 template<
class ScalarType,
class MV,
class OP>
81 template<
class ScalarType,
class MV,
class OP>
108 #ifdef BELOS_TEUCHOS_TIME_MONITOR
109 std::stringstream ss;
112 std::string orthoLabel = ss.str() +
": Orthogonalization";
115 std::string updateLabel = ss.str() +
": Ortho (Update)";
118 std::string normLabel = ss.str() +
": Ortho (Norm)";
121 std::string ipLabel = ss.str() +
": Ortho (Inner Product)";
128 const std::string& label =
"Belos",
138 #ifdef BELOS_TEUCHOS_TIME_MONITOR
139 std::stringstream ss;
142 std::string orthoLabel = ss.str() +
": Orthogonalization";
145 std::string updateLabel = ss.str() +
": Ortho (Update)";
148 std::string normLabel = ss.str() +
": Ortho (Norm)";
151 std::string ipLabel = ss.str() +
": Ortho (Inner Product)";
167 using Teuchos::parameterList;
171 RCP<ParameterList> params;
173 params = parameterList (*defaultParams);
188 int maxNumOrthogPasses;
193 maxNumOrthogPasses = params->get<
int> (
"maxNumOrthogPasses");
194 }
catch (InvalidParameterName&) {
195 maxNumOrthogPasses = defaultParams->get<
int> (
"maxNumOrthogPasses");
196 params->set (
"maxNumOrthogPasses", maxNumOrthogPasses);
208 }
catch (InvalidParameterName&) {
213 params->remove (
"depTol");
214 }
catch (InvalidParameterName&) {
217 params->set (
"blkTol", blkTol);
222 }
catch (InvalidParameterName&) {
224 params->set (
"singTol", singTol);
238 defaultParams_ = Belos::getIMGSDefaultParameters<ScalarType, MV, OP>();
434 void setLabel(
const std::string& label);
472 #ifdef BELOS_TEUCHOS_TIME_MONITOR
474 #endif // BELOS_TEUCHOS_TIME_MONITOR
482 bool completeBasis,
int howMany = -1 )
const;
514 template<
class ScalarType,
class MV,
class OP>
517 template<
class ScalarType,
class MV,
class OP>
523 template<
class ScalarType,
class MV,
class OP>
528 template<
class ScalarType,
class MV,
class OP>
531 template<
class ScalarType,
class MV,
class OP>
536 template<
class ScalarType,
class MV,
class OP>
543 template<
class ScalarType,
class MV,
class OP>
546 if (label != label_) {
548 #ifdef BELOS_TEUCHOS_TIME_MONITOR
549 std::stringstream ss;
550 ss << label_ +
": IMGS[" << max_ortho_steps_ <<
"]";
552 std::string orthoLabel = ss.str() +
": Orthogonalization";
555 std::string updateLabel = ss.str() +
": Ortho (Update)";
558 std::string normLabel = ss.str() +
": Ortho (Norm)";
561 std::string ipLabel = ss.str() +
": Ortho (Inner Product)";
569 template<
class ScalarType,
class MV,
class OP>
572 const ScalarType ONE = SCT::one();
573 int rank = MVT::GetNumberVecs(X);
576 for (
int i=0; i<rank; i++) {
584 template<
class ScalarType,
class MV,
class OP>
587 int r1 = MVT::GetNumberVecs(X1);
588 int r2 = MVT::GetNumberVecs(X2);
596 template<
class ScalarType,
class MV,
class OP>
612 typedef typename Array< RCP< const MV > >::size_type size_type;
614 #ifdef BELOS_TEUCHOS_TIME_MONITOR
618 ScalarType ONE = SCT::one();
622 int xc = MVT::GetNumberVecs( X );
623 ptrdiff_t xr = MVT::GetGlobalLength( X );
630 B =
rcp (
new serial_dense_matrix_type (xc, xc));
640 for (size_type k = 0; k < nq; ++k)
642 const int numRows = MVT::GetNumberVecs (*Q[k]);
643 const int numCols = xc;
646 C[k] =
rcp (
new serial_dense_matrix_type (numRows, numCols));
647 else if (
C[k]->numRows() != numRows ||
C[k]->numCols() != numCols)
649 int err =
C[k]->reshape (numRows, numCols);
651 "IMGS orthogonalization: failed to reshape "
652 "C[" << k <<
"] (the array of block "
653 "coefficients resulting from projecting X "
654 "against Q[1:" << nq <<
"]).");
662 MX = MVT::Clone(X,MVT::GetNumberVecs(X));
663 OPT::Apply(*(this->_Op),X,*MX);
671 int mxc = MVT::GetNumberVecs( *MX );
672 ptrdiff_t mxr = MVT::GetGlobalLength( *MX );
675 TEUCHOS_TEST_FOR_EXCEPTION( xc == 0 || xr == 0, std::invalid_argument,
"Belos::IMGSOrthoManager::projectAndNormalize(): X must be non-empty" );
678 for (
int i=0; i<nq; i++) {
679 numbas += MVT::GetNumberVecs( *Q[i] );
684 "Belos::IMGSOrthoManager::projectAndNormalize(): Size of X must be consistant with size of B" );
687 "Belos::IMGSOrthoManager::projectAndNormalize(): MVT returned negative dimensions for X,MX" );
689 TEUCHOS_TEST_FOR_EXCEPTION( xc!=mxc || xr!=mxr, std::invalid_argument,
690 "Belos::IMGSOrthoManager::projectAndNormalize(): Size of X must be consistant with size of MX" );
696 bool dep_flg =
false;
700 tmpX = MVT::CloneCopy(X);
702 tmpMX = MVT::CloneCopy(*MX);
709 dep_flg = blkOrtho1( X, MX,
C, Q );
715 std::vector<ScalarType> diag(xc);
717 #ifdef BELOS_TEUCHOS_TIME_MONITOR
720 MVT::MvDot( X, *MX, diag );
722 (*B)(0,0) = SCT::squareroot(SCT::magnitude(diag[0]));
724 if (SCT::magnitude((*
B)(0,0)) > ZERO) {
726 MVT::MvScale( X, ONE/(*
B)(0,0) );
729 MVT::MvScale( *MX, ONE/(*
B)(0,0) );
736 dep_flg = blkOrtho( X, MX,
C, Q );
742 rank = blkOrthoSing( *tmpX, tmpMX,
C,
B, Q );
745 MVT::Assign( *tmpX, X );
747 MVT::Assign( *tmpMX, *MX );
752 rank = findBasis( X, MX,
B,
false );
757 rank = blkOrthoSing( *tmpX, tmpMX,
C,
B, Q );
760 MVT::Assign( *tmpX, X );
762 MVT::Assign( *tmpMX, *MX );
769 TEUCHOS_TEST_FOR_EXCEPTION( rank > xc || rank < 0, std::logic_error,
770 "Belos::IMGSOrthoManager::projectAndNormalize(): Debug error in rank variable." );
780 template<
class ScalarType,
class MV,
class OP>
785 #ifdef BELOS_TEUCHOS_TIME_MONITOR
790 return findBasis(X, MX,
B,
true);
796 template<
class ScalarType,
class MV,
class OP>
816 #ifdef BELOS_TEUCHOS_TIME_MONITOR
820 int xc = MVT::GetNumberVecs( X );
821 ptrdiff_t xr = MVT::GetGlobalLength( X );
823 std::vector<int> qcs(nq);
825 if (nq == 0 || xc == 0 || xr == 0) {
828 ptrdiff_t qr = MVT::GetGlobalLength ( *Q[0] );
839 MX = MVT::Clone(X,MVT::GetNumberVecs(X));
840 OPT::Apply(*(this->_Op),X,*MX);
847 int mxc = MVT::GetNumberVecs( *MX );
848 ptrdiff_t mxr = MVT::GetGlobalLength( *MX );
852 "Belos::IMGSOrthoManager::project(): MVT returned negative dimensions for X,MX" );
855 "Belos::IMGSOrthoManager::project(): Size of X not consistant with MX,Q" );
859 for (
int i=0; i<nq; i++) {
861 "Belos::IMGSOrthoManager::project(): Q lengths not mutually consistant" );
862 qcs[i] = MVT::GetNumberVecs( *Q[i] );
864 "Belos::IMGSOrthoManager::project(): Q has less rows than columns" );
873 "Belos::IMGSOrthoManager::project(): Size of Q not consistant with size of C" );
878 blkOrtho( X, MX,
C, Q );
885 template<
class ScalarType,
class MV,
class OP>
889 bool completeBasis,
int howMany )
const {
906 const ScalarType ONE = SCT::one();
909 int xc = MVT::GetNumberVecs( X );
910 ptrdiff_t xr = MVT::GetGlobalLength( X );
925 MX = MVT::Clone(X,xc);
926 OPT::Apply(*(this->_Op),X,*MX);
937 int mxc = (this->_hasOp) ? MVT::GetNumberVecs( *MX ) : xc;
938 ptrdiff_t mxr = (this->_hasOp) ? MVT::GetGlobalLength( *MX ) : xr;
942 "Belos::IMGSOrthoManager::findBasis(): X must be non-empty" );
944 "Belos::IMGSOrthoManager::findBasis(): Size of X not consistant with size of B" );
946 "Belos::IMGSOrthoManager::findBasis(): Size of X not consistant with size of MX" );
947 TEUCHOS_TEST_FOR_EXCEPTION( xc > xr, std::invalid_argument,
948 "Belos::IMGSOrthoManager::findBasis(): Size of X not feasible for normalization" );
949 TEUCHOS_TEST_FOR_EXCEPTION( howMany < 0 || howMany > xc, std::invalid_argument,
950 "Belos::IMGSOrthoManager::findBasis(): Invalid howMany parameter" );
955 int xstart = xc - howMany;
957 for (
int j = xstart; j < xc; j++) {
966 std::vector<int> index(1);
970 if ((this->_hasOp)) {
972 MXj = MVT::CloneViewNonConst( *MX, index );
981 oldMXj = MVT::CloneCopy( *MXj );
989 std::vector<ScalarType> oldDot( 1 ), newDot( 1 );
994 #ifdef BELOS_TEUCHOS_TIME_MONITOR
997 MVT::MvDot( *Xj, *MXj, oldDot );
1000 TEUCHOS_TEST_FOR_EXCEPTION( SCT::real(oldDot[0]) < ZERO,
OrthoError,
1001 "Belos::IMGSOrthoManager::findBasis(): Negative definiteness discovered in inner product" );
1004 for (
int ii=0; ii<numX; ii++) {
1007 prevX = MVT::CloneView( X, index );
1009 prevMX = MVT::CloneView( *MX, index );
1012 for (
int i=0; i<max_ortho_steps_; ++i) {
1016 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1025 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1028 MVT::MvTimesMatAddMv( -ONE, *prevX, P2, ONE, *Xj );
1036 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1039 MVT::MvTimesMatAddMv( -ONE, *prevMX, P2, ONE, *MXj );
1044 product[ii] = P2[0];
1046 product[ii] += P2[0];
1054 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1057 MVT::MvDot( *Xj, *oldMXj, newDot );
1060 newDot[0] = oldDot[0];
1064 if (completeBasis) {
1068 if ( SCT::magnitude(newDot[0]) < SCT::magnitude(sing_tol_*oldDot[0]) ) {
1073 std::cout <<
"Belos::IMGSOrthoManager::findBasis() --> Random for column " << numX << std::endl;
1078 MVT::MvRandom( *tempXj );
1080 tempMXj = MVT::Clone( X, 1 );
1081 OPT::Apply( *(this->_Op), *tempXj, *tempMXj );
1087 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1090 MVT::MvDot( *tempXj, *tempMXj, oldDot );
1094 for (
int ii=0; ii<numX; ii++) {
1097 prevX = MVT::CloneView( X, index );
1099 prevMX = MVT::CloneView( *MX, index );
1102 for (
int num_orth=0; num_orth<max_ortho_steps_; num_orth++){
1104 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1110 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1113 MVT::MvTimesMatAddMv( -ONE, *prevX, P2, ONE, *tempXj );
1116 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1119 MVT::MvTimesMatAddMv( -ONE, *prevMX, P2, ONE, *tempMXj );
1124 product[ii] = P2[0];
1126 product[ii] += P2[0];
1132 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1135 MVT::MvDot( *tempXj, *tempMXj, newDot );
1138 if ( SCT::magnitude(newDot[0]) >= SCT::magnitude(oldDot[0]*sing_tol_) ) {
1140 MVT::Assign( *tempXj, *Xj );
1142 MVT::Assign( *tempMXj, *MXj );
1154 if ( SCT::magnitude(newDot[0]) < SCT::magnitude(oldDot[0]*blk_tol_) ) {
1163 ScalarType diag = SCT::squareroot(SCT::magnitude(newDot[0]));
1164 if (SCT::magnitude(diag) > ZERO) {
1165 MVT::MvScale( *Xj, ONE/diag );
1168 MVT::MvScale( *MXj, ONE/diag );
1182 for (
int i=0; i<numX; i++) {
1183 (*B)(i,j) = product(i);
1194 template<
class ScalarType,
class MV,
class OP>
1201 int xc = MVT::GetNumberVecs( X );
1202 const ScalarType ONE = SCT::one();
1204 std::vector<int> qcs( nq );
1205 for (
int i=0; i<nq; i++) {
1206 qcs[i] = MVT::GetNumberVecs( *Q[i] );
1210 std::vector<int> index(1);
1215 for (
int i=0; i<nq; i++) {
1218 for (
int ii=0; ii<qcs[i]; ii++) {
1221 tempQ = MVT::CloneView( *Q[i], index );
1226 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1233 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1236 MVT::MvTimesMatAddMv( -ONE, *tempQ, tempC, ONE, X );
1243 OPT::Apply( *(this->_Op), X, *MX);
1247 MQ[i] = MVT::Clone( *Q[i], qcs[i] );
1248 OPT::Apply( *(this->_Op), *Q[i], *MQ[i] );
1249 MVT::MvTimesMatAddMv( -ONE, *MQ[i], *
C[i], ONE, *MX );
1255 for (
int j = 1; j < max_ortho_steps_; ++j) {
1257 for (
int i=0; i<nq; i++) {
1262 for (
int ii=0; ii<qcs[i]; ii++) {
1265 tempQ = MVT::CloneView( *Q[i], index );
1271 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1278 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1281 MVT::MvTimesMatAddMv( -ONE, *tempQ, tempC2, ONE, X );
1290 MVT::MvTimesMatAddMv( -ONE, *MQ[i], C2, ONE, *MX );
1292 else if (xc <= qcs[i]) {
1294 OPT::Apply( *(this->_Op), X, *MX);
1305 template<
class ScalarType,
class MV,
class OP>
1312 int xc = MVT::GetNumberVecs( X );
1313 bool dep_flg =
false;
1314 const ScalarType ONE = SCT::one();
1316 std::vector<int> qcs( nq );
1317 for (
int i=0; i<nq; i++) {
1318 qcs[i] = MVT::GetNumberVecs( *Q[i] );
1324 std::vector<ScalarType> oldDot( xc );
1326 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1329 MVT::MvDot( X, *MX, oldDot );
1332 std::vector<int> index(1);
1337 for (
int i=0; i<nq; i++) {
1340 for (
int ii=0; ii<qcs[i]; ii++) {
1343 tempQ = MVT::CloneView( *Q[i], index );
1348 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1355 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1358 MVT::MvTimesMatAddMv( -ONE, *tempQ, tempC, ONE, X );
1365 OPT::Apply( *(this->_Op), X, *MX);
1369 MQ[i] = MVT::Clone( *Q[i], qcs[i] );
1370 OPT::Apply( *(this->_Op), *Q[i], *MQ[i] );
1371 MVT::MvTimesMatAddMv( -ONE, *MQ[i], *
C[i], ONE, *MX );
1377 for (
int j = 1; j < max_ortho_steps_; ++j) {
1379 for (
int i=0; i<nq; i++) {
1383 for (
int ii=0; ii<qcs[i]; ii++) {
1386 tempQ = MVT::CloneView( *Q[i], index );
1392 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1399 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1402 MVT::MvTimesMatAddMv( -ONE, *tempQ, tempC2, ONE, X );
1410 MVT::MvTimesMatAddMv( -ONE, *MQ[i], C2, ONE, *MX );
1412 else if (xc <= qcs[i]) {
1414 OPT::Apply( *(this->_Op), X, *MX);
1421 std::vector<ScalarType> newDot(xc);
1423 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1426 MVT::MvDot( X, *MX, newDot );
1430 for (
int i=0; i<xc; i++){
1431 if (SCT::magnitude(newDot[i]) < SCT::magnitude(oldDot[i] * blk_tol_)) {
1440 template<
class ScalarType,
class MV,
class OP>
1449 const ScalarType ONE = SCT::one();
1450 const ScalarType ZERO = SCT::zero();
1453 int xc = MVT::GetNumberVecs( X );
1454 std::vector<int> indX( 1 );
1455 std::vector<ScalarType> oldDot( 1 ), newDot( 1 );
1457 std::vector<int> qcs( nq );
1458 for (
int i=0; i<nq; i++) {
1459 qcs[i] = MVT::GetNumberVecs( *Q[i] );
1468 for (
int j=0; j<xc; j++) {
1470 bool dep_flg =
false;
1474 std::vector<int> index( j );
1475 for (
int ind=0; ind<j; ind++) {
1478 lastQ = MVT::CloneView( X, index );
1483 qcs.push_back( MVT::GetNumberVecs( *lastQ ) );
1488 Xj = MVT::CloneViewNonConst( X, indX );
1490 MXj = MVT::CloneViewNonConst( *MX, indX );
1498 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1501 MVT::MvDot( *Xj, *MXj, oldDot );
1508 for (
int i=0; i<Q.
size(); i++) {
1511 for (
int ii=0; ii<qcs[i]; ii++) {
1514 tempQ = MVT::CloneView( *Q[i], indX );
1522 MVT::MvTimesMatAddMv( -ONE, *tempQ, tempC, ONE, *Xj );
1528 OPT::Apply( *(this->_Op), *Xj, *MXj);
1532 MQ[i] = MVT::Clone( *Q[i], qcs[i] );
1533 OPT::Apply( *(this->_Op), *Q[i], *MQ[i] );
1535 MVT::MvTimesMatAddMv( -ONE, *MQ[i], tempC, ONE, *MXj );
1541 for (
int num_ortho_steps=1; num_ortho_steps < max_ortho_steps_; ++num_ortho_steps) {
1543 for (
int i=0; i<Q.
size(); i++) {
1547 for (
int ii=0; ii<qcs[i]; ii++) {
1550 tempQ = MVT::CloneView( *Q[i], indX );
1556 MVT::MvTimesMatAddMv( -ONE, *tempQ, tempC2, ONE, *Xj );
1567 MVT::MvTimesMatAddMv( -ONE, *MQ[i], C2, ONE, *MXj );
1569 else if (xc <= qcs[i]) {
1571 OPT::Apply( *(this->_Op), *Xj, *MXj);
1580 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1583 MVT::MvDot( *Xj, *MXj, newDot );
1587 if (SCT::magnitude(newDot[0]) < SCT::magnitude(oldDot[0]*sing_tol_)) {
1593 ScalarType diag = SCT::squareroot(SCT::magnitude(newDot[0]));
1595 MVT::MvScale( *Xj, ONE/diag );
1598 MVT::MvScale( *MXj, ONE/diag );
1608 MVT::MvRandom( *tempXj );
1610 tempMXj = MVT::Clone( X, 1 );
1611 OPT::Apply( *(this->_Op), *tempXj, *tempMXj );
1617 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1620 MVT::MvDot( *tempXj, *tempMXj, oldDot );
1623 for (
int num_orth=0; num_orth<max_ortho_steps_; num_orth++) {
1625 for (
int i=0; i<Q.
size(); i++) {
1629 for (
int ii=0; ii<qcs[i]; ii++) {
1632 tempQ = MVT::CloneView( *Q[i], indX );
1637 MVT::MvTimesMatAddMv( -ONE, *tempQ, tempC, ONE, *tempXj );
1645 MVT::MvTimesMatAddMv( -ONE, *MQ[i], product, ONE, *tempMXj );
1647 else if (xc <= qcs[i]) {
1649 OPT::Apply( *(this->_Op), *tempXj, *tempMXj);
1657 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1660 MVT::MvDot( *tempXj, *tempMXj, newDot );
1664 if ( SCT::magnitude(newDot[0]) >= SCT::magnitude(oldDot[0]*sing_tol_) ) {
1665 ScalarType diag = SCT::squareroot(SCT::magnitude(newDot[0]));
1671 MVT::MvAddMv( ONE/diag, *tempXj, ZERO, *tempXj, *Xj );
1673 MVT::MvAddMv( ONE/diag, *tempMXj, ZERO, *tempMXj, *MXj );
1693 template<
class ScalarType,
class MV,
class OP>
1697 using Teuchos::parameterList;
1700 RCP<ParameterList> params = parameterList (
"IMGS");
1705 "Maximum number of orthogonalization passes (includes the "
1706 "first). Default is 2, since \"twice is enough\" for Krylov "
1709 "Block reorthogonalization threshold.");
1711 "Singular block detection threshold.");
1716 template<
class ScalarType,
class MV,
class OP>
1722 RCP<ParameterList> params = getIMGSDefaultParameters<ScalarType, MV, OP>();
1724 params->set (
"maxNumOrthogPasses",
1726 params->set (
"blkTol",
1728 params->set (
"singTol",
1736 #endif // BELOS_IMGS_ORTHOMANAGER_HPP
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &plist)
bool is_null(const boost::shared_ptr< T > &p)
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...
MagnitudeType blk_tol_
Block reorthogonalization tolerance.
static const int max_ortho_steps_fast_
Max number of (re)orthogonalization steps, including the first (fast).
void setBlkTol(const MagnitudeType blk_tol)
Set parameter for block re-orthogonalization threshhold.
int findBasis(MV &X, Teuchos::RCP< MV > MX, Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > C, bool completeBasis, int howMany=-1) const
Routine to find an orthonormal basis for X.
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.
bool is_null(const std::shared_ptr< T > &p)
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 ...
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
bool blkOrtho1(MV &X, Teuchos::RCP< MV > MX, Teuchos::Array< Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > > C, Teuchos::ArrayView< Teuchos::RCP< const MV > > Q) const
Routine to compute the block orthogonalization.
Declaration of basic traits for the multivector type.
int blkOrthoSing(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 > > QQ) const
Project X against QQ and normalize X, one vector at a time.
Class which defines basic traits for the operator type.
ScalarTraits< ScalarType >::magnitudeType normFrobenius() const
const std::string & getLabel() const
This method returns the label being used by the timers in the orthogonalization manager.
Traits class which defines basic operations on multivectors.
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...
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.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
std::string label_
Label for timers.
bool is_null(const RCP< T > &p)
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 ...
MagnitudeType getBlkTol() const
Return parameter for block re-orthogonalization threshhold.
OperatorTraits< ScalarType, MV, OP > OPT
Teuchos::ScalarTraits< MagnitudeType > MGT
Exception thrown to signal error in an orthogonalization manager method.
MagnitudeType sing_tol_
Singular block detection threshold.
void setMyParamList(const RCP< ParameterList > ¶mList)
int max_ortho_steps_
Max number of (re)orthogonalization steps, including the first.
MultiVecTraits< ScalarType, MV > MVT
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
void resize(size_type new_size, const value_type &x=value_type())
void setLabel(const std::string &label)
This method sets the label used by the timers in the orthogonalization manager.
An implementation of the Belos::MatOrthoManager that performs orthogonalization using multiple steps ...
void push_back(const value_type &x)
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).
Teuchos::RCP< Teuchos::ParameterList > getIMGSDefaultParameters()
"Default" parameters for robustness and accuracy.
Teuchos::ScalarTraits< ScalarType > SCT
Teuchos::RCP< Teuchos::ParameterList > defaultParams_
Default parameter list.
Teuchos::ScalarTraits< ScalarType >::magnitudeType MagnitudeType
static const int max_ortho_steps_default_
Max number of (re)orthogonalization steps, including the first (default).
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.
MagnitudeType getSingTol() const
Return parameter for singular block detection.
Class which defines basic traits for the operator type.
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.
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 ...
~IMGSOrthoManager()
Destructor.
Belos's templated virtual class for providing routines for orthogonalization and orthonormzalition of...
void setSingTol(const MagnitudeType sing_tol)
Set parameter for singular block detection.
Belos header file which uses auto-configuration information to include necessary C++ headers...
Teuchos::RCP< Teuchos::ParameterList > getIMGSFastParameters()
"Fast" but possibly unsafe or less accurate parameters.
static const MagnitudeType blk_tol_default_
Block reorthogonalization threshold (default).
static const MagnitudeType sing_tol_fast_
Singular block detection threshold (fast).
bool blkOrtho(MV &X, Teuchos::RCP< MV > MX, Teuchos::Array< Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > > C, Teuchos::ArrayView< Teuchos::RCP< const MV > > Q) const
Routine to compute the block orthogonalization.
static const MagnitudeType blk_tol_fast_
Block reorthogonalization threshold (fast).
Templated virtual class for providing orthogonalization/orthonormalization methods with matrix-based ...