45 #ifndef __AnasaziTsqrOrthoManager_hpp
46 #define __AnasaziTsqrOrthoManager_hpp
48 #include "AnasaziTsqrOrthoManagerImpl.hpp"
75 template<
class Scalar,
class MV>
78 typedef Scalar scalar_type;
79 typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType magnitude_type;
84 typedef Teuchos::SerialDenseMatrix<int, Scalar> mat_type;
85 typedef Teuchos::RCP<mat_type> mat_ptr;
119 Teuchos::Array<mat_ptr> C,
121 Teuchos::ArrayView<Teuchos::RCP<const MV> > Q)
const = 0;
133 template<
class Scalar,
class MV>
137 public Teuchos::ParameterListAcceptor
140 typedef Scalar scalar_type;
141 typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType magnitude_type;
145 typedef Teuchos::SerialDenseMatrix<int, Scalar> mat_type;
146 typedef Teuchos::RCP<mat_type> mat_ptr;
148 void setParameterList (
const Teuchos::RCP<Teuchos::ParameterList>& params) {
149 impl_.setParameterList (params);
152 Teuchos::RCP<Teuchos::ParameterList> getNonconstParameterList () {
153 return impl_.getNonconstParameterList ();
156 Teuchos::RCP<Teuchos::ParameterList> unsetParameterList () {
157 return impl_.unsetParameterList ();
168 return impl_.getValidParameters();
181 return impl_.getFastParameters();
201 const std::string& label =
"Anasazi") :
202 impl_ (params, label)
216 void innerProd (
const MV &X,
const MV& Y, mat_type& Z)
const {
217 return impl_.innerProd (X, Y, Z);
220 void norm (
const MV& X, std::vector<magnitude_type>& normVec)
const {
221 return impl_.norm (X, normVec);
226 Teuchos::Array<Teuchos::RCP<const MV> > Q,
227 Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,Scalar> > > C
228 = Teuchos::tuple(Teuchos::RCP< Teuchos::SerialDenseMatrix<int,Scalar> >(Teuchos::null)))
const
230 return impl_.project (X, C, Q);
234 normalize (MV &X, mat_ptr B = Teuchos::null)
const
236 return impl_.normalize (X, B);
241 Teuchos::Array<Teuchos::RCP<const MV> > Q,
242 Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,Scalar> > > C
243 = Teuchos::tuple(Teuchos::RCP< Teuchos::SerialDenseMatrix<int,Scalar> >(Teuchos::null)),
244 Teuchos::RCP<Teuchos::SerialDenseMatrix<int,Scalar> > B = Teuchos::null)
const
246 return impl_.projectAndNormalize (X, C, B, Q);
268 return impl_.normalizeOutOfPlace (X, Q, B);
294 Teuchos::Array<mat_ptr> C,
296 Teuchos::ArrayView<Teuchos::RCP<const MV> > Q)
const
298 return impl_.projectAndNormalizeOutOfPlace (X_in, X_out, C, B, Q);
302 return impl_.orthonormError (X);
306 return impl_.orthogError (X1, X2);
331 template<
class Scalar,
class MV,
class OP>
335 public Teuchos::ParameterListAcceptorDefaultBase
338 typedef Scalar scalar_type;
339 typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType magnitude_type;
345 typedef Teuchos::SerialDenseMatrix<int, Scalar> mat_type;
346 typedef Teuchos::RCP<mat_type> mat_ptr;
393 const std::string& label =
"Belos",
394 Teuchos::RCP<const OP> Op = Teuchos::null) :
396 tsqr_ (params, label),
397 pSvqb_ (Teuchos::null)
409 Teuchos::RCP<const OP> Op = Teuchos::null) :
412 pSvqb_ (Teuchos::null)
442 void setParameterList (
const Teuchos::RCP<Teuchos::ParameterList>& params) {
456 if (! Op.is_null()) {
462 Teuchos::RCP<const OP> getOp ()
const {
470 Teuchos::Array<Teuchos::RCP<const MV> > Q,
471 Teuchos::Array<Teuchos::RCP<mat_type> > C =
472 Teuchos::tuple (Teuchos::RCP<mat_type> (Teuchos::null)),
473 Teuchos::RCP<MV> MX = Teuchos::null,
474 Teuchos::Array<Teuchos::RCP<const MV> > MQ =
475 Teuchos::tuple (Teuchos::null))
const
477 if (getOp().is_null()) {
485 if (! MX.is_null()) {
492 pSvqb_->projectMat (X, Q, C, MX, MQ);
498 mat_ptr B = Teuchos::null,
499 Teuchos::RCP<MV> MX = Teuchos::null)
const
501 if (getOp().is_null()) {
509 if (! MX.is_null()) {
517 return pSvqb_->normalizeMat (X, B, MX);
523 Teuchos::Array<Teuchos::RCP<const MV> > Q,
524 Teuchos::Array<Teuchos::RCP<mat_type> > C =
525 Teuchos::tuple (Teuchos::RCP<mat_type> (Teuchos::null)),
526 Teuchos::RCP<mat_type> B = Teuchos::null,
527 Teuchos::RCP<MV> MX = Teuchos::null,
528 Teuchos::Array<Teuchos::RCP<const MV> > MQ =
529 Teuchos::tuple (Teuchos::RCP<const MV> (Teuchos::null)))
const
531 if (getOp().is_null()) {
540 if (! MX.is_null()) {
548 return pSvqb_->projectAndNormalizeMat (X, Q, C, B, MX, MQ);
555 if (getOp().is_null()) {
560 const int rank = pSvqb_->normalize (X, B);
569 Teuchos::Array<mat_ptr> C,
571 Teuchos::ArrayView<Teuchos::RCP<const MV> > Q)
const
575 if (getOp().is_null()) {
581 Teuchos::Array<Teuchos::RCP<const MV> > Q_array (Q);
582 const int rank = pSvqb_->projectAndNormalize (X_in, Q_array, C, B);
593 if (getOp().is_null()) {
598 return pSvqb_->orthonormErrorMat (X, MX);
605 Teuchos::RCP<const MV> MX = Teuchos::null,
606 Teuchos::RCP<const MV> MY = Teuchos::null)
const
608 if (getOp().is_null()) {
613 return pSvqb_->orthogErrorMat (X, Y, MX, MY);
620 ensureSvqbInit ()
const
624 if (pSvqb_.is_null()) {
625 pSvqb_ = Teuchos::rcp (
new svqb_type (getOp()));
636 mutable tsqr_type tsqr_;
642 mutable Teuchos::RCP<svqb_type> pSvqb_;
647 #endif // __AnasaziTsqrOrthoManager_hpp