13#ifndef __AnasaziTsqrOrthoManager_hpp 
   14#define __AnasaziTsqrOrthoManager_hpp 
   16#include "AnasaziTsqrOrthoManagerImpl.hpp" 
   43  template<
class Scalar, 
class MV>
 
   46    typedef Scalar scalar_type;
 
   47    typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType magnitude_type;
 
   52    typedef Teuchos::SerialDenseMatrix<int, Scalar> mat_type;
 
   53    typedef Teuchos::RCP<mat_type>                  mat_ptr;
 
   87           Teuchos::Array<mat_ptr> C,
 
   89           Teuchos::ArrayView<Teuchos::RCP<const MV> > Q) 
const = 0;
 
 
  101  template<
class Scalar, 
class MV>
 
  105    public Teuchos::ParameterListAcceptor
 
  108    typedef Scalar scalar_type;
 
  109    typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType magnitude_type;
 
  111    typedef MV multivector_type;
 
  113    typedef Teuchos::SerialDenseMatrix<int, Scalar> mat_type;
 
  114    typedef Teuchos::RCP<mat_type>                  mat_ptr;
 
  116    void setParameterList (
const Teuchos::RCP<Teuchos::ParameterList>& params) {
 
  117      impl_.setParameterList (params);
 
  120    Teuchos::RCP<Teuchos::ParameterList> getNonconstParameterList () {
 
  121      return impl_.getNonconstParameterList ();
 
  124    Teuchos::RCP<Teuchos::ParameterList> unsetParameterList () {
 
  125      return impl_.unsetParameterList ();
 
  136      return impl_.getValidParameters();
 
 
  149      return impl_.getFastParameters();
 
 
  169          const std::string& label = 
"Anasazi") :
 
  170      impl_ (params, label)
 
 
  184    void innerProd (
const MV &X, 
const MV& Y, mat_type& Z)
 const {
 
  185      return impl_.innerProd (X, Y, Z);
 
 
  188    void norm (
const MV& X, std::vector<magnitude_type>& normVec)
 const {
 
  189      return impl_.norm (X, normVec);
 
  194       Teuchos::Array<Teuchos::RCP<const MV> > Q,
 
  195       Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,Scalar> > > C 
 
  196       = Teuchos::tuple(Teuchos::RCP< Teuchos::SerialDenseMatrix<int,Scalar> >(Teuchos::null)))
 const 
  198      return impl_.project (X, C, Q);
 
 
  202    normalize (MV &X, mat_ptr B = Teuchos::null)
 const 
  204      return impl_.normalize (X, B);
 
  209       Teuchos::Array<Teuchos::RCP<const MV> > Q,
 
  210       Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,Scalar> > > C 
 
  211       = Teuchos::tuple(Teuchos::RCP< Teuchos::SerialDenseMatrix<int,Scalar> >(Teuchos::null)),
 
  212       Teuchos::RCP<Teuchos::SerialDenseMatrix<int,Scalar> > B = Teuchos::null)
 const 
  214      return impl_.projectAndNormalize (X, C, B, Q);
 
 
  236      return impl_.normalizeOutOfPlace (X, Q, B);
 
 
  262           Teuchos::Array<mat_ptr> C,
 
  264           Teuchos::ArrayView<Teuchos::RCP<const MV> > Q)
 const 
  266      return impl_.projectAndNormalizeOutOfPlace (X_in, X_out, C, B, Q);
 
 
  270      return impl_.orthonormError (X);
 
 
  274      return impl_.orthogError (X1, X2);
 
 
 
  299  template<
class Scalar, 
class MV, 
class OP>
 
  303    public Teuchos::ParameterListAcceptorDefaultBase
 
  306    typedef Scalar scalar_type;
 
  307    typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType magnitude_type;
 
  313    typedef Teuchos::SerialDenseMatrix<int, Scalar> mat_type;
 
  314    typedef Teuchos::RCP<mat_type>                  mat_ptr;
 
  361       const std::string& label = 
"Belos",
 
  362       Teuchos::RCP<const OP> Op = Teuchos::null) :
 
  364      tsqr_ (params, label),
 
  365      pSvqb_ (Teuchos::null) 
 
 
  377       Teuchos::RCP<const OP> Op = Teuchos::null) :
 
  380      pSvqb_ (Teuchos::null) 
 
 
  394      return tsqr_.getValidParameters ();
 
 
  407      return tsqr_.getFastParameters ();
 
 
  410    void setParameterList (
const Teuchos::RCP<Teuchos::ParameterList>& params) {
 
  411      tsqr_.setParameterList (params);
 
  424      if (! Op.is_null()) {
 
 
  430    Teuchos::RCP<const OP> 
getOp ()
 const { 
 
 
  438    Teuchos::Array<Teuchos::RCP<const MV> > Q,
 
  439    Teuchos::Array<Teuchos::RCP<mat_type> > C = 
 
  440      Teuchos::tuple (Teuchos::RCP<mat_type> (Teuchos::null)),
 
  441    Teuchos::RCP<MV> MX = Teuchos::null,
 
  442    Teuchos::Array<Teuchos::RCP<const MV> > MQ = 
 
  443      Teuchos::tuple (Teuchos::null))
 const 
  445      if (
getOp().is_null()) {
 
  448  tsqr_.project (X, C, Q);
 
  453  if (! MX.is_null()) {
 
  455    MVT::Assign (X, *MX);
 
  460  pSvqb_->projectMat (X, Q, C, MX, MQ);
 
 
  466      mat_ptr B = Teuchos::null,
 
  467      Teuchos::RCP<MV> MX = Teuchos::null)
 const 
  469      if (
getOp().is_null()) {
 
  472  const int rank = tsqr_.normalize (X, B);
 
  477  if (! MX.is_null()) {
 
  479    MVT::Assign (X, *MX);
 
  485  return pSvqb_->normalizeMat (X, B, MX);
 
  491          Teuchos::Array<Teuchos::RCP<const MV> > Q,
 
  492          Teuchos::Array<Teuchos::RCP<mat_type> > C = 
 
  493            Teuchos::tuple (Teuchos::RCP<mat_type> (Teuchos::null)),
 
  494          Teuchos::RCP<mat_type> B = Teuchos::null,
 
  495          Teuchos::RCP<MV> MX = Teuchos::null,
 
  496          Teuchos::Array<Teuchos::RCP<const MV> > MQ = 
 
  497            Teuchos::tuple (Teuchos::RCP<const MV> (Teuchos::null)))
 const  
  499      if (
getOp().is_null()) {
 
  502  const int rank = tsqr_.projectAndNormalize (X, C, B, Q); 
 
  508  if (! MX.is_null()) {
 
  510    MVT::Assign (X, *MX);
 
  516  return pSvqb_->projectAndNormalizeMat (X, Q, C, B, MX, MQ);
 
 
  523      if (
getOp().is_null()) {
 
  524  return tsqr_.normalizeOutOfPlace (X, Q, B);
 
  528  const int rank = pSvqb_->normalize (X, B);
 
 
  537           Teuchos::Array<mat_ptr> C,
 
  539           Teuchos::ArrayView<Teuchos::RCP<const MV> > Q)
 const 
  543      if (
getOp().is_null()) {
 
  544  return tsqr_.projectAndNormalizeOutOfPlace (X_in, X_out, C, B, Q);
 
  549  Teuchos::Array<Teuchos::RCP<const MV> > Q_array (Q);
 
  550  const int rank = pSvqb_->projectAndNormalize (X_in, Q_array, C, B);
 
  553  MVT::Assign (X_in, X_out);
 
 
  561      if (
getOp().is_null()) {
 
  562  return tsqr_.orthonormError (X);
 
  566  return pSvqb_->orthonormErrorMat (X, MX);
 
 
  573        Teuchos::RCP<const MV> MX = Teuchos::null, 
 
  574        Teuchos::RCP<const MV> MY = Teuchos::null)
 const 
  576      if (
getOp().is_null()) {
 
  577  return tsqr_.orthogError (X, Y);
 
  581  return pSvqb_->orthogErrorMat (X, Y, MX, MY);
 
 
  588    ensureSvqbInit ()
 const 
  592      if (pSvqb_.is_null()) {
 
  593  pSvqb_ = Teuchos::rcp (
new svqb_type (
getOp()));
 
  604    mutable tsqr_type tsqr_;
 
  610    mutable Teuchos::RCP<svqb_type> pSvqb_;
 
 
Orthogonalization manager based on the SVQB technique described in "A Block Orthogonalization Procedu...
 
Anasazi's templated virtual class for providing routines for orthogonalization and orthonormalization...
 
virtual Teuchos::RCP< const OP > getOp() const
Get operator used for inner product.
 
virtual void setOp(Teuchos::RCP< const OP > Op)
Set operator used for inner product.
 
Traits class which defines basic operations on multivectors.
 
Anasazi's templated virtual class for providing routines for orthogonalization and orthonormalization...
 
Mixin for out-of-place orthogonalization.
 
virtual int projectAndNormalizeOutOfPlace(MV &X_in, MV &X_out, Teuchos::Array< mat_ptr > C, mat_ptr B, Teuchos::ArrayView< Teuchos::RCP< const MV > > Q) const =0
Project and normalize X_in into X_out.
 
virtual ~OutOfPlaceNormalizerMixin()
Trivial virtual destructor, to silence compiler warnings.
 
virtual int normalizeOutOfPlace(MV &X, MV &Q, mat_ptr B) const =0
Normalize X into Q*B.
 
MV multivector_type
Multivector type with which this class was specialized.
 
An implementation of the Anasazi::MatOrthoManager that performs orthogonalization using the SVQB iter...
 
MatOrthoManager subclass using TSQR or SVQB.
 
int projectAndNormalizeMat(MV &X, Teuchos::Array< Teuchos::RCP< const MV > > Q, Teuchos::Array< Teuchos::RCP< mat_type > > C=Teuchos::tuple(Teuchos::RCP< mat_type >(Teuchos::null)), Teuchos::RCP< mat_type > 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
Provides matrix-based projection/orthonormalization method.
 
Teuchos::RCP< const Teuchos::ParameterList > getFastParameters()
Get "fast" parameters for TsqrMatOrthoManager.
 
OP operator_type
Operator type with which this class was specialized.
 
virtual void setOp(Teuchos::RCP< const OP > Op)
Set operator used for inner product.
 
int projectAndNormalizeOutOfPlace(MV &X_in, MV &X_out, Teuchos::Array< mat_ptr > C, mat_ptr B, Teuchos::ArrayView< Teuchos::RCP< const MV > > Q) const
Project and normalize X_in into X_out.
 
int normalizeOutOfPlace(MV &X, MV &Q, mat_ptr B) const
Normalize X into Q*B.
 
TsqrMatOrthoManager(const std::string &label="Belos", Teuchos::RCP< const OP > Op=Teuchos::null)
Constructor (that sets default parameters).
 
TsqrMatOrthoManager(const Teuchos::RCP< Teuchos::ParameterList > ¶ms, const std::string &label="Belos", Teuchos::RCP< const OP > Op=Teuchos::null)
Constructor (that sets user-specified parameters).
 
magnitude_type orthonormErrorMat(const MV &X, Teuchos::RCP< const MV > MX=Teuchos::null) const
This method computes the error in orthonormality of a multivector.
 
magnitude_type orthogErrorMat(const MV &X, const MV &Y, Teuchos::RCP< const MV > MX=Teuchos::null, Teuchos::RCP< const MV > MY=Teuchos::null) const
This method computes the error in orthogonality of two multivectors.
 
Teuchos::RCP< const OP > getOp() const
Get operator used for inner product.
 
MV multivector_type
Multivector type with which this class was specialized.
 
void projectMat(MV &X, Teuchos::Array< Teuchos::RCP< const MV > > Q, Teuchos::Array< Teuchos::RCP< mat_type > > C=Teuchos::tuple(Teuchos::RCP< mat_type >(Teuchos::null)), Teuchos::RCP< MV > MX=Teuchos::null, Teuchos::Array< Teuchos::RCP< const MV > > MQ=Teuchos::tuple(Teuchos::null)) const
Provides matrix-based projection method.
 
virtual ~TsqrMatOrthoManager()
Destructor (declared virtual for memory safety of derived classes).
 
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Get default parameters for TsqrMatOrthoManager.
 
TSQR-based OrthoManager subclass implementation.
 
TSQR-based OrthoManager subclass.
 
magnitude_type orthogError(const MV &X1, const MV &X2) const
This method computes the error in orthogonality of two multivectors.
 
virtual ~TsqrOrthoManager()
Destructor, declared virtual for safe inheritance.
 
int projectAndNormalize(MV &X, Teuchos::Array< Teuchos::RCP< const MV > > Q, Teuchos::Array< Teuchos::RCP< Teuchos::SerialDenseMatrix< int, Scalar > > > C=Teuchos::tuple(Teuchos::RCP< Teuchos::SerialDenseMatrix< int, Scalar > >(Teuchos::null)), Teuchos::RCP< Teuchos::SerialDenseMatrix< int, Scalar > > B=Teuchos::null) const
Given a set of bases Q[i] and a multivector X, this method computes an orthonormal basis for .
 
Teuchos::RCP< const Teuchos::ParameterList > getFastParameters() const
Get "fast" parameters for TsqrOrthoManager.
 
magnitude_type orthonormError(const MV &X) const
This method computes the error in orthonormality of a multivector.
 
TsqrOrthoManager(const Teuchos::RCP< Teuchos::ParameterList > ¶ms, const std::string &label="Anasazi")
Constructor (that sets user-specified parameters).
 
TsqrOrthoManager(const std::string &label)
Constructor (that sets default parameters).
 
int normalizeOutOfPlace(MV &X, MV &Q, mat_ptr B) const
Normalize X into Q*B, overwriting X with invalid values.
 
void innerProd(const MV &X, const MV &Y, mat_type &Z) const
Provides the inner product defining the orthogonality concepts.
 
int projectAndNormalizeOutOfPlace(MV &X_in, MV &X_out, Teuchos::Array< mat_ptr > C, mat_ptr B, Teuchos::ArrayView< Teuchos::RCP< const MV > > Q) const
Project and normalize X_in into X_out; overwrite X_in.
 
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Default valid parameter list.
 
void project(MV &X, Teuchos::Array< Teuchos::RCP< const MV > > Q, Teuchos::Array< Teuchos::RCP< Teuchos::SerialDenseMatrix< int, Scalar > > > C=Teuchos::tuple(Teuchos::RCP< Teuchos::SerialDenseMatrix< int, Scalar > >(Teuchos::null))) const
Given a list of mutually orthogonal and internally orthonormal bases Q, this method projects a multiv...
 
Namespace Anasazi contains the classes, structs, enums and utilities used by the Anasazi package.