47 #ifndef BELOS_DGKS_ORTHOMANAGER_HPP
48 #define BELOS_DGKS_ORTHOMANAGER_HPP
65 #include "Teuchos_ParameterListAcceptorDefaultBase.hpp"
66 #ifdef BELOS_TEUCHOS_TIME_MONITOR
68 #endif // BELOS_TEUCHOS_TIME_MONITOR
76 template<
class ScalarType>
86 const int defaultMaxNumOrthogPasses = 2;
87 const magnitude_type one = STM::one();
88 const magnitude_type eps = STM::eps();
89 const magnitude_type squareRootTwo =
90 STM::squareroot (as<magnitude_type> (2));
91 const magnitude_type defaultBlkTol =
92 as<magnitude_type> (10) * STM::squareroot (eps);
93 const magnitude_type defaultDepTol = one / squareRootTwo;
94 const magnitude_type defaultSingTol = as<magnitude_type> (10) * eps;
97 Teuchos::parameterList (
"DGKS");
98 params->set (
"maxNumOrthogPasses", defaultMaxNumOrthogPasses,
99 "Maximum number of orthogonalization passes "
100 "(includes the first). Default is 2, since "
101 "\"twice is enough\" for Krylov methods.");
102 params->set (
"blkTol", defaultBlkTol,
103 "Block reorthogonalization threshhold.");
104 params->set (
"depTol", defaultDepTol,
105 "(Non-block) reorthogonalization threshold.");
106 params->set (
"singTol", defaultSingTol,
107 "Singular block detection threshold.");
116 template<
class ScalarType>
125 typedef ScalarTraits<magnitude_type> STM;
127 RCP<const ParameterList> defaultParams = getDefaultDgksParameters<ScalarType> ();
129 RCP<ParameterList> params =
rcp (
new ParameterList (*defaultParams));
131 const int maxBlkOrtho = 1;
132 const magnitude_type blkTol = STM::zero();
133 const magnitude_type depTol = STM::zero();
134 const magnitude_type singTol = STM::zero();
136 params->set (
"maxNumOrthogPasses", maxBlkOrtho);
137 params->set (
"blkTol", blkTol);
138 params->set (
"depTol", depTol);
139 params->set (
"singTol", singTol);
153 template<
class ScalarType>
154 void TEUCHOS_DEPRECATED
156 int& maxNumOrthogPasses,
165 RCP<const ParameterList> defaultParams = getDefaultDgksParameters<ScalarType>();
172 int _maxNumOrthogPasses;
173 magnitude_type _blkTol, _depTol, _singTol;
176 _maxNumOrthogPasses = defaultParams->get<
int> (
"maxNumOrthogPasses");
177 _blkTol = defaultParams->get<magnitude_type> (
"blkTol");
178 _depTol = defaultParams->get<magnitude_type> (
"depTol");
179 _singTol = defaultParams->get<magnitude_type> (
"singTol");
184 _maxNumOrthogPasses = params->
get<
int> (
"maxNumOrthogPasses");
185 if (_maxNumOrthogPasses < 1)
186 _maxNumOrthogPasses = defaultParams->get<
int> (
"maxNumOrthogPasses");
188 _maxNumOrthogPasses = defaultParams->get<
int> (
"maxNumOrthogPasses");
192 _blkTol = params->
get<magnitude_type> (
"blkTol");
194 _blkTol = defaultParams->get<magnitude_type> (
"blkTol");
196 _blkTol = defaultParams->get<magnitude_type> (
"blkTol");
200 _depTol = params->
get<magnitude_type> (
"depTol");
202 _depTol = defaultParams->get<magnitude_type> (
"depTol");
204 _depTol = defaultParams->get<magnitude_type> (
"depTol");
208 _singTol = params->
get<magnitude_type> (
"singTol");
210 _singTol = defaultParams->get<magnitude_type> (
"singTol");
212 _singTol = defaultParams->get<magnitude_type> (
"singTol");
215 maxNumOrthogPasses = _maxNumOrthogPasses;
221 template<
class ScalarType,
class MV,
class OP>
241 const int max_blk_ortho = 2,
244 const MagnitudeType sing_tol = 10*
MGT::eps() )
246 max_blk_ortho_( max_blk_ortho ),
249 sing_tol_( sing_tol ),
252 #ifdef BELOS_TEUCHOS_TIME_MONITOR
253 std::string orthoLabel = label_ +
": Orthogonalization";
260 const std::string& label =
"Belos",
264 blk_tol_ (Teuchos::
as<MagnitudeType>(10) *
MGT::squareroot(
MGT::eps())),
265 dep_tol_ (
MGT::one() /
MGT::squareroot (Teuchos::
as<MagnitudeType>(2))),
266 sing_tol_ (Teuchos::
as<MagnitudeType>(10) *
MGT::eps()),
271 #ifdef BELOS_TEUCHOS_TIME_MONITOR
272 std::string orthoLabel = label_ +
": Orthogonalization";
288 using Teuchos::parameterList;
292 RCP<ParameterList> params;
295 params = parameterList (*defaultParams);
306 const int maxNumOrthogPasses = params->get<
int> (
"maxNumOrthogPasses");
307 const MagnitudeType blkTol = params->get<MagnitudeType> (
"blkTol");
308 const MagnitudeType depTol = params->get<MagnitudeType> (
"depTol");
309 const MagnitudeType singTol = params->get<MagnitudeType> (
"singTol");
311 max_blk_ortho_ = maxNumOrthogPasses;
324 using Teuchos::parameterList;
327 if (defaultParams_.
is_null()) {
328 RCP<ParameterList> params = parameterList (
"DGKS");
329 const MagnitudeType eps =
MGT::eps ();
333 const int defaultMaxNumOrthogPasses = 2;
334 const MagnitudeType defaultBlkTol =
336 const MagnitudeType defaultDepTol =
339 const MagnitudeType defaultSingTol = as<MagnitudeType> (10) * eps;
341 params->set (
"maxNumOrthogPasses", defaultMaxNumOrthogPasses,
342 "Maximum number of orthogonalization passes (includes the "
343 "first). Default is 2, since \"twice is enough\" for Krylov "
345 params->set (
"blkTol", defaultBlkTol,
"Block reorthogonalization "
347 params->set (
"depTol", defaultDepTol,
348 "(Non-block) reorthogonalization threshold.");
349 params->set (
"singTol", defaultSingTol,
"Singular block detection "
351 defaultParams_ = params;
353 return defaultParams_;
367 RCP<ParameterList> params =
rcp (
new ParameterList (*defaultParams));
369 const int maxBlkOrtho = 1;
370 const MagnitudeType blkTol =
MGT::zero();
371 const MagnitudeType depTol =
MGT::zero();
372 const MagnitudeType singTol =
MGT::zero();
374 params->set (
"maxNumOrthogPasses", maxBlkOrtho);
375 params->set (
"blkTol", blkTol);
376 params->set (
"depTol", depTol);
377 params->set (
"singTol", singTol);
394 params->
set (
"blkTol", blk_tol);
404 params->
set (
"depTol", dep_tol);
414 params->
set (
"singTol", sing_tol);
416 sing_tol_ = sing_tol;
626 void setLabel(
const std::string& label);
630 const std::string&
getLabel()
const {
return label_; }
639 MagnitudeType blk_tol_;
641 MagnitudeType dep_tol_;
643 MagnitudeType sing_tol_;
647 #ifdef BELOS_TEUCHOS_TIME_MONITOR
649 #endif // BELOS_TEUCHOS_TIME_MONITOR
657 bool completeBasis,
int howMany = -1 )
const;
685 template<
class ScalarType,
class MV,
class OP>
688 if (label != label_) {
690 std::string orthoLabel = label_ +
": Orthogonalization";
691 #ifdef BELOS_TEUCHOS_TIME_MONITOR
699 template<
class ScalarType,
class MV,
class OP>
702 const ScalarType ONE = SCT::one();
703 int rank = MVT::GetNumberVecs(X);
706 for (
int i=0; i<rank; i++) {
714 template<
class ScalarType,
class MV,
class OP>
717 int r1 = MVT::GetNumberVecs(X1);
718 int r2 = MVT::GetNumberVecs(X2);
726 template<
class ScalarType,
class MV,
class OP>
740 typedef typename Array< RCP< const MV > >::size_type size_type;
742 #ifdef BELOS_TEUCHOS_TIME_MONITOR
746 ScalarType ONE = SCT::one();
747 ScalarType ZERO = SCT::zero();
750 int xc = MVT::GetNumberVecs( X );
751 ptrdiff_t xr = MVText::GetGlobalLength( X );
758 B =
rcp (
new serial_dense_matrix_type (xc, xc));
768 for (size_type k = 0; k < nq; ++k)
770 const int numRows = MVT::GetNumberVecs (*Q[k]);
771 const int numCols = xc;
774 C[k] =
rcp (
new serial_dense_matrix_type (numRows, numCols));
775 else if (C[k]->numRows() != numRows || C[k]->numCols() != numCols)
777 int err = C[k]->reshape (numRows, numCols);
779 "DGKS orthogonalization: failed to reshape "
780 "C[" << k <<
"] (the array of block "
781 "coefficients resulting from projecting X "
782 "against Q[1:" << nq <<
"]).");
788 if (MX == Teuchos::null) {
790 MX = MVT::Clone(X,MVT::GetNumberVecs(X));
791 OPT::Apply(*(this->_Op),X,*MX);
799 int mxc = MVT::GetNumberVecs( *MX );
800 ptrdiff_t mxr = MVText::GetGlobalLength( *MX );
803 TEUCHOS_TEST_FOR_EXCEPTION( xc == 0 || xr == 0, std::invalid_argument,
"Belos::DGKSOrthoManager::projectAndNormalize(): X must be non-empty" );
806 for (
int i=0; i<nq; i++) {
807 numbas += MVT::GetNumberVecs( *Q[i] );
812 "Belos::DGKSOrthoManager::projectAndNormalize(): Size of X must be consistant with size of B" );
815 "Belos::DGKSOrthoManager::projectAndNormalize(): MVT returned negative dimensions for X,MX" );
817 TEUCHOS_TEST_FOR_EXCEPTION( xc!=mxc || xr!=mxr, std::invalid_argument,
818 "Belos::DGKSOrthoManager::projectAndNormalize(): Size of X must be consistant with size of MX" );
824 bool dep_flg =
false;
828 tmpX = MVT::CloneCopy(X);
830 tmpMX = MVT::CloneCopy(*MX);
834 dep_flg = blkOrtho( X, MX, C, Q );
839 rank = blkOrthoSing( *tmpX, tmpMX, C, B, Q );
842 MVT::MvAddMv( ONE, *tmpX, ZERO, *tmpX, X );
844 MVT::MvAddMv( ONE, *tmpMX, ZERO, *tmpMX, *MX );
849 rank = findBasis( X, MX, B,
false );
853 rank = blkOrthoSing( *tmpX, tmpMX, C, B, Q );
856 MVT::MvAddMv( ONE, *tmpX, ZERO, *tmpX, X );
858 MVT::MvAddMv( ONE, *tmpMX, ZERO, *tmpMX, *MX );
864 TEUCHOS_TEST_FOR_EXCEPTION( rank > xc || rank < 0, std::logic_error,
865 "Belos::DGKSOrthoManager::projectAndNormalize(): Debug error in rank variable." );
875 template<
class ScalarType,
class MV,
class OP>
880 #ifdef BELOS_TEUCHOS_TIME_MONITOR
885 return findBasis(X, MX, B,
true);
891 template<
class ScalarType,
class MV,
class OP>
911 #ifdef BELOS_TEUCHOS_TIME_MONITOR
915 int xc = MVT::GetNumberVecs( X );
916 ptrdiff_t xr = MVText::GetGlobalLength( X );
918 std::vector<int> qcs(nq);
920 if (nq == 0 || xc == 0 || xr == 0) {
923 ptrdiff_t qr = MVText::GetGlobalLength ( *Q[0] );
932 if (MX == Teuchos::null) {
934 MX = MVT::Clone(X,MVT::GetNumberVecs(X));
935 OPT::Apply(*(this->_Op),X,*MX);
942 int mxc = MVT::GetNumberVecs( *MX );
943 ptrdiff_t mxr = MVText::GetGlobalLength( *MX );
947 "Belos::DGKSOrthoManager::project(): MVT returned negative dimensions for X,MX" );
950 "Belos::DGKSOrthoManager::project(): Size of X not consistant with MX,Q" );
954 for (
int i=0; i<nq; i++) {
956 "Belos::DGKSOrthoManager::project(): Q lengths not mutually consistant" );
957 qcs[i] = MVT::GetNumberVecs( *Q[i] );
959 "Belos::DGKSOrthoManager::project(): Q has less rows than columns" );
963 if ( C[i] == Teuchos::null ) {
968 "Belos::DGKSOrthoManager::project(): Size of Q not consistant with size of C" );
973 blkOrtho( X, MX, C, Q );
980 template<
class ScalarType,
class MV,
class OP>
984 bool completeBasis,
int howMany )
const {
1001 const ScalarType ONE = SCT::one();
1002 const MagnitudeType ZERO = SCT::magnitude(SCT::zero());
1004 int xc = MVT::GetNumberVecs( X );
1005 ptrdiff_t xr = MVText::GetGlobalLength( X );
1007 if (howMany == -1) {
1018 if (MX == Teuchos::null) {
1020 MX = MVT::Clone(X,xc);
1021 OPT::Apply(*(this->_Op),X,*MX);
1028 if ( B == Teuchos::null ) {
1032 int mxc = (this->_hasOp) ? MVT::GetNumberVecs( *MX ) : xc;
1033 ptrdiff_t mxr = (this->_hasOp) ? MVText::GetGlobalLength( *MX ) : xr;
1037 "Belos::DGKSOrthoManager::findBasis(): X must be non-empty" );
1039 "Belos::DGKSOrthoManager::findBasis(): Size of X not consistant with size of B" );
1041 "Belos::DGKSOrthoManager::findBasis(): Size of X not consistant with size of MX" );
1043 "Belos::DGKSOrthoManager::findBasis(): Size of X not feasible for normalization" );
1045 "Belos::DGKSOrthoManager::findBasis(): Invalid howMany parameter" );
1050 int xstart = xc - howMany;
1052 for (
int j = xstart; j < xc; j++) {
1058 bool addVec =
false;
1061 std::vector<int> index(1);
1065 if ((this->_hasOp)) {
1067 MXj = MVT::CloneViewNonConst( *MX, index );
1075 std::vector<int> prev_idx( numX );
1079 for (
int i=0; i<numX; i++) {
1082 prevX = MVT::CloneView( X, prev_idx );
1084 prevMX = MVT::CloneView( *MX, prev_idx );
1090 std::vector<ScalarType> oldDot( 1 ), newDot( 1 );
1095 MVT::MvDot( *Xj, *MXj, oldDot );
1098 "Belos::DGKSOrthoManager::findBasis(): Negative definiteness discovered in inner product" );
1108 MVT::MvTimesMatAddMv( -ONE, *prevX, product, ONE, *Xj );
1115 MVT::MvTimesMatAddMv( -ONE, *prevMX, product, ONE, *MXj );
1119 MVT::MvDot( *Xj, *MXj, newDot );
1122 if ( SCT::magnitude(newDot[0]) < SCT::magnitude(dep_tol_*oldDot[0]) ) {
1129 MVT::MvTimesMatAddMv( -ONE, *prevX, P2, ONE, *Xj );
1130 if ((this->_hasOp)) {
1131 MVT::MvTimesMatAddMv( -ONE, *prevMX, P2, ONE, *MXj );
1138 MVT::MvDot( *Xj, *oldMXj, newDot );
1141 if (completeBasis) {
1145 if ( SCT::magnitude(newDot[0]) < SCT::magnitude(sing_tol_*oldDot[0]) ) {
1150 std::cout <<
"Belos::DGKSOrthoManager::findBasis() --> Random for column " << numX << std::endl;
1155 MVT::MvRandom( *tempXj );
1157 tempMXj = MVT::Clone( X, 1 );
1158 OPT::Apply( *(this->_Op), *tempXj, *tempMXj );
1163 MVT::MvDot( *tempXj, *tempMXj, oldDot );
1165 for (
int num_orth=0; num_orth<max_blk_ortho_; num_orth++){
1167 MVT::MvTimesMatAddMv( -ONE, *prevX, product, ONE, *tempXj );
1169 MVT::MvTimesMatAddMv( -ONE, *prevMX, product, ONE, *tempMXj );
1173 MVT::MvDot( *tempXj, *tempMXj, newDot );
1175 if ( SCT::magnitude(newDot[0]) >= SCT::magnitude(oldDot[0]*sing_tol_) ) {
1177 MVT::MvAddMv( ONE, *tempXj, ZERO, *tempXj, *Xj );
1179 MVT::MvAddMv( ONE, *tempMXj, ZERO, *tempMXj, *MXj );
1191 if ( SCT::magnitude(newDot[0]) < SCT::magnitude(oldDot[0]*blk_tol_) ) {
1199 ScalarType diag = SCT::squareroot(SCT::magnitude(newDot[0]));
1201 if (SCT::magnitude(diag) > ZERO) {
1202 MVT::MvAddMv( ONE/diag, *Xj, ZERO, *Xj, *Xj );
1205 MVT::MvAddMv( ONE/diag, *MXj, ZERO, *MXj, *MXj );
1219 for (
int i=0; i<numX; i++) {
1220 (*B)(i,j) = product(i,0);
1231 template<
class ScalarType,
class MV,
class OP>
1233 DGKSOrthoManager<ScalarType, MV, OP>::blkOrtho ( MV &X,
Teuchos::RCP<MV> MX,
1238 int xc = MVT::GetNumberVecs( X );
1239 bool dep_flg =
false;
1240 const ScalarType ONE = SCT::one();
1242 std::vector<int> qcs( nq );
1243 for (
int i=0; i<nq; i++) {
1244 qcs[i] = MVT::GetNumberVecs( *Q[i] );
1250 std::vector<ScalarType> oldDot( xc );
1251 MVT::MvDot( X, *MX, oldDot );
1255 for (
int i=0; i<nq; i++) {
1259 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] );
1270 MVT::MvTimesMatAddMv( -ONE, *MQ[i], *C[i], ONE, *MX );
1276 for (
int j = 1; j < max_blk_ortho_; ++j) {
1278 for (
int i=0; i<nq; i++) {
1284 MVT::MvTimesMatAddMv( -ONE, *Q[i], C2, ONE, X );
1290 MVT::MvTimesMatAddMv( -ONE, *MQ[i], C2, ONE, *MX );
1292 else if (xc <= qcs[i]) {
1294 OPT::Apply( *(this->_Op), X, *MX);
1301 std::vector<ScalarType> newDot(xc);
1302 MVT::MvDot( X, *MX, newDot );
1305 for (
int i=0; i<xc; i++){
1306 if (SCT::magnitude(newDot[i]) < SCT::magnitude(oldDot[i] * blk_tol_)) {
1316 template<
class ScalarType,
class MV,
class OP>
1318 DGKSOrthoManager<ScalarType, MV, OP>::blkOrthoSing ( MV &X,
Teuchos::RCP<MV> MX,
1325 const ScalarType ONE = SCT::one();
1326 const ScalarType ZERO = SCT::zero();
1329 int xc = MVT::GetNumberVecs( X );
1330 std::vector<int> indX( 1 );
1331 std::vector<ScalarType> oldDot( 1 ), newDot( 1 );
1333 std::vector<int> qcs( nq );
1334 for (
int i=0; i<nq; i++) {
1335 qcs[i] = MVT::GetNumberVecs( *Q[i] );
1344 for (
int j=0; j<xc; j++) {
1346 bool dep_flg =
false;
1350 std::vector<int> index( j );
1351 for (
int ind=0; ind<j; ind++) {
1354 lastQ = MVT::CloneView( X, index );
1357 Q.push_back( lastQ );
1359 qcs.push_back( MVT::GetNumberVecs( *lastQ ) );
1364 Xj = MVT::CloneViewNonConst( X, indX );
1366 MXj = MVT::CloneViewNonConst( *MX, indX );
1373 MVT::MvDot( *Xj, *MXj, oldDot );
1377 for (
int i=0; i<Q.size(); i++) {
1385 MVT::MvTimesMatAddMv( -ONE, *Q[i], tempC, ONE, *Xj );
1390 OPT::Apply( *(this->_Op), *Xj, *MXj);
1394 MQ[i] = MVT::Clone( *Q[i], qcs[i] );
1395 OPT::Apply( *(this->_Op), *Q[i], *MQ[i] );
1396 MVT::MvTimesMatAddMv( -ONE, *MQ[i], tempC, ONE, *MXj );
1402 MVT::MvDot( *Xj, *MXj, newDot );
1407 if ( SCT::magnitude(newDot[0]) < SCT::magnitude(oldDot[0]*dep_tol_) ) {
1409 for (
int i=0; i<Q.size(); i++) {
1416 MVT::MvTimesMatAddMv( -ONE, *Q[i], C2, ONE, *Xj );
1422 MVT::MvTimesMatAddMv( -ONE, *MQ[i], C2, ONE, *MXj );
1424 else if (xc <= qcs[i]) {
1426 OPT::Apply( *(this->_Op), *Xj, *MXj);
1432 MVT::MvDot( *Xj, *MXj, newDot );
1437 if (SCT::magnitude(newDot[0]) < SCT::magnitude(oldDot[0]*sing_tol_)) {
1443 ScalarType diag = SCT::squareroot(SCT::magnitude(newDot[0]));
1445 MVT::MvAddMv( ONE/diag, *Xj, ZERO, *Xj, *Xj );
1448 MVT::MvAddMv( ONE/diag, *MXj, ZERO, *MXj, *MXj );
1458 MVT::MvRandom( *tempXj );
1460 tempMXj = MVT::Clone( X, 1 );
1461 OPT::Apply( *(this->_Op), *tempXj, *tempMXj );
1466 MVT::MvDot( *tempXj, *tempMXj, oldDot );
1468 for (
int num_orth=0; num_orth<max_blk_ortho_; num_orth++) {
1470 for (
int i=0; i<Q.size(); i++) {
1475 MVT::MvTimesMatAddMv( -ONE, *Q[i], product, ONE, *tempXj );
1481 MVT::MvTimesMatAddMv( -ONE, *MQ[i], product, ONE, *tempMXj );
1483 else if (xc <= qcs[i]) {
1485 OPT::Apply( *(this->_Op), *tempXj, *tempMXj);
1493 MVT::MvDot( *tempXj, *tempMXj, newDot );
1496 if ( SCT::magnitude(newDot[0]) >= SCT::magnitude(oldDot[0]*sing_tol_) ) {
1497 ScalarType diag = SCT::squareroot(SCT::magnitude(newDot[0]));
1503 MVT::MvAddMv( ONE/diag, *tempXj, ZERO, *tempXj, *Xj );
1505 MVT::MvAddMv( ONE/diag, *tempMXj, ZERO, *tempMXj, *MXj );
1527 #endif // BELOS_DGKS_ORTHOMANAGER_HPP
void setSingTol(const MagnitudeType sing_tol)
Set parameter for singular block detection.
bool is_null(const boost::shared_ptr< 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 ...
static magnitudeType eps()
const std::string & getLabel() const
This method returns the label being used by the timers in the orthogonalization manager.
~DGKSOrthoManager()
Destructor.
void setBlkTol(const MagnitudeType blk_tol)
Set parameter for block re-orthogonalization threshhold.
T & get(const std::string &name, T def_value)
void setDepTol(const MagnitudeType dep_tol)
Set parameter for re-orthogonalization threshhold.
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Declaration of basic traits for the multivector type.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
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.
An extension of the MultiVecTraits class that adds a new vector length method.
Class which defines basic traits for the operator type.
void setLabel(const std::string &label)
This method sets the label used by the timers in the orthogonalization manager.
ScalarTraits< ScalarType >::magnitudeType normFrobenius() const
Traits class which defines basic operations on multivectors.
int projectAndNormalize(MV &X, Teuchos::Array< Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > > C, Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > B, Teuchos::ArrayView< Teuchos::RCP< const MV > > Q) const
This method calls projectAndNormalize(X,Teuchos::null,C,B,Q); see documentation for that function...
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...
MagnitudeType getDepTol() const
Return parameter for re-orthogonalization threshhold.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Teuchos::RCP< const Teuchos::ParameterList > TEUCHOS_DEPRECATED getDefaultDgksParameters()
Default parameters for DGKSOrthoManager.
void setMyParamList(const RCP< ParameterList > ¶mList)
void validateParametersAndSetDefaults(ParameterList const &validParamList, int const depth=1000)
void project(MV &X, Teuchos::Array< Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > > C, Teuchos::ArrayView< Teuchos::RCP< const MV > > Q) const
This method calls project(X,Teuchos::null,C,Q); see documentation for that function.
Teuchos::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...
RCP< ParameterList > getNonconstParameterList()
DGKSOrthoManager(const std::string &label="Belos", Teuchos::RCP< const OP > Op=Teuchos::null, const int max_blk_ortho=2, const MagnitudeType blk_tol=10 *MGT::squareroot(MGT::eps()), const MagnitudeType dep_tol=MGT::one()/MGT::squareroot(2 *MGT::one()), const MagnitudeType sing_tol=10 *MGT::eps())
Constructor specifying re-orthogonalization tolerance.
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 ...
Teuchos::ScalarTraits< ScalarType >::magnitudeType orthonormError(const MV &X) const
This method computes the error in orthonormality of a multivector.
Teuchos::RCP< const Teuchos::ParameterList > TEUCHOS_DEPRECATED getFastDgksParameters()
"Fast" parameters for DGKSOrthoManager
TypeTo as(const TypeFrom &t)
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &plist)
An implementation of the Belos::MatOrthoManager that performs orthogonalization using (potentially) m...
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.
Belos's templated virtual class for providing routines for orthogonalization and orthonormzalition of...
MagnitudeType getBlkTol() const
Return parameter for block re-orthogonalization threshhold.
Belos header file which uses auto-configuration information to include necessary C++ headers...
int projectAndNormalize(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 getSingTol() const
Return parameter for singular block detection.
void TEUCHOS_DEPRECATED readDgksParameters(const Teuchos::RCP< const Teuchos::ParameterList > ¶ms, int &maxNumOrthogPasses, typename Teuchos::ScalarTraits< ScalarType >::magnitudeType &blkTol, typename Teuchos::ScalarTraits< ScalarType >::magnitudeType &depTol, typename Teuchos::ScalarTraits< ScalarType >::magnitudeType &singTol)
Read DGKS options from the given parameter list.
Templated virtual class for providing orthogonalization/orthonormalization methods with matrix-based ...
Teuchos::RCP< const Teuchos::ParameterList > getFastParameters() const