34 #ifndef ANASAZI_ICSG_ORTHOMANAGER_HPP 35 #define ANASAZI_ICSG_ORTHOMANAGER_HPP 51 #ifdef ANASAZI_ICGS_DEBUG 52 # include <Teuchos_FancyOStream.hpp> 57 template<
class ScalarType,
class MV,
class OP>
371 numIters_ = numIters;
373 "Anasazi::ICGSOrthoManager::setNumIters(): input must be >= 1.");
391 bool completeBasis,
int howMany = -1)
const;
398 template<
class ScalarType,
class MV,
class OP>
407 "Anasazi::ICGSOrthoManager::ICGSOrthoManager(): argument \"eps\" must be non-negative.");
410 eps_ = lapack.
LAMCH(
'E');
415 std::invalid_argument,
416 "Anasazi::ICGSOrthoManager::ICGSOrthoManager(): argument \"tol\" must be in [0,1].");
423 template<
class ScalarType,
class MV,
class OP>
430 for (
int i=0; i<rank; i++) {
440 template<
class ScalarType,
class MV,
class OP>
453 template<
class ScalarType,
class MV,
class OP>
469 template<
class ScalarType,
class MV,
class OP>
484 if (MX == Teuchos::null) {
494 if ( B == Teuchos::null ) {
503 "Anasazi::ICGSOrthoManager::normalizeMat(): X must be non-empty" );
505 "Anasazi::ICGSOrthoManager::normalizeMat(): Size of X not consistent with size of B" );
507 "Anasazi::ICGSOrthoManager::normalizeMat(): Size of X not consistent with size of MX" );
508 TEUCHOS_TEST_FOR_EXCEPTION( static_cast<ptrdiff_t>(xc) > xr, std::invalid_argument,
509 "Anasazi::ICGSOrthoManager::normalizeMat(): Size of X not feasible for normalization" );
511 return findBasis(X, MX, *B,
true );
518 template<
class ScalarType,
class MV,
class OP>
534 template<
class ScalarType,
class MV,
class OP>
561 #ifdef ANASAZI_ICGS_DEBUG 564 out = Teuchos::getFancyOStream(Teuchos::rcpFromRef(std::cout));
566 *out <<
"Entering Anasazi::ICGSOrthoManager::projectGen(...)\n";
576 int numxy = X.length();
578 "Anasazi::ICGSOrthoManager::projectGen(): X and Y must contain the same number of multivectors.");
579 std::vector<int> xyc(numxy);
581 if (numxy == 0 || sc == 0 || sr == 0) {
582 #ifdef ANASAZI_ICGS_DEBUG 583 *out <<
"Leaving Anasazi::ICGSOrthoManager::projectGen(...)\n";
598 "Anasazi::ICGSOrthoManager::projectGen(): MVT returned negative dimensions for S." );
601 if (this->_hasOp ==
true) {
602 if (MS != Teuchos::null) {
604 "Anasazi::ICGSOrthoManager::projectGen(): MS length not consistent with S." );
606 "Anasazi::ICGSOrthoManager::projectGen(): MS width not consistent with S." );
611 ptrdiff_t sumxyc = 0;
614 for (
int i=0; i<numxy; i++) {
615 if (X[i] != Teuchos::null && Y[i] != Teuchos::null) {
617 "Anasazi::ICGSOrthoManager::projectGen(): X[" << i <<
"] length not consistent with S." );
619 "Anasazi::ICGSOrthoManager::projectGen(): Y[" << i <<
"] length not consistent with S." );
621 "Anasazi::ICGSOrthoManager::projectGen(): X[" << i <<
"] and Y[" << i <<
"] widths not consistent." );
625 "Anasazi::ICGSOrthoManager::projectGen(): X[" << i <<
"],Y[" << i <<
"] have less rows than columns, and therefore cannot be full rank." );
629 if ( C[i] == Teuchos::null ) {
634 "Anasazi::ICGSOrthoManager::projectGen(): Size of Q not consistent with size of C." );
638 if (MX[i] != Teuchos::null) {
640 "Anasazi::ICGSOrthoManager::projectGen(): Size of MX[" << i <<
"] not consistent with size of X[" << i <<
"]." );
645 if (MY[i] != Teuchos::null) {
647 "Anasazi::ICGSOrthoManager::projectGen(): Size of MY[" << i <<
"] not consistent with size of Y[" << i <<
"]." );
656 "Anasazi::ICGSOrthoManager::projectGen(): " 657 << (X[i] == Teuchos::null ?
"Y[" :
"X[") << i <<
"] was provided but " 658 << (X[i] == Teuchos::null ?
"X[" :
"Y[") << i <<
"] was not.");
664 "Anasazi::ICGSOrthoManager::projectGen(): dimension of all X[i],Y[i] is " 665 << sumxyc <<
", but length of vectors is only " << sr <<
". This is infeasible.");
700 if (MXmissing == 0) {
703 if (MYmissing == 0) {
710 switch (whichAlloc) {
726 if (MS == Teuchos::null) {
727 #ifdef ANASAZI_ICGS_DEBUG 728 *out <<
"Allocating MS...\n";
736 if (whichAlloc == 0) {
738 for (
int i=0; i<numxy; i++) {
739 if (MX[i] == Teuchos::null) {
740 #ifdef ANASAZI_ICGS_DEBUG 741 *out <<
"Allocating MX[" << i <<
"]...\n";
746 this->_OpCounter += xyc[i];
753 MS = Teuchos::rcpFromRef(S);
757 "Anasazi::ICGSOrthoManager::projectGen(): Error in updateMS logic.");
767 if (isBiortho ==
false) {
768 for (
int i=0; i<numxy; i++) {
769 #ifdef ANASAZI_ICGS_DEBUG 770 *out <<
"Computing YMX[" << i <<
"] and its Cholesky factorization...\n";
774 #ifdef ANASAZI_ICGS_DEBUG 781 MagnitudeType err = ZERO;
782 for (
int jj=0; jj<YMX[i]->numCols(); jj++) {
784 for (
int ii=jj; ii<YMX[i]->numRows(); ii++) {
788 *out <<
"Symmetry error in YMX[" << i <<
"] == " << err <<
"\n";
793 lapack.
POTRF(
'U',YMX[i]->numRows(),YMX[i]->values(),YMX[i]->stride(),&info);
795 "Anasazi::ICGSOrthoManager::projectGen(): Error computing Cholesky factorization of Y[i]^T * M * X[i] using POTRF: returned info " << info);
800 #ifdef ANASAZI_ICGS_DEBUG 801 std::vector<MagnitudeType> oldNorms(sc);
803 *out <<
"oldNorms = { ";
804 std::copy(oldNorms.begin(), oldNorms.end(), std::ostream_iterator<MagnitudeType>(*out,
" "));
811 for (
int i=0; i<numxy; i++) {
812 C[i]->putScalar(ZERO);
813 Ccur[i].reshape(C[i]->numRows(),C[i]->numCols());
816 for (
int iter=0; iter < numIters_; iter++) {
817 #ifdef ANASAZI_ICGS_DEBUG 818 *out <<
"beginning iteration " << iter+1 <<
"\n";
822 for (
int i=0; i<numxy; i++) {
825 if (isBiortho ==
false) {
828 lapack.
POTRS(
'U',YMX[i]->numCols(),Ccur[i].numCols(),
829 YMX[i]->values(),YMX[i]->stride(),
830 Ccur[i].values(),Ccur[i].stride(), &info);
832 "Anasazi::ICGSOrthoManager::projectGen(): Error code " << info <<
" from lapack::POTRS." );
836 #ifdef ANASAZI_ICGS_DEBUG 837 *out <<
"Applying projector P_{X[" << i <<
"],Y[" << i <<
"]}...\n";
846 #ifdef ANASAZI_ICGS_DEBUG 847 *out <<
"Updating MS...\n";
850 this->_OpCounter += sc;
852 else if (updateMS == 2) {
853 #ifdef ANASAZI_ICGS_DEBUG 854 *out <<
"Updating MS...\n";
861 #ifdef ANASAZI_ICGS_DEBUG 862 std::vector<MagnitudeType> newNorms(sc);
864 *out <<
"newNorms = { ";
865 std::copy(newNorms.begin(), newNorms.end(), std::ostream_iterator<MagnitudeType>(*out,
" "));
870 #ifdef ANASAZI_ICGS_DEBUG 871 *out <<
"Leaving Anasazi::ICGSOrthoManager::projectGen(...)\n";
879 template<
class ScalarType,
class MV,
class OP>
907 #ifdef ANASAZI_ICGS_DEBUG 910 out = Teuchos::getFancyOStream(Teuchos::rcpFromRef(std::cout));
912 *out <<
"Entering Anasazi::ICGSOrthoManager::projectAndNormalizeGen(...)\n";
918 int numxy = X.length();
920 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): X and Y must contain the same number of multivectors.");
921 std::vector<int> xyc(numxy);
923 if (sc == 0 || sr == 0) {
924 #ifdef ANASAZI_ICGS_DEBUG 925 *out <<
"Leaving Anasazi::ICGSOrthoManager::projectGen(...)\n";
940 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): MVT returned negative dimensions for S." );
943 if (this->_hasOp ==
true) {
944 if (MS != Teuchos::null) {
946 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): MS length not consistent with S." );
948 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): MS width not consistent with S." );
953 ptrdiff_t sumxyc = 0;
956 for (
int i=0; i<numxy; i++) {
957 if (X[i] != Teuchos::null && Y[i] != Teuchos::null) {
959 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): X[" << i <<
"] length not consistent with S." );
961 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): Y[" << i <<
"] length not consistent with S." );
963 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): X[" << i <<
"] and Y[" << i <<
"] widths not consistent." );
967 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): X[" << i <<
"],Y[" << i <<
"] have less rows than columns, and therefore cannot be full rank." );
971 if ( C[i] == Teuchos::null ) {
976 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): Size of Q not consistent with size of C." );
980 if (MX[i] != Teuchos::null) {
982 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): Size of MX[" << i <<
"] not consistent with size of X[" << i <<
"]." );
987 if (MY[i] != Teuchos::null) {
989 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): Size of MY[" << i <<
"] not consistent with size of Y[" << i <<
"]." );
998 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): " 999 << (X[i] == Teuchos::null ?
"Y[" :
"X[") << i <<
"] was provided but " 1000 << (X[i] == Teuchos::null ?
"X[" :
"Y[") << i <<
"] was not.");
1006 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): dimension of all X[i],Y[i] is " 1007 << sumxyc <<
" and requested " << sc <<
"-dimensional basis, but length of vectors is only " 1008 << sr <<
". This is infeasible.");
1043 if (MXmissing == 0) {
1046 if (MYmissing == 0) {
1053 switch (whichAlloc) {
1069 if (MS == Teuchos::null) {
1070 #ifdef ANASAZI_ICGS_DEBUG 1071 *out <<
"Allocating MS...\n";
1079 if (whichAlloc == 0) {
1081 for (
int i=0; i<numxy; i++) {
1082 if (MX[i] == Teuchos::null) {
1083 #ifdef ANASAZI_ICGS_DEBUG 1084 *out <<
"Allocating MX[" << i <<
"]...\n";
1089 this->_OpCounter += xyc[i];
1096 MS = Teuchos::rcpFromRef(S);
1100 "Anasazi::ICGSOrthoManager::projectGen(): Error in updateMS logic.");
1105 if ( B == Teuchos::null ) {
1111 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): Size of S must be consistent with size of B" );
1124 int curssize = sc - rank;
1129 #ifdef ANASAZI_ICGS_DEBUG 1130 *out <<
"Attempting to find orthonormal basis for X...\n";
1132 rank = findBasis(S,MS,*B,
false,curssize);
1134 if (oldrank != -1 && rank != oldrank) {
1140 for (
int i=0; i<sc; i++) {
1141 (*B)(i,oldrank) = oldCoeff(i,0);
1146 if (rank != oldrank) {
1154 for (
int i=0; i<sc; i++) {
1155 oldCoeff(i,0) = (*B)(i,rank);
1162 #ifdef ANASAZI_ICGS_DEBUG 1163 *out <<
"Finished computing basis.\n";
1169 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): basis lost rank; this shouldn't happen");
1171 if (rank != oldrank) {
1179 if (numTries <= 0) {
1187 #ifdef ANASAZI_ICGS_DEBUG 1188 *out <<
"Inserting random vector in X[" << rank <<
"]. Attempt " << 10-numTries <<
".\n";
1191 std::vector<int> ind(1);
1196 #ifdef ANASAZI_ICGS_DEBUG 1197 *out <<
"Applying operator to random vector.\n";
1210 projectGen(*curS,X,Y,isBiortho,dummyC,curMS,MX,MY);
1217 "Anasazi::ICGSOrthoManager::projectAndNormalizeGen(): Debug error in rank variable." );
1219 #ifdef ANASAZI_ICGS_DEBUG 1220 *out <<
"Returning " << rank <<
" from Anasazi::ICGSOrthoManager::projectAndNormalizeGen(...)\n";
1231 template<
class ScalarType,
class MV,
class OP>
1235 bool completeBasis,
int howMany )
const {
1252 #ifdef ANASAZI_ICGS_DEBUG 1255 out = Teuchos::getFancyOStream(Teuchos::rcpFromRef(std::cout));
1257 *out <<
"Entering Anasazi::ICGSOrthoManager::findBasis(...)\n";
1265 if (howMany == -1) {
1273 "Anasazi::ICGSOrthoManager::findBasis(): calling routine did not specify MS.");
1275 "Anasazi::ICGSOrthoManager::findBasis(): Invalid howMany parameter" );
1280 int xstart = xc - howMany;
1282 for (
int j = xstart; j < xc; j++) {
1291 for (
int i=j+1; i<xc; ++i) {
1296 std::vector<int> index(1);
1300 if ((this->_hasOp)) {
1310 std::vector<int> prev_idx( numX );
1314 for (
int i=0; i<numX; ++i) prev_idx[i] = i;
1321 bool rankDef =
true;
1326 for (
int numTrials = 0; numTrials < 10; numTrials++) {
1327 #ifdef ANASAZI_ICGS_DEBUG 1328 *out <<
"Trial " << numTrials <<
" for vector " << j <<
"\n";
1333 std::vector<MagnitudeType> origNorm(1), newNorm(1), newNorm2(1);
1340 #ifdef ANASAZI_ICGS_DEBUG 1341 *out <<
"origNorm = " << origNorm[0] <<
"\n";
1352 #ifdef ANASAZI_ICGS_DEBUG 1353 *out <<
"Orthogonalizing X[" << j <<
"]...\n";
1362 #ifdef ANASAZI_ICGS_DEBUG 1363 *out <<
"Updating MX[" << j <<
"]...\n";
1370 MagnitudeType product_norm = product.
normOne();
1372 #ifdef ANASAZI_ICGS_DEBUG 1373 *out <<
"newNorm = " << newNorm[0] <<
"\n";
1374 *out <<
"prodoct_norm = " << product_norm <<
"\n";
1378 if ( product_norm/newNorm[0] >= tol_ || newNorm[0] < eps_*origNorm[0]) {
1379 #ifdef ANASAZI_ICGS_DEBUG 1380 if (product_norm/newNorm[0] >= tol_) {
1381 *out <<
"product_norm/newNorm == " << product_norm/newNorm[0] <<
"... another step of Gram-Schmidt.\n";
1384 *out <<
"eps*origNorm == " << eps_*origNorm[0] <<
"... another step of Gram-Schmidt.\n";
1392 #ifdef ANASAZI_ICGS_DEBUG 1393 *out <<
"Orthogonalizing X[" << j <<
"]...\n";
1396 if ((this->_hasOp)) {
1397 #ifdef ANASAZI_ICGS_DEBUG 1398 *out <<
"Updating MX[" << j <<
"]...\n";
1405 #ifdef ANASAZI_ICGS_DEBUG 1406 *out <<
"newNorm2 = " << newNorm2[0] <<
"\n";
1407 *out <<
"product_norm = " << product_norm <<
"\n";
1409 if ( product_norm/newNorm2[0] >= tol_ || newNorm2[0] < eps_*origNorm[0] ) {
1411 #ifdef ANASAZI_ICGS_DEBUG 1412 if (product_norm/newNorm2[0] >= tol_) {
1413 *out <<
"product_norm/newNorm2 == " << product_norm/newNorm2[0] <<
"... setting vector to zero.\n";
1415 else if (newNorm[0] < newNorm2[0]) {
1416 *out <<
"newNorm2 > newNorm... setting vector to zero.\n";
1419 *out <<
"eps*origNorm == " << eps_*origNorm[0] <<
"... setting vector to zero.\n";
1423 if ((this->_hasOp)) {
1424 #ifdef ANASAZI_ICGS_DEBUG 1425 *out <<
"Setting MX[" << j <<
"] to zero as well.\n";
1434 if (numTrials == 0) {
1435 for (
int i=0; i<numX; i++) {
1436 B(i,j) = product(i,0);
1442 if ( newNorm[0] != ZERO && newNorm[0] >
SCT::sfmin() ) {
1443 #ifdef ANASAZI_ICGS_DEBUG 1444 *out <<
"Normalizing X[" << j <<
"], norm(X[" << j <<
"]) = " << newNorm[0] <<
"\n";
1450 #ifdef ANASAZI_ICGS_DEBUG 1451 *out <<
"Normalizing M*X[" << j <<
"]...\n";
1458 if (numTrials == 0) {
1459 B(j,j) = newNorm[0];
1467 #ifdef ANASAZI_ICGS_DEBUG 1468 *out <<
"Not normalizing M*X[" << j <<
"]...\n";
1475 if (completeBasis) {
1477 #ifdef ANASAZI_ICGS_DEBUG 1478 *out <<
"Inserting random vector in X[" << j <<
"]...\n";
1482 #ifdef ANASAZI_ICGS_DEBUG 1483 *out <<
"Updating M*X[" << j <<
"]...\n";
1497 if (rankDef ==
true) {
1499 "Anasazi::ICGSOrthoManager::findBasis(): Unable to complete basis" );
1500 #ifdef ANASAZI_ICGS_DEBUG 1501 *out <<
"Returning early, rank " << j <<
" from Anasazi::ICGSOrthoManager::findBasis(...)\n";
1508 #ifdef ANASAZI_ICGS_DEBUG 1509 *out <<
"Returning " << xc <<
" from Anasazi::ICGSOrthoManager::findBasis(...)\n";
1516 #endif // ANASAZI_ICSG_ORTHOMANAGER_HPP ScalarTraits< ScalarType >::magnitudeType normOne() const
static void MvInit(MV &mv, const ScalarType alpha=Teuchos::ScalarTraits< ScalarType >::zero())
Replace each element of the vectors in mv with alpha.
static void MvRandom(MV &mv)
Replace the vectors in mv with random vectors.
static void MvTimesMatAddMv(const ScalarType alpha, const MV &A, const Teuchos::SerialDenseMatrix< int, ScalarType > &B, const ScalarType beta, MV &mv)
Update mv with .
An extension of the MultiVecTraits class that adds a new vector length method.This traits class provi...
static ptrdiff_t GetGlobalLength(const MV &mv)
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 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.
ScalarType LAMCH(const char CMACH) const
static void Apply(const OP &Op, const MV &x, MV &y)
Application method which performs operation y = Op*x. An OperatorError exception is thrown if there i...
static magnitudeType sfmin()
ScalarTraits< ScalarType >::magnitudeType normFrobenius() const
Namespace Anasazi contains the classes, structs, enums and utilities used by the Anasazi package...
static ScalarType conjugate(ScalarType a)
void POTRF(const char UPLO, const OrdinalType n, ScalarType *A, const OrdinalType lda, OrdinalType *info) const
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
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
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.
static Teuchos::RCP< MV > CloneCopy(const MV &mv)
Creates a new MV and copies contents of mv into the new vector (deep copy).
Virtual base class which defines basic traits for the operator type.
static void MvScale(MV &mv, const ScalarType alpha)
Scale each element of the vectors in mv with alpha.
basic_FancyOStream & setShowAllFrontMatter(const bool showAllFrontMatter)
Anasazi header file which uses auto-configuration information to include necessary C++ headers...
static Teuchos::RCP< MV > CloneViewNonConst(MV &mv, const std::vector< int > &index)
Creates a new MV that shares the selected contents of mv (shallow copy).
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 Teuchos::RCP< const MV > CloneView(const MV &mv, const std::vector< int > &index)
Creates a new const MV that shares the selected contents of mv (shallow copy).
static magnitudeType imag(ScalarType a)
static magnitudeType magnitude(ScalarType a)
static int GetNumberVecs(const MV &mv)
Obtain the number of vectors in mv.
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.
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...
static Teuchos::RCP< MV > Clone(const MV &mv, const int numvecs)
Creates a new empty MV containing numvecs columns.
void setNumIters(int numIters)
Set parameter for re-orthogonalization threshold.