51#ifndef BELOS_DGKS_ORTHOMANAGER_MP_VECTOR_HPP
52#define BELOS_DGKS_ORTHOMANAGER_MP_VECTOR_HPP
55#include "BelosDGKSOrthoManager.hpp"
59 template<
class Storage,
class MV,
class OP>
60 class DGKSOrthoManager<
Sacado::MP::Vector<Storage>,MV,OP> :
61 public MatOrthoManager<Sacado::MP::Vector<Storage>,MV,OP>
65 typedef typename Teuchos::ScalarTraits<ScalarType>::magnitudeType
MagnitudeType;
66 typedef typename Teuchos::ScalarTraits<MagnitudeType>
MGT;
67 typedef Teuchos::ScalarTraits<ScalarType>
SCT;
68 typedef MultiVecTraits<ScalarType,MV>
MVT;
69 typedef OperatorTraits<ScalarType,MV,OP>
OPT;
77 Teuchos::RCP<const OP> Op = Teuchos::null,
78 const int max_blk_ortho = max_blk_ortho_default_,
83 max_blk_ortho_( max_blk_ortho ),
86 sing_tol_( sing_tol ),
89#ifdef BELOS_TEUCHOS_TIME_MONITOR
91 ss << label_ +
": DGKS[" << max_blk_ortho_ <<
"]";
93 std::string orthoLabel = ss.str() +
": Orthogonalization";
94 timerOrtho_ = Teuchos::TimeMonitor::getNewCounter(orthoLabel);
96 std::string updateLabel = ss.str() +
": Ortho (Update)";
97 timerUpdate_ = Teuchos::TimeMonitor::getNewCounter(updateLabel);
99 std::string normLabel = ss.str() +
": Ortho (Norm)";
100 timerNorm_ = Teuchos::TimeMonitor::getNewCounter(normLabel);
102 std::string ipLabel = ss.str() +
": Ortho (Inner Product)";
103 timerInnerProd_ = Teuchos::TimeMonitor::getNewCounter(ipLabel);
109 const std::string& label =
"Belos",
110 Teuchos::RCP<const OP> Op = Teuchos::null)
112 max_blk_ortho_ ( max_blk_ortho_default_ ),
113 blk_tol_ ( blk_tol_default_ ),
114 dep_tol_ ( dep_tol_default_ ),
115 sing_tol_ ( sing_tol_default_ ),
118 setParameterList (plist);
120#ifdef BELOS_TEUCHOS_TIME_MONITOR
121 std::stringstream ss;
122 ss << label_ +
": DGKS[" << max_blk_ortho_ <<
"]";
124 std::string orthoLabel = ss.str() +
": Orthogonalization";
125 timerOrtho_ = Teuchos::TimeMonitor::getNewCounter(orthoLabel);
127 std::string updateLabel = ss.str() +
": Ortho (Update)";
128 timerUpdate_ = Teuchos::TimeMonitor::getNewCounter(updateLabel);
130 std::string normLabel = ss.str() +
": Ortho (Norm)";
131 timerNorm_ = Teuchos::TimeMonitor::getNewCounter(normLabel);
133 std::string ipLabel = ss.str() +
": Ortho (Inner Product)";
134 timerInnerProd_ = Teuchos::TimeMonitor::getNewCounter(ipLabel);
148 using Teuchos::ParameterList;
149 using Teuchos::parameterList;
152 RCP<const ParameterList> defaultParams = getValidParameters();
153 RCP<ParameterList> params;
154 if (plist.is_null()) {
156 params = parameterList (*defaultParams);
159 params->validateParametersAndSetDefaults (*defaultParams);
167 const int maxNumOrthogPasses = params->get<
int> (
"maxNumOrthogPasses");
172 max_blk_ortho_ = maxNumOrthogPasses;
177 this->setMyParamList (params);
180 Teuchos::RCP<const Teuchos::ParameterList>
183 if (defaultParams_.is_null()) {
184 defaultParams_ = Belos::getDGKSDefaultParameters<ScalarType, MV, OP>();
187 return defaultParams_;
198 Teuchos::RCP<Teuchos::ParameterList> params = this->getNonconstParameterList();
199 if (! params.is_null()) {
204 params->set (
"blkTol", blk_tol);
212 Teuchos::RCP<Teuchos::ParameterList> params = this->getNonconstParameterList();
213 if (! params.is_null()) {
214 params->set (
"depTol", dep_tol);
222 Teuchos::RCP<Teuchos::ParameterList> params = this->getNonconstParameterList();
223 if (! params.is_null()) {
224 params->set (
"singTol", sing_tol);
226 sing_tol_ = sing_tol;
272 Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > > C,
273 Teuchos::ArrayView<Teuchos::RCP<const MV> > Q)
const;
279 Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > > C,
280 Teuchos::ArrayView<Teuchos::RCP<const MV> > Q)
const {
281 project(X,Teuchos::null,C,Q);
311 Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > B)
const;
316 int normalize ( MV &X, Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > B )
const {
317 return normalize(X,Teuchos::null,B);
380 Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > > C,
381 Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > B,
382 Teuchos::ArrayView<Teuchos::RCP<const MV> > Q)
const;
394 typename Teuchos::ScalarTraits<ScalarType>::magnitudeType
396 return orthonormError(X,Teuchos::null);
405 typename Teuchos::ScalarTraits<ScalarType>::magnitudeType
411 typename Teuchos::ScalarTraits<ScalarType>::magnitudeType
413 return orthogError(X1,Teuchos::null,X2);
420 typename Teuchos::ScalarTraits<ScalarType>::magnitudeType
421 orthogError(
const MV &X1, Teuchos::RCP<const MV> MX1,
const MV &X2)
const;
434 const std::string&
getLabel()
const {
return label_; }
474#ifdef BELOS_TEUCHOS_TIME_MONITOR
475 Teuchos::RCP<Teuchos::Time> timerOrtho_, timerUpdate_, timerNorm_, timerInnerProd_;
483 Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > C,
484 bool completeBasis,
int howMany = -1 )
const;
488 Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > > C,
489 Teuchos::ArrayView<Teuchos::RCP<const MV> > Q)
const;
493 Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > > C,
494 Teuchos::ArrayView<Teuchos::RCP<const MV> > Q)
const;
510 Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > > C,
511 Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > B,
512 Teuchos::ArrayView<Teuchos::RCP<const MV> > QQ)
const;
516 template<
class StorageType,
class MV,
class OP>
517 const int DGKSOrthoManager<Sacado::MP::Vector<StorageType>,MV,OP>::max_blk_ortho_default_ = 2;
519 template<
class StorageType,
class MV,
class OP>
520 const typename DGKSOrthoManager<Sacado::MP::Vector<StorageType>,MV,OP>::MagnitudeType
521 DGKSOrthoManager<Sacado::MP::Vector<StorageType>,MV,OP>::blk_tol_default_
522 = 10*Teuchos::ScalarTraits<typename DGKSOrthoManager<ScalarType,MV,OP>::MagnitudeType>::squareroot(
523 Teuchos::ScalarTraits<
typename DGKSOrthoManager<ScalarType,MV,OP>::MagnitudeType>::eps() );
525 template<
class StorageType,
class MV,
class OP>
526 const typename DGKSOrthoManager<Sacado::MP::Vector<StorageType>,MV,OP>::MagnitudeType
527 DGKSOrthoManager<Sacado::MP::Vector<StorageType>,MV,OP>::dep_tol_default_
528 = Teuchos::ScalarTraits<typename DGKSOrthoManager<Sacado::MP::Vector<StorageType>,MV,OP>::MagnitudeType>::one()
529 / Teuchos::ScalarTraits<typename DGKSOrthoManager<Sacado::MP::Vector<StorageType>,MV,OP>::MagnitudeType>::squareroot(
532 template<
class StorageType,
class MV,
class OP>
533 const typename DGKSOrthoManager<Sacado::MP::Vector<StorageType>,MV,OP>::MagnitudeType
534 DGKSOrthoManager<Sacado::MP::Vector<StorageType>,MV,OP>::sing_tol_default_
535 = 10*Teuchos::ScalarTraits<typename DGKSOrthoManager<Sacado::MP::Vector<StorageType>,MV,OP>::MagnitudeType>::eps();
537 template<
class StorageType,
class MV,
class OP>
538 const int DGKSOrthoManager<Sacado::MP::Vector<StorageType>,MV,OP>::max_blk_ortho_fast_ = 1;
540 template<
class StorageType,
class MV,
class OP>
541 const typename DGKSOrthoManager<Sacado::MP::Vector<StorageType>,MV,OP>::MagnitudeType
542 DGKSOrthoManager<Sacado::MP::Vector<StorageType>,MV,OP>::blk_tol_fast_
543 = Teuchos::ScalarTraits<typename DGKSOrthoManager<Sacado::MP::Vector<StorageType>,MV,OP>::MagnitudeType>::zero();
545 template<
class StorageType,
class MV,
class OP>
546 const typename DGKSOrthoManager<Sacado::MP::Vector<StorageType>,MV,OP>::MagnitudeType
547 DGKSOrthoManager<Sacado::MP::Vector<StorageType>,MV,OP>::dep_tol_fast_
548 = Teuchos::ScalarTraits<typename DGKSOrthoManager<Sacado::MP::Vector<StorageType>,MV,OP>::MagnitudeType>::zero();
550 template<
class StorageType,
class MV,
class OP>
551 const typename DGKSOrthoManager<Sacado::MP::Vector<StorageType>,MV,OP>::MagnitudeType
552 DGKSOrthoManager<Sacado::MP::Vector<StorageType>,MV,OP>::sing_tol_fast_
553 = Teuchos::ScalarTraits<typename DGKSOrthoManager<Sacado::MP::Vector<StorageType>,MV,OP>::MagnitudeType>::zero();
557 template<
class StorageType,
class MV,
class OP>
558 void DGKSOrthoManager<Sacado::MP::Vector<StorageType>,MV,OP>::setLabel(
const std::string& label)
560 if (label != label_) {
562#ifdef BELOS_TEUCHOS_TIME_MONITOR
563 std::stringstream ss;
564 ss << label_ +
": DGKS[" << max_blk_ortho_ <<
"]";
566 std::string orthoLabel = ss.str() +
": Orthogonalization";
567 timerOrtho_ = Teuchos::TimeMonitor::getNewCounter(orthoLabel);
569 std::string updateLabel = ss.str() +
": Ortho (Update)";
570 timerUpdate_ = Teuchos::TimeMonitor::getNewCounter(updateLabel);
572 std::string normLabel = ss.str() +
": Ortho (Norm)";
573 timerNorm_ = Teuchos::TimeMonitor::getNewCounter(normLabel);
575 std::string ipLabel = ss.str() +
": Ortho (Inner Product)";
576 timerInnerProd_ = Teuchos::TimeMonitor::getNewCounter(ipLabel);
583 template<
class StorageType,
class MV,
class OP>
584 typename Teuchos::ScalarTraits<Sacado::MP::Vector<StorageType> >::magnitudeType
585 DGKSOrthoManager<Sacado::MP::Vector<StorageType>,MV,OP>::orthonormError(
const MV &X, Teuchos::RCP<const MV> MX)
const {
586 const ScalarType ONE = SCT::one();
587 int rank = MVT::GetNumberVecs(X);
588 Teuchos::SerialDenseMatrix<int,ScalarType> xTx(rank,rank);
590#ifdef BELOS_TEUCHOS_TIME_MONITOR
591 Teuchos::TimeMonitor innerProdTimer( *timerInnerProd_ );
593 MatOrthoManager<ScalarType,MV,OP>::innerProd(X,X,MX,xTx);
595 for (
int i=0; i<rank; i++) {
598 return xTx.normFrobenius();
603 template<
class StorageType,
class MV,
class OP>
604 typename Teuchos::ScalarTraits<Sacado::MP::Vector<StorageType> >::magnitudeType
605 DGKSOrthoManager<Sacado::MP::Vector<StorageType>,MV,OP>::orthogError(
const MV &X1, Teuchos::RCP<const MV> MX1,
const MV &X2)
const {
606 int r1 = MVT::GetNumberVecs(X1);
607 int r2 = MVT::GetNumberVecs(X2);
608 Teuchos::SerialDenseMatrix<int,ScalarType> xTx(r2,r1);
610#ifdef BELOS_TEUCHOS_TIME_MONITOR
611 Teuchos::TimeMonitor innerProdTimer( *timerInnerProd_ );
613 MatOrthoManager<ScalarType,MV,OP>::innerProd(X2,X1,MX1,xTx);
615 return xTx.normFrobenius();
620 template<
class StorageType,
class MV,
class OP>
622 DGKSOrthoManager<Sacado::MP::Vector<StorageType>, MV, OP>::
623 projectAndNormalizeWithMxImpl (MV &X,
625 Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > > C,
626 Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > B,
627 Teuchos::ArrayView<Teuchos::RCP<const MV> > Q)
const
629 using Teuchos::Array;
631 using Teuchos::is_null;
634 using Teuchos::SerialDenseMatrix;
635 typedef SerialDenseMatrix< int, ScalarType > serial_dense_matrix_type;
636 typedef typename Array< RCP< const MV > >::size_type size_type;
638#ifdef BELOS_TEUCHOS_TIME_MONITOR
639 Teuchos::TimeMonitor orthotimer(*timerOrtho_);
642 ScalarType ONE = SCT::one();
643 const MagnitudeType ZERO = SCT::magnitude(SCT::zero());
646 int xc = MVT::GetNumberVecs( X );
647 ptrdiff_t xr = MVT::GetGlobalLength( X );
654 B = rcp (
new serial_dense_matrix_type (xc, xc));
664 for (size_type k = 0; k < nq; ++k)
666 const int numRows = MVT::GetNumberVecs (*Q[k]);
667 const int numCols = xc;
670 C[k] = rcp (
new serial_dense_matrix_type (numRows, numCols));
671 else if (C[k]->numRows() != numRows || C[k]->numCols() != numCols)
673 int err = C[k]->reshape (numRows, numCols);
674 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
675 "DGKS orthogonalization: failed to reshape "
676 "C[" << k <<
"] (the array of block "
677 "coefficients resulting from projecting X "
678 "against Q[1:" << nq <<
"]).");
684 if (MX == Teuchos::null) {
686 MX = MVT::Clone(X,MVT::GetNumberVecs(X));
687 OPT::Apply(*(this->_Op),X,*MX);
692 MX = Teuchos::rcp( &X,
false );
695 int mxc = MVT::GetNumberVecs( *MX );
696 ptrdiff_t mxr = MVT::GetGlobalLength( *MX );
699 TEUCHOS_TEST_FOR_EXCEPTION( xc == 0 || xr == 0, std::invalid_argument,
"Belos::DGKSOrthoManager::projectAndNormalize(): X must be non-empty" );
702 for (
int i=0; i<nq; i++) {
703 numbas += MVT::GetNumberVecs( *Q[i] );
707 TEUCHOS_TEST_FOR_EXCEPTION( B->numRows() != xc || B->numCols() != xc, std::invalid_argument,
708 "Belos::DGKSOrthoManager::projectAndNormalize(): Size of X must be consistant with size of B" );
710 TEUCHOS_TEST_FOR_EXCEPTION( xc<0 || xr<0 || mxc<0 || mxr<0, std::invalid_argument,
711 "Belos::DGKSOrthoManager::projectAndNormalize(): MVT returned negative dimensions for X,MX" );
713 TEUCHOS_TEST_FOR_EXCEPTION( xc!=mxc || xr!=mxr, std::invalid_argument,
714 "Belos::DGKSOrthoManager::projectAndNormalize(): Size of X must be consistant with size of MX" );
720 bool dep_flg =
false;
725 dep_flg = blkOrtho1( X, MX, C, Q );
727 if ( B == Teuchos::null ) {
728 B = Teuchos::rcp(
new Teuchos::SerialDenseMatrix<int,ScalarType>(xc,xc) );
730 std::vector<ScalarType>
diag(1);
732#ifdef BELOS_TEUCHOS_TIME_MONITOR
733 Teuchos::TimeMonitor normTimer( *timerNorm_ );
735 MVT::MvDot( X, *MX,
diag );
738 (*B)(0,0) = SCT::squareroot(SCT::magnitude(
diag[0]));
740 ScalarType scale = ONE;
745 MVT::MvScale( X, scale );
748 MVT::MvScale( *MX, scale );
753 Teuchos::RCP<MV> tmpX, tmpMX;
754 tmpX = MVT::CloneCopy(X);
756 tmpMX = MVT::CloneCopy(*MX);
759 dep_flg = blkOrtho( X, MX, C, Q );
764 rank = blkOrthoSing( *tmpX, tmpMX, C, B, Q );
766 MVT::Assign( *tmpX, X );
768 MVT::Assign( *tmpMX, *MX );
773 rank = findBasis( X, MX, B,
false );
777 rank = blkOrthoSing( *tmpX, tmpMX, C, B, Q );
779 MVT::Assign( *tmpX, X );
781 MVT::Assign( *tmpMX, *MX );
788 TEUCHOS_TEST_FOR_EXCEPTION( rank > xc || rank < 0, std::logic_error,
789 "Belos::DGKSOrthoManager::projectAndNormalize(): Debug error in rank variable." );
799 template<
class StorageType,
class MV,
class OP>
800 int DGKSOrthoManager<Sacado::MP::Vector<StorageType>, MV, OP>::normalize(
801 MV &X, Teuchos::RCP<MV> MX,
802 Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > B )
const {
804#ifdef BELOS_TEUCHOS_TIME_MONITOR
805 Teuchos::TimeMonitor orthotimer(*timerOrtho_);
808 return findBasis(X, MX, B,
true);
815 template<
class StorageType,
class MV,
class OP>
816 void DGKSOrthoManager<Sacado::MP::Vector<StorageType>, MV, OP>::project(
817 MV &X, Teuchos::RCP<MV> MX,
818 Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > > C,
819 Teuchos::ArrayView<Teuchos::RCP<const MV> > Q)
const {
835#ifdef BELOS_TEUCHOS_TIME_MONITOR
836 Teuchos::TimeMonitor orthotimer(*timerOrtho_);
839 int xc = MVT::GetNumberVecs( X );
840 ptrdiff_t xr = MVT::GetGlobalLength( X );
842 std::vector<int> qcs(nq);
844 if (nq == 0 || xc == 0 || xr == 0) {
847 ptrdiff_t qr = MVT::GetGlobalLength ( *Q[0] );
856 if (MX == Teuchos::null) {
858 MX = MVT::Clone(X,MVT::GetNumberVecs(X));
859 OPT::Apply(*(this->_Op),X,*MX);
864 MX = Teuchos::rcp( &X,
false );
866 int mxc = MVT::GetNumberVecs( *MX );
867 ptrdiff_t mxr = MVT::GetGlobalLength( *MX );
870 TEUCHOS_TEST_FOR_EXCEPTION( xc<0 || xr<0 || mxc<0 || mxr<0, std::invalid_argument,
871 "Belos::DGKSOrthoManager::project(): MVT returned negative dimensions for X,MX" );
873 TEUCHOS_TEST_FOR_EXCEPTION( xc!=mxc || xr!=mxr || xr!=qr, std::invalid_argument,
874 "Belos::DGKSOrthoManager::project(): Size of X not consistant with MX,Q" );
878 for (
int i=0; i<nq; i++) {
879 TEUCHOS_TEST_FOR_EXCEPTION( MVT::GetGlobalLength( *Q[i] ) != qr, std::invalid_argument,
880 "Belos::DGKSOrthoManager::project(): Q lengths not mutually consistant" );
881 qcs[i] = MVT::GetNumberVecs( *Q[i] );
882 TEUCHOS_TEST_FOR_EXCEPTION( qr < qcs[i], std::invalid_argument,
883 "Belos::DGKSOrthoManager::project(): Q has less rows than columns" );
887 if ( C[i] == Teuchos::null ) {
888 C[i] = Teuchos::rcp(
new Teuchos::SerialDenseMatrix<int,ScalarType>(qcs[i],xc) );
891 TEUCHOS_TEST_FOR_EXCEPTION( C[i]->numRows() != qcs[i] || C[i]->numCols() != xc , std::invalid_argument,
892 "Belos::DGKSOrthoManager::project(): Size of Q not consistant with size of C" );
897 blkOrtho( X, MX, C, Q );
904 template<
class StorageType,
class MV,
class OP>
905 int DGKSOrthoManager<Sacado::MP::Vector<StorageType>, MV, OP>::findBasis(
906 MV &X, Teuchos::RCP<MV> MX,
907 Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > B,
908 bool completeBasis,
int howMany )
const {
925 const ScalarType ONE = SCT::one();
926 const MagnitudeType ZERO = SCT::magnitude(SCT::zero());
928 int xc = MVT::GetNumberVecs( X );
929 ptrdiff_t xr = MVT::GetGlobalLength( X );
942 if (MX == Teuchos::null) {
944 MX = MVT::Clone(X,xc);
945 OPT::Apply(*(this->_Op),X,*MX);
952 if ( B == Teuchos::null ) {
953 B = Teuchos::rcp(
new Teuchos::SerialDenseMatrix<int,ScalarType>(xc,xc) );
956 int mxc = (this->_hasOp) ? MVT::GetNumberVecs( *MX ) : xc;
957 ptrdiff_t mxr = (this->_hasOp) ? MVT::GetGlobalLength( *MX ) : xr;
960 TEUCHOS_TEST_FOR_EXCEPTION( xc == 0 || xr == 0, std::invalid_argument,
961 "Belos::DGKSOrthoManager::findBasis(): X must be non-empty" );
962 TEUCHOS_TEST_FOR_EXCEPTION( B->numRows() != xc || B->numCols() != xc, std::invalid_argument,
963 "Belos::DGKSOrthoManager::findBasis(): Size of X not consistant with size of B" );
964 TEUCHOS_TEST_FOR_EXCEPTION( xc != mxc || xr != mxr, std::invalid_argument,
965 "Belos::DGKSOrthoManager::findBasis(): Size of X not consistant with size of MX" );
966 TEUCHOS_TEST_FOR_EXCEPTION(
static_cast<ptrdiff_t
>(xc) > xr, std::invalid_argument,
967 "Belos::DGKSOrthoManager::findBasis(): Size of X not feasible for normalization" );
968 TEUCHOS_TEST_FOR_EXCEPTION( howMany < 0 || howMany > xc, std::invalid_argument,
969 "Belos::DGKSOrthoManager::findBasis(): Invalid howMany parameter" );
974 int xstart = xc - howMany;
976 for (
int j = xstart;
j < xc;
j++) {
985 std::vector<int> index(1);
987 Teuchos::RCP<MV> Xj = MVT::CloneViewNonConst( X, index );
988 Teuchos::RCP<MV> MXj;
989 if ((this->_hasOp)) {
991 MXj = MVT::CloneViewNonConst( *MX, index );
999 std::vector<int> prev_idx( numX );
1000 Teuchos::RCP<const MV> prevX, prevMX;
1001 Teuchos::RCP<MV> oldMXj;
1004 for (
int i=0; i<numX; i++) {
1007 prevX = MVT::CloneView( X, prev_idx );
1009 prevMX = MVT::CloneView( *MX, prev_idx );
1012 oldMXj = MVT::CloneCopy( *MXj );
1016 Teuchos::SerialDenseMatrix<int,ScalarType> product(numX, 1);
1017 std::vector<ScalarType> oldDot( 1 ), newDot( 1 );
1022#ifdef BELOS_TEUCHOS_TIME_MONITOR
1023 Teuchos::TimeMonitor normTimer( *timerNorm_ );
1025 MVT::MvDot( *Xj, *MXj, oldDot );
1028 TEUCHOS_TEST_FOR_EXCEPTION( SCT::real(oldDot[0]) < ZERO, OrthoError,
1029 "Belos::DGKSOrthoManager::findBasis(): Negative definiteness discovered in inner product" );
1035#ifdef BELOS_TEUCHOS_TIME_MONITOR
1036 Teuchos::TimeMonitor innerProdTimer( *timerInnerProd_ );
1038 MatOrthoManager<ScalarType,MV,OP>::innerProd(*prevX,*Xj,MXj,product);
1043#ifdef BELOS_TEUCHOS_TIME_MONITOR
1044 Teuchos::TimeMonitor updateTimer( *timerUpdate_ );
1046 MVT::MvTimesMatAddMv( -ONE, *prevX, product, ONE, *Xj );
1054#ifdef BELOS_TEUCHOS_TIME_MONITOR
1055 Teuchos::TimeMonitor updateTimer( *timerUpdate_ );
1057 MVT::MvTimesMatAddMv( -ONE, *prevMX, product, ONE, *MXj );
1062#ifdef BELOS_TEUCHOS_TIME_MONITOR
1063 Teuchos::TimeMonitor normTimer( *timerNorm_ );
1065 MVT::MvDot( *Xj, *MXj, newDot );
1069 if ( MGT::squareroot(SCT::magnitude(newDot[0])) < dep_tol_*MGT::squareroot(SCT::magnitude(oldDot[0])) ) {
1072 Teuchos::SerialDenseMatrix<int,ScalarType> P2(numX,1);
1074#ifdef BELOS_TEUCHOS_TIME_MONITOR
1075 Teuchos::TimeMonitor innerProdTimer( *timerInnerProd_ );
1077 MatOrthoManager<ScalarType,MV,OP>::innerProd(*prevX,*Xj,MXj,P2);
1082#ifdef BELOS_TEUCHOS_TIME_MONITOR
1083 Teuchos::TimeMonitor updateTimer( *timerUpdate_ );
1085 MVT::MvTimesMatAddMv( -ONE, *prevX, P2, ONE, *Xj );
1087 if ((this->_hasOp)) {
1088#ifdef BELOS_TEUCHOS_TIME_MONITOR
1089 Teuchos::TimeMonitor updateTimer( *timerUpdate_ );
1091 MVT::MvTimesMatAddMv( -ONE, *prevMX, P2, ONE, *MXj );
1099#ifdef BELOS_TEUCHOS_TIME_MONITOR
1100 Teuchos::TimeMonitor normTimer( *timerNorm_ );
1102 MVT::MvDot( *Xj, *oldMXj, newDot );
1105 newDot[0] = oldDot[0];
1109 if (completeBasis) {
1113 if ( SCT::magnitude(newDot[0]) < SCT::magnitude(sing_tol_*oldDot[0]) ) {
1118 std::cout <<
"Belos::DGKSOrthoManager::findBasis() --> Random for column " << numX << std::endl;
1121 Teuchos::RCP<MV> tempXj = MVT::Clone( X, 1 );
1122 Teuchos::RCP<MV> tempMXj;
1123 MVT::MvRandom( *tempXj );
1125 tempMXj = MVT::Clone( X, 1 );
1126 OPT::Apply( *(this->_Op), *tempXj, *tempMXj );
1132#ifdef BELOS_TEUCHOS_TIME_MONITOR
1133 Teuchos::TimeMonitor normTimer( *timerNorm_ );
1135 MVT::MvDot( *tempXj, *tempMXj, oldDot );
1138 for (
int num_orth=0; num_orth<max_blk_ortho_; num_orth++){
1140#ifdef BELOS_TEUCHOS_TIME_MONITOR
1141 Teuchos::TimeMonitor innerProdTimer( *timerInnerProd_ );
1143 MatOrthoManager<ScalarType,MV,OP>::innerProd(*prevX,*tempXj,tempMXj,product);
1146#ifdef BELOS_TEUCHOS_TIME_MONITOR
1147 Teuchos::TimeMonitor updateTimer( *timerUpdate_ );
1149 MVT::MvTimesMatAddMv( -ONE, *prevX, product, ONE, *tempXj );
1152#ifdef BELOS_TEUCHOS_TIME_MONITOR
1153 Teuchos::TimeMonitor updateTimer( *timerUpdate_ );
1155 MVT::MvTimesMatAddMv( -ONE, *prevMX, product, ONE, *tempMXj );
1160#ifdef BELOS_TEUCHOS_TIME_MONITOR
1161 Teuchos::TimeMonitor normTimer( *timerNorm_ );
1163 MVT::MvDot( *tempXj, *tempMXj, newDot );
1166 if ( SCT::magnitude(newDot[0]) >= SCT::magnitude(oldDot[0]*sing_tol_) ) {
1168 MVT::Assign( *tempXj, *Xj );
1170 MVT::Assign( *tempMXj, *MXj );
1182 if ( SCT::magnitude(newDot[0]) < SCT::magnitude(oldDot[0]*blk_tol_) ) {
1189 ScalarType
diag = SCT::squareroot(SCT::magnitude(newDot[0]));
1190 ScalarType scale = ONE;
1192 MVT::MvScale( *Xj, scale );
1195 MVT::MvScale( *MXj, scale );
1208 for (
int i=0; i<numX; i++) {
1209 (*B)(i,
j) = product(i,0);
1219 template<
class StorageType,
class MV,
class OP>
1221 DGKSOrthoManager<Sacado::MP::Vector<StorageType>, MV, OP>::blkOrtho1 ( MV &X, Teuchos::RCP<MV> MX,
1222 Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > > C,
1223 Teuchos::ArrayView<Teuchos::RCP<const MV> > Q)
const
1226 int xc = MVT::GetNumberVecs( X );
1227 const ScalarType ONE = SCT::one();
1229 std::vector<int> qcs( nq );
1230 for (
int i=0; i<nq; i++) {
1231 qcs[i] = MVT::GetNumberVecs( *Q[i] );
1235 std::vector<ScalarType> oldDot( 1 ), newDot( 1 );
1237#ifdef BELOS_TEUCHOS_TIME_MONITOR
1238 Teuchos::TimeMonitor normTimer( *timerNorm_ );
1240 MVT::MvDot( X, *MX, oldDot );
1243 Teuchos::Array<Teuchos::RCP<MV> > MQ(nq);
1245 for (
int i=0; i<nq; i++) {
1248#ifdef BELOS_TEUCHOS_TIME_MONITOR
1249 Teuchos::TimeMonitor innerProdTimer( *timerInnerProd_ );
1251 MatOrthoManager<ScalarType,MV,OP>::innerProd(*Q[i],X,MX,*C[i]);
1255#ifdef BELOS_TEUCHOS_TIME_MONITOR
1256 Teuchos::TimeMonitor updateTimer( *timerUpdate_ );
1258 MVT::MvTimesMatAddMv( -ONE, *Q[i], *C[i], ONE, X );
1264 OPT::Apply( *(this->_Op), X, *MX);
1268 MQ[i] = MVT::Clone( *Q[i], qcs[i] );
1269 OPT::Apply( *(this->_Op), *Q[i], *MQ[i] );
1271#ifdef BELOS_TEUCHOS_TIME_MONITOR
1272 Teuchos::TimeMonitor updateTimer( *timerUpdate_ );
1274 MVT::MvTimesMatAddMv( -ONE, *MQ[i], *C[i], ONE, *MX );
1280#ifdef BELOS_TEUCHOS_TIME_MONITOR
1281 Teuchos::TimeMonitor normTimer( *timerNorm_ );
1283 MVT::MvDot( X, *MX, newDot );
1296 if ( MGT::squareroot(SCT::magnitude(newDot[0])) < dep_tol_*MGT::squareroot(SCT::magnitude(oldDot[0])) ) {
1299 for (
int i=0; i<nq; i++) {
1300 Teuchos::SerialDenseMatrix<int,ScalarType> C2(C[i]->numRows(), C[i]->numCols());
1304#ifdef BELOS_TEUCHOS_TIME_MONITOR
1305 Teuchos::TimeMonitor innerProdTimer( *timerInnerProd_ );
1307 MatOrthoManager<ScalarType,MV,OP>::innerProd(*Q[i],X,MX,C2);
1312#ifdef BELOS_TEUCHOS_TIME_MONITOR
1313 Teuchos::TimeMonitor updateTimer( *timerUpdate_ );
1315 MVT::MvTimesMatAddMv( -ONE, *Q[i], C2, ONE, X );
1321#ifdef BELOS_TEUCHOS_TIME_MONITOR
1322 Teuchos::TimeMonitor updateTimer( *timerUpdate_ );
1325 MVT::MvTimesMatAddMv( -ONE, *MQ[i], C2, ONE, *MX );
1327 else if (xc <= qcs[i]) {
1329 OPT::Apply( *(this->_Op), X, *MX);
1339 template<
class StorageType,
class MV,
class OP>
1341 DGKSOrthoManager<Sacado::MP::Vector<StorageType>, MV, OP>::blkOrtho ( MV &X, Teuchos::RCP<MV> MX,
1342 Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > > C,
1343 Teuchos::ArrayView<Teuchos::RCP<const MV> > Q)
const
1346 int xc = MVT::GetNumberVecs( X );
1347 bool dep_flg =
false;
1348 const ScalarType ONE = SCT::one();
1350 std::vector<int> qcs( nq );
1351 for (
int i=0; i<nq; i++) {
1352 qcs[i] = MVT::GetNumberVecs( *Q[i] );
1358 std::vector<ScalarType> oldDot( xc );
1360#ifdef BELOS_TEUCHOS_TIME_MONITOR
1361 Teuchos::TimeMonitor normTimer( *timerNorm_ );
1363 MVT::MvDot( X, *MX, oldDot );
1366 Teuchos::Array<Teuchos::RCP<MV> > MQ(nq);
1368 for (
int i=0; i<nq; i++) {
1371#ifdef BELOS_TEUCHOS_TIME_MONITOR
1372 Teuchos::TimeMonitor innerProdTimer( *timerInnerProd_ );
1374 MatOrthoManager<ScalarType,MV,OP>::innerProd(*Q[i],X,MX,*C[i]);
1378#ifdef BELOS_TEUCHOS_TIME_MONITOR
1379 Teuchos::TimeMonitor updateTimer( *timerUpdate_ );
1381 MVT::MvTimesMatAddMv( -ONE, *Q[i], *C[i], ONE, X );
1387 OPT::Apply( *(this->_Op), X, *MX);
1391 MQ[i] = MVT::Clone( *Q[i], qcs[i] );
1392 OPT::Apply( *(this->_Op), *Q[i], *MQ[i] );
1394#ifdef BELOS_TEUCHOS_TIME_MONITOR
1395 Teuchos::TimeMonitor updateTimer( *timerUpdate_ );
1397 MVT::MvTimesMatAddMv( -ONE, *MQ[i], *C[i], ONE, *MX );
1404 for (
int j = 1;
j < max_blk_ortho_; ++
j) {
1406 for (
int i=0; i<nq; i++) {
1407 Teuchos::SerialDenseMatrix<int,ScalarType> C2(C[i]->numRows(), C[i]->numCols());
1411#ifdef BELOS_TEUCHOS_TIME_MONITOR
1412 Teuchos::TimeMonitor innerProdTimer( *timerInnerProd_ );
1414 MatOrthoManager<ScalarType,MV,OP>::innerProd(*Q[i],X,MX,C2);
1419#ifdef BELOS_TEUCHOS_TIME_MONITOR
1420 Teuchos::TimeMonitor updateTimer( *timerUpdate_ );
1422 MVT::MvTimesMatAddMv( -ONE, *Q[i], C2, ONE, X );
1428#ifdef BELOS_TEUCHOS_TIME_MONITOR
1429 Teuchos::TimeMonitor updateTimer( *timerUpdate_ );
1432 MVT::MvTimesMatAddMv( -ONE, *MQ[i], C2, ONE, *MX );
1434 else if (xc <= qcs[i]) {
1436 OPT::Apply( *(this->_Op), X, *MX);
1443 std::vector<ScalarType> newDot(xc);
1445#ifdef BELOS_TEUCHOS_TIME_MONITOR
1446 Teuchos::TimeMonitor normTimer( *timerNorm_ );
1448 MVT::MvDot( X, *MX, newDot );
1452 for (
int i=0; i<xc; i++){
1453 if (SCT::magnitude(newDot[i]) < SCT::magnitude(oldDot[i] * blk_tol_)) {
1463 template<
class StorageType,
class MV,
class OP>
1465 DGKSOrthoManager<Sacado::MP::Vector<StorageType>, MV, OP>::blkOrthoSing ( MV &X, Teuchos::RCP<MV> MX,
1466 Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > > C,
1467 Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > B,
1468 Teuchos::ArrayView<Teuchos::RCP<const MV> > QQ)
const
1470 Teuchos::Array<Teuchos::RCP<const MV> > Q (QQ);
1472 const ScalarType ONE = SCT::one();
1473 const ScalarType ZERO = SCT::zero();
1476 int xc = MVT::GetNumberVecs( X );
1477 std::vector<int> indX( 1 );
1478 std::vector<ScalarType> oldDot( 1 ), newDot( 1 );
1480 std::vector<int> qcs( nq );
1481 for (
int i=0; i<nq; i++) {
1482 qcs[i] = MVT::GetNumberVecs( *Q[i] );
1486 Teuchos::RCP<const MV> lastQ;
1487 Teuchos::RCP<MV> Xj, MXj;
1488 Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > lastC;
1491 for (
int j=0;
j<xc;
j++) {
1493 bool dep_flg =
false;
1497 std::vector<int> index(
j );
1498 for (
int ind=0; ind<
j; ind++) {
1501 lastQ = MVT::CloneView( X, index );
1504 Q.push_back( lastQ );
1506 qcs.push_back( MVT::GetNumberVecs( *lastQ ) );
1511 Xj = MVT::CloneViewNonConst( X, indX );
1513 MXj = MVT::CloneViewNonConst( *MX, indX );
1521#ifdef BELOS_TEUCHOS_TIME_MONITOR
1522 Teuchos::TimeMonitor normTimer( *timerNorm_ );
1524 MVT::MvDot( *Xj, *MXj, oldDot );
1527 Teuchos::Array<Teuchos::RCP<MV> > MQ(Q.size());
1529 for (
int i=0; i<Q.size(); i++) {
1532 Teuchos::SerialDenseMatrix<int,ScalarType> tempC( Teuchos::View, *C[i], qcs[i], 1, 0,
j );
1536#ifdef BELOS_TEUCHOS_TIME_MONITOR
1537 Teuchos::TimeMonitor innerProdTimer( *timerInnerProd_ );
1539 MatOrthoManager<ScalarType,MV,OP>::innerProd(*Q[i],*Xj,MXj,tempC);
1543#ifdef BELOS_TEUCHOS_TIME_MONITOR
1544 Teuchos::TimeMonitor updateTimer( *timerUpdate_ );
1546 MVT::MvTimesMatAddMv( -ONE, *Q[i], tempC, ONE, *Xj );
1552 OPT::Apply( *(this->_Op), *Xj, *MXj);
1556 MQ[i] = MVT::Clone( *Q[i], qcs[i] );
1557 OPT::Apply( *(this->_Op), *Q[i], *MQ[i] );
1559#ifdef BELOS_TEUCHOS_TIME_MONITOR
1560 Teuchos::TimeMonitor updateTimer( *timerUpdate_ );
1562 MVT::MvTimesMatAddMv( -ONE, *MQ[i], tempC, ONE, *MXj );
1570#ifdef BELOS_TEUCHOS_TIME_MONITOR
1571 Teuchos::TimeMonitor normTimer( *timerNorm_ );
1573 MVT::MvDot( *Xj, *MXj, newDot );
1579 if ( SCT::magnitude(newDot[0]) < SCT::magnitude(oldDot[0]*dep_tol_) ) {
1581 for (
int i=0; i<Q.size(); i++) {
1582 Teuchos::SerialDenseMatrix<int,ScalarType> tempC( Teuchos::View, *C[i], qcs[i], 1, 0,
j );
1583 Teuchos::SerialDenseMatrix<int,ScalarType> C2( qcs[i], 1 );
1587#ifdef BELOS_TEUCHOS_TIME_MONITOR
1588 Teuchos::TimeMonitor innerProdTimer( *timerInnerProd_ );
1590 MatOrthoManager<ScalarType,MV,OP>::innerProd(*Q[i],*Xj,MXj,C2);
1594#ifdef BELOS_TEUCHOS_TIME_MONITOR
1595 Teuchos::TimeMonitor updateTimer( *timerUpdate_ );
1597 MVT::MvTimesMatAddMv( -ONE, *Q[i], C2, ONE, *Xj );
1603#ifdef BELOS_TEUCHOS_TIME_MONITOR
1604 Teuchos::TimeMonitor updateTimer( *timerUpdate_ );
1607 MVT::MvTimesMatAddMv( -ONE, *MQ[i], C2, ONE, *MXj );
1609 else if (xc <= qcs[i]) {
1611 OPT::Apply( *(this->_Op), *Xj, *MXj);
1618#ifdef BELOS_TEUCHOS_TIME_MONITOR
1619 Teuchos::TimeMonitor normTimer( *timerNorm_ );
1621 MVT::MvDot( *Xj, *MXj, newDot );
1626 if (SCT::magnitude(newDot[0]) < SCT::magnitude(oldDot[0]*sing_tol_)) {
1632 ScalarType
diag = SCT::squareroot(SCT::magnitude(newDot[0]));
1634 MVT::MvScale( *Xj, ONE/
diag );
1637 MVT::MvScale( *MXj, ONE/
diag );
1645 Teuchos::RCP<MV> tempXj = MVT::Clone( X, 1 );
1646 Teuchos::RCP<MV> tempMXj;
1647 MVT::MvRandom( *tempXj );
1649 tempMXj = MVT::Clone( X, 1 );
1650 OPT::Apply( *(this->_Op), *tempXj, *tempMXj );
1656#ifdef BELOS_TEUCHOS_TIME_MONITOR
1657 Teuchos::TimeMonitor normTimer( *timerNorm_ );
1659 MVT::MvDot( *tempXj, *tempMXj, oldDot );
1662 for (
int num_orth=0; num_orth<max_blk_ortho_; num_orth++) {
1664 for (
int i=0; i<Q.size(); i++) {
1665 Teuchos::SerialDenseMatrix<int,ScalarType> product( qcs[i], 1 );
1669#ifdef BELOS_TEUCHOS_TIME_MONITOR
1670 Teuchos::TimeMonitor innerProdTimer( *timerInnerProd_ );
1672 MatOrthoManager<ScalarType,MV,OP>::innerProd(*Q[i],*tempXj,tempMXj,product);
1675#ifdef BELOS_TEUCHOS_TIME_MONITOR
1676 Teuchos::TimeMonitor updateTimer( *timerUpdate_ );
1678 MVT::MvTimesMatAddMv( -ONE, *Q[i], product, ONE, *tempXj );
1684#ifdef BELOS_TEUCHOS_TIME_MONITOR
1685 Teuchos::TimeMonitor updateTimer( *timerUpdate_ );
1688 MVT::MvTimesMatAddMv( -ONE, *MQ[i], product, ONE, *tempMXj );
1690 else if (xc <= qcs[i]) {
1692 OPT::Apply( *(this->_Op), *tempXj, *tempMXj);
1701#ifdef BELOS_TEUCHOS_TIME_MONITOR
1702 Teuchos::TimeMonitor normTimer( *timerNorm_ );
1704 MVT::MvDot( *tempXj, *tempMXj, newDot );
1708 if ( SCT::magnitude(newDot[0]) >= SCT::magnitude(oldDot[0]*sing_tol_) ) {
1709 ScalarType
diag = SCT::squareroot(SCT::magnitude(newDot[0]));
1715 MVT::MvAddMv( ONE/
diag, *tempXj, ZERO, *tempXj, *Xj );
1717 MVT::MvAddMv( ONE/
diag, *tempMXj, ZERO, *tempMXj, *MXj );
KOKKOS_INLINE_FUNCTION MaskedAssign< scalar > mask_assign(bool b, scalar *s)
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.
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &plist)
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...
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.
MagnitudeType getDepTol() const
Return parameter for re-orthogonalization threshhold.
const std::string & getLabel() const
This method returns the label being used by the timers in the orthogonalization manager.
MagnitudeType blk_tol_
Block reorthogonalization threshold.
MultiVecTraits< ScalarType, MV > MVT
Teuchos::ScalarTraits< ScalarType >::magnitudeType MagnitudeType
static const int max_blk_ortho_default_
Max number of (re)orthogonalization steps, including the first (default).
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 ...
MagnitudeType getSingTol() const
Return parameter for singular block detection.
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 ,...
static const int max_blk_ortho_fast_
Max number of (re)orthogonalization steps, including the first (fast).
static const MagnitudeType dep_tol_fast_
(Non-block) reorthogonalization threshold (fast).
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
void setBlkTol(const MagnitudeType blk_tol)
Set 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.
std::string label_
Label for timer(s).
static const MagnitudeType blk_tol_default_
Block reorthogonalization threshold (default).
int max_blk_ortho_
Max number of (re)orthogonalization steps, including the first.
Teuchos::ScalarTraits< ScalarType >::magnitudeType orthonormError(const MV &X, Teuchos::RCP< const MV > MX) const
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.
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 .
MagnitudeType sing_tol_
Singular block detection threshold.
static const MagnitudeType dep_tol_default_
(Non-block) reorthogonalization threshold (default).
Teuchos::ScalarTraits< MagnitudeType > MGT
Teuchos::RCP< Teuchos::ParameterList > defaultParams_
Default parameter list.
static const MagnitudeType blk_tol_fast_
Block reorthogonalization threshold (fast).
static const MagnitudeType sing_tol_default_
Singular block detection threshold (default).
Teuchos::ScalarTraits< ScalarType >::magnitudeType orthonormError(const MV &X) const
void setDepTol(const MagnitudeType dep_tol)
Set parameter for re-orthogonalization threshhold.
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.
void setSingTol(const MagnitudeType sing_tol)
Set parameter for singular block detection.
OperatorTraits< ScalarType, MV, OP > OPT
Teuchos::ScalarTraits< ScalarType >::magnitudeType orthogError(const MV &X1, Teuchos::RCP< const MV > MX1, const MV &X2) const
This method computes the error in orthogonality of two multivectors, measured as the Frobenius norm o...
Teuchos::ScalarTraits< ScalarType > SCT
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.
MagnitudeType dep_tol_
(Non-block) reorthogonalization threshold.
Sacado::MP::Vector< Storage > ScalarType
MagnitudeType getBlkTol() const
Return parameter for block re-orthogonalization threshhold.
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.
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
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.
~DGKSOrthoManager()
Destructor.
static const MagnitudeType sing_tol_fast_
Singular block detection threshold (fast).
KOKKOS_INLINE_FUNCTION bool OR(Mask< T > m)