47 #ifndef BELOS_MATORTHOMANAGER_HPP
48 #define BELOS_MATORTHOMANAGER_HPP
73 template <
class ScalarType,
class MV,
class OP>
74 class MatOrthoManager :
public OrthoManager<ScalarType,MV> {
122 if ( MVT::GetNumberVecs(X) < MVT::GetNumberVecs(Y) ) {
123 R = MVT::Clone(X,MVT::GetNumberVecs(X));
124 OPT::Apply(*
_Op,X,*R);
130 R = MVT::Clone(Y,MVT::GetNumberVecs(Y));
131 OPT::Apply(*
_Op,Y,*R);
140 MVT::MvTransMv(SCT::one(),*P,*Q,Z);
156 if ( MY == Teuchos::null ) {
161 MVT::MvTransMv(SCT::one(),X,*MY,Z);
165 MVT::MvTransMv(SCT::one(),X,Y,Z);
172 norm(X,Teuchos::null,normvec);
202 int nvecs = MVT::GetNumberVecs(X);
208 if (normvec.size() <
static_cast<size_t>(nvecs))
209 normvec.resize (nvecs);
214 MVT::MvNorm(X, normvec);
221 if(MX == Teuchos::null) {
223 OPT::Apply(*
_Op,X,*tempVec);
229 const int numColsMX = MVT::GetNumberVecs(*MX);
231 "MatOrthoManager::norm(X, MX, normvec): "
232 "MX has fewer columns than X: "
233 "MX has " << numColsMX <<
" columns, "
234 "and X has " << nvecs <<
" columns.");
237 std::vector<ScalarType> dotvec(nvecs);
238 MVT::MvDot(X,*MX,dotvec);
239 for (
int i=0; i<nvecs; i++) {
240 normvec[i] = MT::squareroot( SCT::magnitude(dotvec[i]) );
Collection of types and exceptions used within the Belos solvers.
virtual 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.
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 ...
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Declaration of basic traits for the multivector type.
virtual Teuchos::ScalarTraits< ScalarType >::magnitudeType orthogError(const MV &X1, const MV &X2) const
This method computes the error in orthogonality of two multivectors. This method. ...
Class which defines basic traits for the operator type.
virtual int normalize(MV &X, Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > B) const
This method calls normalize(X,Teuchos::null,B); see documentation for that function.
virtual int normalize(MV &X, Teuchos::RCP< MV > MX, Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > B) const =0
This method takes a multivector X and attempts to compute an orthonormal basis for ...
Traits class which defines basic operations on multivectors.
void innerProd(const MV &X, const MV &Y, Teuchos::SerialDenseMatrix< int, ScalarType > &Z) const
Provides the inner product defining the orthogonality concepts, using the provided operator...
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Teuchos::RCP< const OP > _Op
virtual int projectAndNormalizeImpl(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
virtual ~MatOrthoManager()
Destructor.
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 =0
virtual 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 =0
Given a list of (mutually and internally) orthonormal bases Q, this method takes a multivector X and ...
void norm(const MV &X, std::vector< typename Teuchos::ScalarTraits< ScalarType >::magnitudeType > &normvec) const
Provides the norm induced by innerProd().
Templated virtual class for providing orthogonalization/orthonormalization methods.
MatOrthoManager(Teuchos::RCP< const OP > Op=Teuchos::null)
Default constructor.
Teuchos::RCP< const OP > getOp() const
Get operator.
void innerProd(const MV &X, const MV &Y, Teuchos::RCP< const MV > MY, Teuchos::SerialDenseMatrix< int, ScalarType > &Z) const
Provides the inner product defining the orthogonality concepts, using the provided operator...
Class which defines basic traits for the operator type.
void norm(const MV &X, Teuchos::RCP< const MV > MX, std::vector< typename Teuchos::ScalarTraits< ScalarType >::magnitudeType > &normvec) const
Compute norm of each column of X.
Belos header file which uses auto-configuration information to include necessary C++ headers...
virtual Teuchos::ScalarTraits< ScalarType >::magnitudeType orthonormError(const MV &X) const
This method computes the error in orthonormality of a multivector.
void setOp(Teuchos::RCP< const OP > Op)
Set operator.