47 #ifndef ANASAZI_ICSG_ORTHOMANAGER_HPP
48 #define ANASAZI_ICSG_ORTHOMANAGER_HPP
64 #ifdef ANASAZI_ICGS_DEBUG
65 # include <Teuchos_FancyOStream.hpp>
70 template<
class ScalarType,
class MV,
class OP>
383 numIters_ = numIters;
385 "Anasazi::ICGSOrthoManager::setNumIters(): input must be >= 1.");
403 bool completeBasis,
int howMany = -1)
const;
410 template<
class ScalarType,
class MV,
class OP>
419 "Anasazi::ICGSOrthoManager::ICGSOrthoManager(): argument \"eps\" must be non-negative.");
422 eps_ = lapack.
LAMCH(
'E');
427 std::invalid_argument,
428 "Anasazi::ICGSOrthoManager::ICGSOrthoManager(): argument \"tol\" must be in [0,1].");
435 template<
class ScalarType,
class MV,
class OP>
438 const ScalarType ONE = SCT::one();
439 int rank = MVT::GetNumberVecs(X);
442 for (
int i=0; i<rank; i++) {
452 template<
class ScalarType,
class MV,
class OP>
455 int r1 = MVT::GetNumberVecs(X1);
456 int r2 = MVT::GetNumberVecs(X2);
465 template<
class ScalarType,
class MV,
class OP>
474 projectGen(X,Q,Q,
true,C,MX,MQ,MQ);
481 template<
class ScalarType,
class MV,
class OP>
490 int xc = MVT::GetNumberVecs(X);
491 ptrdiff_t xr = MVT::GetGlobalLength(X);
496 if (MX == Teuchos::null) {
498 MX = MVT::Clone(X,xc);
499 OPT::Apply(*(this->_Op),X,*MX);
500 this->_OpCounter += MVT::GetNumberVecs(X);
506 if ( B == Teuchos::null ) {
510 int mxc = (this->_hasOp) ? MVT::GetNumberVecs( *MX ) : xc;
511 ptrdiff_t mxr = (this->_hasOp) ? MVT::GetGlobalLength( *MX ) : xr;
515 "Anasazi::ICGSOrthoManager::normalizeMat(): X must be non-empty" );
517 "Anasazi::ICGSOrthoManager::normalizeMat(): Size of X not consistent with size of B" );
519 "Anasazi::ICGSOrthoManager::normalizeMat(): Size of X not consistent with size of MX" );
520 TEUCHOS_TEST_FOR_EXCEPTION( static_cast<ptrdiff_t>(xc) > xr, std::invalid_argument,
521 "Anasazi::ICGSOrthoManager::normalizeMat(): Size of X not feasible for normalization" );
523 return findBasis(X, MX, *B,
true );
530 template<
class ScalarType,
class MV,
class OP>
540 return projectAndNormalizeGen(X,Q,Q,
true,C,B,MX,MQ,MQ);
546 template<
class ScalarType,
class MV,
class OP>
573 #ifdef ANASAZI_ICGS_DEBUG
576 out = Teuchos::getFancyOStream(Teuchos::rcpFromRef(std::cout));
578 *out <<
"Entering Anasazi::ICGSOrthoManager::projectGen(...)\n";
581 const ScalarType ONE = SCT::one();
582 const MagnitudeType ZERO = SCT::magnitude(SCT::zero());
586 int sc = MVT::GetNumberVecs( S );
587 ptrdiff_t sr = MVT::GetGlobalLength( S );
588 int numxy = X.length();
590 "Anasazi::ICGSOrthoManager::projectGen(): X and Y must contain the same number of multivectors.");
591 std::vector<int> xyc(numxy);
593 if (numxy == 0 || sc == 0 || sr == 0) {
594 #ifdef ANASAZI_ICGS_DEBUG
595 *out <<
"Leaving Anasazi::ICGSOrthoManager::projectGen(...)\n";
610 "Anasazi::ICGSOrthoManager::projectGen(): MVT returned negative dimensions for S." );
613 if (this->_hasOp ==
true) {
614 if (MS != Teuchos::null) {
616 "Anasazi::ICGSOrthoManager::projectGen(): MS length not consistent with S." );
618 "Anasazi::ICGSOrthoManager::projectGen(): MS width not consistent with S." );
623 ptrdiff_t sumxyc = 0;
626 for (
int i=0; i<numxy; i++) {
627 if (X[i] != Teuchos::null && Y[i] != Teuchos::null) {
629 "Anasazi::ICGSOrthoManager::projectGen(): X[" << i <<
"] length not consistent with S." );
631 "Anasazi::ICGSOrthoManager::projectGen(): Y[" << i <<
"] length not consistent with S." );
633 "Anasazi::ICGSOrthoManager::projectGen(): X[" << i <<
"] and Y[" << i <<
"] widths not consistent." );
635 xyc[i] = MVT::GetNumberVecs( *X[i] );
637 "Anasazi::ICGSOrthoManager::projectGen(): X[" << i <<
"],Y[" << i <<
"] have less rows than columns, and therefore cannot be full rank." );
641 if ( C[i] == Teuchos::null ) {
646 "Anasazi::ICGSOrthoManager::projectGen(): Size of Q not consistent with size of C." );
650 if (MX[i] != Teuchos::null) {
651 TEUCHOS_TEST_FOR_EXCEPTION( MVT::GetGlobalLength(*MX[i]) != sr || MVT::GetNumberVecs(*MX[i]) != xyc[i], std::invalid_argument,
652 "Anasazi::ICGSOrthoManager::projectGen(): Size of MX[" << i <<
"] not consistent with size of X[" << i <<
"]." );
657 if (MY[i] != Teuchos::null) {
658 TEUCHOS_TEST_FOR_EXCEPTION( MVT::GetGlobalLength(*MY[i]) != sr || MVT::GetNumberVecs(*MY[i]) != xyc[i], std::invalid_argument,
659 "Anasazi::ICGSOrthoManager::projectGen(): Size of MY[" << i <<
"] not consistent with size of Y[" << i <<
"]." );
668 "Anasazi::ICGSOrthoManager::projectGen(): "
669 << (X[i] == Teuchos::null ?
"Y[" :
"X[") << i <<
"] was provided but "
670 << (X[i] == Teuchos::null ?
"X[" :
"Y[") << i <<
"] was not.");
676 "Anasazi::ICGSOrthoManager::projectGen(): dimension of all X[i],Y[i] is "
677 << sumxyc <<
", but length of vectors is only " << sr <<
". This is infeasible.");
712 if (MXmissing == 0) {
715 if (MYmissing == 0) {
722 switch (whichAlloc) {
738 if (MS == Teuchos::null) {
739 #ifdef ANASAZI_ICGS_DEBUG
740 *out <<
"Allocating MS...\n";
742 MS = MVT::Clone(S,MVT::GetNumberVecs(S));
743 OPT::Apply(*(this->_Op),S,*MS);
744 this->_OpCounter += MVT::GetNumberVecs(S);
748 if (whichAlloc == 0) {
750 for (
int i=0; i<numxy; i++) {
751 if (MX[i] == Teuchos::null) {
752 #ifdef ANASAZI_ICGS_DEBUG
753 *out <<
"Allocating MX[" << i <<
"]...\n";
756 OPT::Apply(*(this->_Op),*X[i],*tmpMX);
758 this->_OpCounter += xyc[i];
765 MS = Teuchos::rcpFromRef(S);
769 "Anasazi::ICGSOrthoManager::projectGen(): Error in updateMS logic.");
779 if (isBiortho ==
false) {
780 for (
int i=0; i<numxy; i++) {
781 #ifdef ANASAZI_ICGS_DEBUG
782 *out <<
"Computing YMX[" << i <<
"] and its Cholesky factorization...\n";
786 #ifdef ANASAZI_ICGS_DEBUG
793 MagnitudeType err = ZERO;
794 for (
int jj=0; jj<YMX[i]->numCols(); jj++) {
795 err =+ SCT::magnitude(SCT::imag((*YMX[i])(jj,jj)));
796 for (
int ii=jj; ii<YMX[i]->numRows(); ii++) {
797 err += SCT::magnitude( (*YMX[i])(ii,jj) - SCT::conjugate((*YMX[i])(jj,ii)) );
800 *out <<
"Symmetry error in YMX[" << i <<
"] == " << err <<
"\n";
805 lapack.
POTRF(
'U',YMX[i]->numRows(),YMX[i]->values(),YMX[i]->stride(),&info);
807 "Anasazi::ICGSOrthoManager::projectGen(): Error computing Cholesky factorization of Y[i]^T * M * X[i] using POTRF: returned info " << info);
812 #ifdef ANASAZI_ICGS_DEBUG
813 std::vector<MagnitudeType> oldNorms(sc);
815 *out <<
"oldNorms = { ";
816 std::copy(oldNorms.begin(), oldNorms.end(), std::ostream_iterator<MagnitudeType>(*out,
" "));
823 for (
int i=0; i<numxy; i++) {
824 C[i]->putScalar(ZERO);
825 Ccur[i].reshape(C[i]->numRows(),C[i]->numCols());
828 for (
int iter=0; iter < numIters_; iter++) {
829 #ifdef ANASAZI_ICGS_DEBUG
830 *out <<
"beginning iteration " << iter+1 <<
"\n";
834 for (
int i=0; i<numxy; i++) {
837 if (isBiortho ==
false) {
840 lapack.
POTRS(
'U',YMX[i]->numCols(),Ccur[i].numCols(),
841 YMX[i]->values(),YMX[i]->stride(),
842 Ccur[i].values(),Ccur[i].stride(), &info);
844 "Anasazi::ICGSOrthoManager::projectGen(): Error code " << info <<
" from lapack::POTRS." );
848 #ifdef ANASAZI_ICGS_DEBUG
849 *out <<
"Applying projector P_{X[" << i <<
"],Y[" << i <<
"]}...\n";
851 MVT::MvTimesMatAddMv( -ONE, *X[i], Ccur[i], ONE, S );
858 #ifdef ANASAZI_ICGS_DEBUG
859 *out <<
"Updating MS...\n";
861 OPT::Apply( *(this->_Op), S, *MS);
862 this->_OpCounter += sc;
864 else if (updateMS == 2) {
865 #ifdef ANASAZI_ICGS_DEBUG
866 *out <<
"Updating MS...\n";
868 MVT::MvTimesMatAddMv( -ONE, *MX[i], Ccur[i], ONE, *MS );
873 #ifdef ANASAZI_ICGS_DEBUG
874 std::vector<MagnitudeType> newNorms(sc);
876 *out <<
"newNorms = { ";
877 std::copy(newNorms.begin(), newNorms.end(), std::ostream_iterator<MagnitudeType>(*out,
" "));
882 #ifdef ANASAZI_ICGS_DEBUG
883 *out <<
"Leaving Anasazi::ICGSOrthoManager::projectGen(...)\n";
891 template<
class ScalarType,
class MV,
class OP>
919 #ifdef ANASAZI_ICGS_DEBUG
922 out = Teuchos::getFancyOStream(Teuchos::rcpFromRef(std::cout));
924 *out <<
"Entering Anasazi::ICGSOrthoManager::projectAndNormalizeGen(...)\n";
928 int sc = MVT::GetNumberVecs( S );
929 ptrdiff_t sr = MVT::GetGlobalLength( S );
930 int numxy = X.length();
932 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): X and Y must contain the same number of multivectors.");
933 std::vector<int> xyc(numxy);
935 if (sc == 0 || sr == 0) {
936 #ifdef ANASAZI_ICGS_DEBUG
937 *out <<
"Leaving Anasazi::ICGSOrthoManager::projectGen(...)\n";
952 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): MVT returned negative dimensions for S." );
955 if (this->_hasOp ==
true) {
956 if (MS != Teuchos::null) {
958 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): MS length not consistent with S." );
960 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): MS width not consistent with S." );
965 ptrdiff_t sumxyc = 0;
968 for (
int i=0; i<numxy; i++) {
969 if (X[i] != Teuchos::null && Y[i] != Teuchos::null) {
971 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): X[" << i <<
"] length not consistent with S." );
973 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): Y[" << i <<
"] length not consistent with S." );
975 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): X[" << i <<
"] and Y[" << i <<
"] widths not consistent." );
977 xyc[i] = MVT::GetNumberVecs( *X[i] );
979 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): X[" << i <<
"],Y[" << i <<
"] have less rows than columns, and therefore cannot be full rank." );
983 if ( C[i] == Teuchos::null ) {
988 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): Size of Q not consistent with size of C." );
992 if (MX[i] != Teuchos::null) {
993 TEUCHOS_TEST_FOR_EXCEPTION( MVT::GetGlobalLength(*MX[i]) != sr || MVT::GetNumberVecs(*MX[i]) != xyc[i], std::invalid_argument,
994 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): Size of MX[" << i <<
"] not consistent with size of X[" << i <<
"]." );
999 if (MY[i] != Teuchos::null) {
1000 TEUCHOS_TEST_FOR_EXCEPTION( MVT::GetGlobalLength(*MY[i]) != sr || MVT::GetNumberVecs(*MY[i]) != xyc[i], std::invalid_argument,
1001 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): Size of MY[" << i <<
"] not consistent with size of Y[" << i <<
"]." );
1004 MYmissing += xyc[i];
1010 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): "
1011 << (X[i] == Teuchos::null ?
"Y[" :
"X[") << i <<
"] was provided but "
1012 << (X[i] == Teuchos::null ?
"X[" :
"Y[") << i <<
"] was not.");
1018 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): dimension of all X[i],Y[i] is "
1019 << sumxyc <<
" and requested " << sc <<
"-dimensional basis, but length of vectors is only "
1020 << sr <<
". This is infeasible.");
1055 if (MXmissing == 0) {
1058 if (MYmissing == 0) {
1065 switch (whichAlloc) {
1081 if (MS == Teuchos::null) {
1082 #ifdef ANASAZI_ICGS_DEBUG
1083 *out <<
"Allocating MS...\n";
1085 MS = MVT::Clone(S,MVT::GetNumberVecs(S));
1086 OPT::Apply(*(this->_Op),S,*MS);
1087 this->_OpCounter += MVT::GetNumberVecs(S);
1091 if (whichAlloc == 0) {
1093 for (
int i=0; i<numxy; i++) {
1094 if (MX[i] == Teuchos::null) {
1095 #ifdef ANASAZI_ICGS_DEBUG
1096 *out <<
"Allocating MX[" << i <<
"]...\n";
1099 OPT::Apply(*(this->_Op),*X[i],*tmpMX);
1101 this->_OpCounter += xyc[i];
1108 MS = Teuchos::rcpFromRef(S);
1112 "Anasazi::ICGSOrthoManager::projectGen(): Error in updateMS logic.");
1117 if ( B == Teuchos::null ) {
1123 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): Size of S must be consistent with size of B" );
1128 projectGen(S,X,Y,isBiortho,C,MS,MX,MY);
1136 int curssize = sc - rank;
1141 #ifdef ANASAZI_ICGS_DEBUG
1142 *out <<
"Attempting to find orthonormal basis for X...\n";
1144 rank = findBasis(S,MS,*B,
false,curssize);
1146 if (oldrank != -1 && rank != oldrank) {
1152 for (
int i=0; i<sc; i++) {
1153 (*B)(i,oldrank) = oldCoeff(i,0);
1158 if (rank != oldrank) {
1166 for (
int i=0; i<sc; i++) {
1167 oldCoeff(i,0) = (*B)(i,rank);
1174 #ifdef ANASAZI_ICGS_DEBUG
1175 *out <<
"Finished computing basis.\n";
1181 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): basis lost rank; this shouldn't happen");
1183 if (rank != oldrank) {
1191 if (numTries <= 0) {
1199 #ifdef ANASAZI_ICGS_DEBUG
1200 *out <<
"Inserting random vector in X[" << rank <<
"]. Attempt " << 10-numTries <<
".\n";
1203 std::vector<int> ind(1);
1205 curS = MVT::CloneViewNonConst(S,ind);
1206 MVT::MvRandom(*curS);
1208 #ifdef ANASAZI_ICGS_DEBUG
1209 *out <<
"Applying operator to random vector.\n";
1211 curMS = MVT::CloneViewNonConst(*MS,ind);
1212 OPT::Apply( *(this->_Op), *curS, *curMS );
1213 this->_OpCounter += MVT::GetNumberVecs(*curS);
1222 projectGen(*curS,X,Y,isBiortho,dummyC,curMS,MX,MY);
1229 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): Debug error in rank variable." );
1231 #ifdef ANASAZI_ICGS_DEBUG
1232 *out <<
"Returning " << rank <<
" from Anasazi::ICGSOrthoManager::projectAndNormalizeGen(...)\n";
1243 template<
class ScalarType,
class MV,
class OP>
1247 bool completeBasis,
int howMany )
const {
1264 #ifdef ANASAZI_ICGS_DEBUG
1267 out = Teuchos::getFancyOStream(Teuchos::rcpFromRef(std::cout));
1269 *out <<
"Entering Anasazi::ICGSOrthoManager::findBasis(...)\n";
1272 const ScalarType ONE = SCT::one();
1273 const MagnitudeType ZERO = SCT::magnitude(SCT::zero());
1275 int xc = MVT::GetNumberVecs( X );
1277 if (howMany == -1) {
1285 "Anasazi::ICGSOrthoManager::findBasis(): calling routine did not specify MS.");
1287 "Anasazi::ICGSOrthoManager::findBasis(): Invalid howMany parameter" );
1292 int xstart = xc - howMany;
1294 for (
int j = xstart; j < xc; j++) {
1303 for (
int i=j+1; i<xc; ++i) {
1308 std::vector<int> index(1);
1312 if ((this->_hasOp)) {
1314 MXj = MVT::CloneViewNonConst( *MX, index );
1322 std::vector<int> prev_idx( numX );
1326 for (
int i=0; i<numX; ++i) prev_idx[i] = i;
1327 prevX = MVT::CloneView( X, prev_idx );
1329 prevMX = MVT::CloneView( *MX, prev_idx );
1333 bool rankDef =
true;
1338 for (
int numTrials = 0; numTrials < 10; numTrials++) {
1339 #ifdef ANASAZI_ICGS_DEBUG
1340 *out <<
"Trial " << numTrials <<
" for vector " << j <<
"\n";
1345 std::vector<MagnitudeType> origNorm(1), newNorm(1), newNorm2(1);
1352 #ifdef ANASAZI_ICGS_DEBUG
1353 *out <<
"origNorm = " << origNorm[0] <<
"\n";
1364 #ifdef ANASAZI_ICGS_DEBUG
1365 *out <<
"Orthogonalizing X[" << j <<
"]...\n";
1367 MVT::MvTimesMatAddMv( -ONE, *prevX, product, ONE, *Xj );
1374 #ifdef ANASAZI_ICGS_DEBUG
1375 *out <<
"Updating MX[" << j <<
"]...\n";
1377 MVT::MvTimesMatAddMv( -ONE, *prevMX, product, ONE, *MXj );
1382 MagnitudeType product_norm = product.normOne();
1384 #ifdef ANASAZI_ICGS_DEBUG
1385 *out <<
"newNorm = " << newNorm[0] <<
"\n";
1386 *out <<
"prodoct_norm = " << product_norm <<
"\n";
1390 if ( product_norm/newNorm[0] >= tol_ || newNorm[0] < eps_*origNorm[0]) {
1391 #ifdef ANASAZI_ICGS_DEBUG
1392 if (product_norm/newNorm[0] >= tol_) {
1393 *out <<
"product_norm/newNorm == " << product_norm/newNorm[0] <<
"... another step of Gram-Schmidt.\n";
1396 *out <<
"eps*origNorm == " << eps_*origNorm[0] <<
"... another step of Gram-Schmidt.\n";
1404 #ifdef ANASAZI_ICGS_DEBUG
1405 *out <<
"Orthogonalizing X[" << j <<
"]...\n";
1407 MVT::MvTimesMatAddMv( -ONE, *prevX, P2, ONE, *Xj );
1408 if ((this->_hasOp)) {
1409 #ifdef ANASAZI_ICGS_DEBUG
1410 *out <<
"Updating MX[" << j <<
"]...\n";
1412 MVT::MvTimesMatAddMv( -ONE, *prevMX, P2, ONE, *MXj );
1416 product_norm = P2.normOne();
1417 #ifdef ANASAZI_ICGS_DEBUG
1418 *out <<
"newNorm2 = " << newNorm2[0] <<
"\n";
1419 *out <<
"product_norm = " << product_norm <<
"\n";
1421 if ( product_norm/newNorm2[0] >= tol_ || newNorm2[0] < eps_*origNorm[0] ) {
1423 #ifdef ANASAZI_ICGS_DEBUG
1424 if (product_norm/newNorm2[0] >= tol_) {
1425 *out <<
"product_norm/newNorm2 == " << product_norm/newNorm2[0] <<
"... setting vector to zero.\n";
1427 else if (newNorm[0] < newNorm2[0]) {
1428 *out <<
"newNorm2 > newNorm... setting vector to zero.\n";
1431 *out <<
"eps*origNorm == " << eps_*origNorm[0] <<
"... setting vector to zero.\n";
1434 MVT::MvInit(*Xj,ZERO);
1435 if ((this->_hasOp)) {
1436 #ifdef ANASAZI_ICGS_DEBUG
1437 *out <<
"Setting MX[" << j <<
"] to zero as well.\n";
1439 MVT::MvInit(*MXj,ZERO);
1446 if (numTrials == 0) {
1447 for (
int i=0; i<numX; i++) {
1448 B(i,j) = product(i,0);
1454 if ( newNorm[0] != ZERO && newNorm[0] > SCT::sfmin() ) {
1455 #ifdef ANASAZI_ICGS_DEBUG
1456 *out <<
"Normalizing X[" << j <<
"], norm(X[" << j <<
"]) = " << newNorm[0] <<
"\n";
1460 MVT::MvScale( *Xj, ONE/newNorm[0]);
1462 #ifdef ANASAZI_ICGS_DEBUG
1463 *out <<
"Normalizing M*X[" << j <<
"]...\n";
1466 MVT::MvScale( *MXj, ONE/newNorm[0]);
1470 if (numTrials == 0) {
1471 B(j,j) = newNorm[0];
1479 #ifdef ANASAZI_ICGS_DEBUG
1480 *out <<
"Not normalizing M*X[" << j <<
"]...\n";
1487 if (completeBasis) {
1489 #ifdef ANASAZI_ICGS_DEBUG
1490 *out <<
"Inserting random vector in X[" << j <<
"]...\n";
1492 MVT::MvRandom( *Xj );
1494 #ifdef ANASAZI_ICGS_DEBUG
1495 *out <<
"Updating M*X[" << j <<
"]...\n";
1497 OPT::Apply( *(this->_Op), *Xj, *MXj );
1498 this->_OpCounter += MVT::GetNumberVecs(*Xj);
1509 if (rankDef ==
true) {
1511 "Anasazi::ICGSOrthoManager::findBasis(): Unable to complete basis" );
1512 #ifdef ANASAZI_ICGS_DEBUG
1513 *out <<
"Returning early, rank " << j <<
" from Anasazi::ICGSOrthoManager::findBasis(...)\n";
1520 #ifdef ANASAZI_ICGS_DEBUG
1521 *out <<
"Returning " << xc <<
" from Anasazi::ICGSOrthoManager::findBasis(...)\n";
1528 #endif // ANASAZI_ICSG_ORTHOMANAGER_HPP
Declaration of basic traits for the multivector type.
basic_FancyOStream & setShowProcRank(const bool showProcRank)
~ICGSOrthoManager()
Destructor.
Teuchos::ScalarTraits< ScalarType >::magnitudeType orthogErrorMat(const MV &X1, const MV &X2, Teuchos::RCP< const MV > MX1, Teuchos::RCP< const MV > MX2) const
This method computes the error in orthogonality of two multivectors, measured as the Frobenius norm o...
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Virtual base class which defines basic traits for the operator type.
void POTRS(const char &UPLO, const OrdinalType &n, const OrdinalType &nrhs, const ScalarType *A, const OrdinalType &lda, ScalarType *B, const OrdinalType &ldb, OrdinalType *info) const
void projectGen(MV &S, Teuchos::Array< Teuchos::RCP< const MV > > X, Teuchos::Array< Teuchos::RCP< const MV > > Y, bool isBiOrtho, Teuchos::Array< Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > > C=Teuchos::tuple(Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > >(Teuchos::null)), Teuchos::RCP< MV > MS=Teuchos::null, Teuchos::Array< Teuchos::RCP< const MV > > MX=Teuchos::tuple(Teuchos::RCP< const MV >(Teuchos::null)), Teuchos::Array< Teuchos::RCP< const MV > > MY=Teuchos::tuple(Teuchos::RCP< const MV >(Teuchos::null))) const
Applies a series of generic projectors.
An implementation of the Anasazi::GenOrthoManager that performs orthogonalization using iterated clas...
ICGSOrthoManager(Teuchos::RCP< const OP > Op=Teuchos::null, int numIters=2, typename Teuchos::ScalarTraits< ScalarType >::magnitudeType eps=0.0, typename Teuchos::ScalarTraits< ScalarType >::magnitudeType tol=0.20)
Constructor specifying the operator defining the inner product as well as the number of orthogonaliza...
Templated virtual class for providing orthogonalization/orthonormalization methods with matrix-based ...
void innerProdMat(const MV &X, const MV &Y, Teuchos::SerialDenseMatrix< int, ScalarType > &Z, Teuchos::RCP< const MV > MX=Teuchos::null, Teuchos::RCP< const MV > MY=Teuchos::null) const
Provides a matrix-based inner product.
ScalarTraits< ScalarType >::magnitudeType normFrobenius() const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void POTRF(const char &UPLO, const OrdinalType &n, ScalarType *A, const OrdinalType &lda, OrdinalType *info) const
Teuchos::ScalarTraits< ScalarType >::magnitudeType orthonormErrorMat(const MV &X, Teuchos::RCP< const MV > MX=Teuchos::null) const
This method computes the error in orthonormality of a multivector, measured as the Frobenius norm of ...
Traits class which defines basic operations on multivectors.
Virtual base class which defines basic traits for the operator type.
basic_FancyOStream & setShowAllFrontMatter(const bool showAllFrontMatter)
Anasazi header file which uses auto-configuration information to include necessary C++ headers...
Exception thrown to signal error in an orthogonalization manager method.
int projectAndNormalizeMat(MV &X, Teuchos::Array< Teuchos::RCP< const MV > > Q, Teuchos::Array< Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > > C=Teuchos::tuple(Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > >(Teuchos::null)), Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > B=Teuchos::null, Teuchos::RCP< MV > MX=Teuchos::null, Teuchos::Array< Teuchos::RCP< const MV > > MQ=Teuchos::tuple(Teuchos::RCP< const MV >(Teuchos::null))) const
Given a set of bases Q[i] and a multivector X, this method computes an orthonormal basis for ...
static magnitudeType magnitude(ScalarTypea)
int projectAndNormalizeGen(MV &S, Teuchos::Array< Teuchos::RCP< const MV > > X, Teuchos::Array< Teuchos::RCP< const MV > > Y, bool isBiOrtho, Teuchos::Array< Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > > C=Teuchos::tuple(Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > >(Teuchos::null)), Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > B=Teuchos::null, Teuchos::RCP< MV > MS=Teuchos::null, Teuchos::Array< Teuchos::RCP< const MV > > MX=Teuchos::tuple(Teuchos::RCP< const MV >(Teuchos::null)), Teuchos::Array< Teuchos::RCP< const MV > > MY=Teuchos::tuple(Teuchos::RCP< const MV >(Teuchos::null))) const
Applies a series of generic projectors and returns an orthonormal basis for the residual data...
int normalizeMat(MV &X, Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > B=Teuchos::null, Teuchos::RCP< MV > MX=Teuchos::null) const
This method takes a multivector X and attempts to compute an orthonormal basis for ...
int getNumIters() const
Return parameter for re-orthogonalization threshold.
ScalarType LAMCH(const char &CMACH) const
void normMat(const MV &X, std::vector< typename Teuchos::ScalarTraits< ScalarType >::magnitudeType > &normvec, Teuchos::RCP< const MV > MX=Teuchos::null) const
Provides the norm induced by the matrix-based inner product.
void projectMat(MV &X, Teuchos::Array< Teuchos::RCP< const MV > > Q, Teuchos::Array< Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > > C=Teuchos::tuple(Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > >(Teuchos::null)), Teuchos::RCP< MV > MX=Teuchos::null, Teuchos::Array< Teuchos::RCP< const MV > > MQ=Teuchos::tuple(Teuchos::RCP< const MV >(Teuchos::null))) const
Given a list of mutually orthogonal and internally orthonormal bases Q, this method projects a multiv...
void setNumIters(int numIters)
Set parameter for re-orthogonalization threshold.