NOX Development
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
NOX::Thyra::MultiVector Class Reference

Implementation of NOX::Abstract::MultiVector for Thyra multi-vectors. More...

#include <NOX_Thyra_MultiVector.H>

Inheritance diagram for NOX::Thyra::MultiVector:
Inheritance graph
[legend]
Collaboration diagram for NOX::Thyra::MultiVector:
Collaboration graph
[legend]

Public Member Functions

 MultiVector (const Teuchos::RCP< ::Thyra::MultiVectorBase< double > > &source)
 Constructor that creates a VIEW of the Thyra multivector.
 
 MultiVector (const ::Thyra::MultiVectorBase< double > &source)
 Construct from a given Thyra multivector.
 
 MultiVector (const NOX::Thyra::MultiVector &source, NOX::CopyType type=NOX::DeepCopy)
 Copy constructor.
 
 ~MultiVector ()
 Destruct MultiVector.
 
virtual Teuchos::RCP< ::Thyra::MultiVectorBase< double > > getThyraMultiVector ()
 Get RCP to underlying Thyra vector.
 
virtual Teuchos::RCP< const ::Thyra::MultiVectorBase< double > > getThyraMultiVector () const
 Get const RCP to underlying Thyra vector.
 
virtual NOX::Abstract::MultiVectorinit (double value)
 Initialize every element of this multi-vector with gamma.
 
virtual NOX::Abstract::MultiVectorrandom (bool useSeed=false, int seed=1)
 Initialize each element of this multi-vector with a random value.
 
virtual NOX::Abstract::MultiVectoroperator= (const NOX::Abstract::MultiVector &source)
 Copy source multi-vector source into this multi-vector.
 
NOX::Abstract::MultiVectoroperator= (const NOX::Thyra::MultiVector &source)
 
virtual NOX::Abstract::MultiVectorsetBlock (const NOX::Abstract::MultiVector &source, const std::vector< int > &index)
 Copy the vectors in source to a set of vectors in *this. The index.size() vectors in source are copied to a subset of vectors in *this indicated by the indices given in index.
 
virtual NOX::Abstract::MultiVectoraugment (const NOX::Abstract::MultiVector &source)
 Append the vectors in source to *this.
 
virtual NOX::Abstract::Vectoroperator[] (int i)
 Return a reference to the i-th column of the multivector as an abstract vector.
 
virtual const NOX::Abstract::Vectoroperator[] (int i) const
 Return a const reference to the i-th column of the multivector as an abstract vector.
 
virtual NOX::Abstract::MultiVectorscale (double gamma)
 Scale each element of this multivector by gamma.
 
virtual NOX::Abstract::MultiVectorupdate (double alpha, const NOX::Abstract::MultiVector &a, double gamma=0.0)
 Compute x = (alpha * a) + (gamma * x) where a is a multi-vector and x = *this.
 
virtual NOX::Abstract::MultiVectorupdate (double alpha, const NOX::Abstract::MultiVector &a, double beta, const NOX::Abstract::MultiVector &b, double gamma=0.0)
 Compute x = (alpha * a) + (beta * b) + (gamma * x) where a and b are multi-vectors and x = *this.
 
virtual NOX::Abstract::MultiVectorupdate (Teuchos::ETransp transb, double alpha, const NOX::Abstract::MultiVector &a, const NOX::Abstract::MultiVector::DenseMatrix &b, double gamma=0.0)
 Compute x = (alpha * a * b) + (gamma * x) where a is a multivector, b is a dense matrix, x = *this, and op(b) = b if transb = Teuchos::NO_TRANS and op(b) is b transpose if transb = Teuchos::TRANS.
 
virtual Teuchos::RCP< NOX::Abstract::MultiVectorclone (CopyType type=DeepCopy) const
 Create a new Vector of the same underlying type by cloning "this", and return a pointer to the new vector.
 
virtual Teuchos::RCP< NOX::Abstract::MultiVectorclone (int numvecs) const
 Creates a new multi-vector with numvecs columns.
 
virtual Teuchos::RCP< NOX::Abstract::MultiVectorsubCopy (const std::vector< int > &index) const
 Creates a new multi-vector with index.size() columns whose columns are copies of the columns of *this given by index.
 
virtual Teuchos::RCP< NOX::Abstract::MultiVectorsubView (const std::vector< int > &index) const
 Creates a new multi-vector with ndex.size() columns that shares the columns of *this given by index.
 
virtual void norm (std::vector< double > &result, NOX::Abstract::Vector::NormType type=NOX::Abstract::Vector::TwoNorm) const
 Norm.
 
virtual void multiply (double alpha, const NOX::Abstract::MultiVector &y, NOX::Abstract::MultiVector::DenseMatrix &b) const
 Computes the matrix-matrix product $\alpha * y^T * (*this)$.
 
virtual NOX::size_type length () const
 Return the length of multi-vector.
 
virtual int numVectors () const
 Return the number of vectors in the multi-vector.
 
virtual void print (std::ostream &stream) const
 Print the vector. This is meant for debugging purposes only.
 
void setWeightVector (const Teuchos::RCP< const ::Thyra::VectorBase< double > > &weightVec)
 Set the weighting vector used for inner products and norms.
 
bool hasWeightVector () const
 
Teuchos::RCP< const ::Thyra::VectorBase< double > > getWeightVector () const
 Returns a weighting vector if one was set, otherwise throws.
 
bool getImplicitWeighting () const
 Return true if implicit weighting is currently enabled.
 
void setImplicitWeighting (bool do_implicit_weighting)
 Set to true to enable implicit weighting, false disables.
 
- Public Member Functions inherited from NOX::Abstract::MultiVector
 MultiVector ()
 Default constructor. Does nothing.
 

Protected Member Functions

bool isContiguous (const std::vector< int > &index) const
 Check whether an index array is contiguous.
 

Protected Attributes

Teuchos::RCP< ::Thyra::MultiVectorBase< double > > thyraMultiVec
 Pointer to petra vector owned by this object.
 
std::vector< Teuchos::RCP< NOX::Thyra::Vector > > noxThyraVectors
 NOX::Thyra::Vector's for each column of the multivector.
 
Teuchos::RCP< const ::Thyra::VectorBase< double > > weightVec_
 Thyra vector used for weighting inner product and norms.
 
Teuchos::RCP< ::Thyra::MultiVectorBase< double > > tmpMultiVec_
 Thyra vector used for weighting inner product and norms.
 
bool do_implicit_weighting_
 True if implicit weighting is enabled (i.e. a nonnull wieghtVec_)
 

Additional Inherited Members

- Public Types inherited from NOX::Abstract::MultiVector
typedef Teuchos::SerialDenseMatrix< int, double > DenseMatrix
 Typename of dense matrices.
 

Detailed Description

Implementation of NOX::Abstract::MultiVector for Thyra multi-vectors.

Constructor & Destructor Documentation

◆ ~MultiVector()

NOX::Thyra::MultiVector::~MultiVector ( )
virtual

Destruct MultiVector.

Reimplemented from NOX::Abstract::MultiVector.

Member Function Documentation

◆ augment()

NOX::Abstract::MultiVector & NOX::Thyra::MultiVector::augment ( const NOX::Abstract::MultiVector & source)
virtual

Append the vectors in source to *this.

Implements NOX::Abstract::MultiVector.

References thyraMultiVec.

◆ clone() [1/2]

Teuchos::RCP< NOX::Abstract::MultiVector > NOX::Thyra::MultiVector::clone ( CopyType type = DeepCopy) const
virtual

Create a new Vector of the same underlying type by cloning "this", and return a pointer to the new vector.

If type is NOX::DeepCopy, then we need to create an exact replica of "this". Otherwise, if type is NOX::ShapeCopy, we need only replicate the shape of "this". Note that there is no assumption that a vector created by ShapeCopy is initialized to zeros.

Returns
Pointer to newly created vector or NULL if clone is not supported.

Implements NOX::Abstract::MultiVector.

◆ clone() [2/2]

Teuchos::RCP< NOX::Abstract::MultiVector > NOX::Thyra::MultiVector::clone ( int numvecs) const
virtual

Creates a new multi-vector with numvecs columns.

Implements NOX::Abstract::MultiVector.

◆ getImplicitWeighting()

bool NOX::Thyra::MultiVector::getImplicitWeighting ( ) const
virtual

Return true if implicit weighting is currently enabled.

CAUTION: This is a power user feature and should only be used in concert with specialized NOX::Abstract::Vector implementations.

Implements NOX::Abstract::ImplicitWeighting.

◆ init()

NOX::Abstract::MultiVector & NOX::Thyra::MultiVector::init ( double value)
virtual

Initialize every element of this multi-vector with gamma.

Implements NOX::Abstract::MultiVector.

◆ length()

NOX::size_type NOX::Thyra::MultiVector::length ( ) const
virtual

Return the length of multi-vector.

Implements NOX::Abstract::MultiVector.

◆ multiply()

void NOX::Thyra::MultiVector::multiply ( double alpha,
const NOX::Abstract::MultiVector & y,
NOX::Abstract::MultiVector::DenseMatrix & b ) const
virtual

Computes the matrix-matrix product $\alpha * y^T * (*this)$.

Implements NOX::Abstract::MultiVector.

References thyraMultiVec.

◆ norm()

void NOX::Thyra::MultiVector::norm ( std::vector< double > & result,
NOX::Abstract::Vector::NormType type = NOX::Abstract::Vector::TwoNorm ) const
virtual

◆ numVectors()

int NOX::Thyra::MultiVector::numVectors ( ) const
virtual

Return the number of vectors in the multi-vector.

Implements NOX::Abstract::MultiVector.

◆ operator=()

NOX::Abstract::MultiVector & NOX::Thyra::MultiVector::operator= ( const NOX::Abstract::MultiVector & source)
virtual

Copy source multi-vector source into this multi-vector.

Implements NOX::Abstract::MultiVector.

◆ operator[]() [1/2]

NOX::Abstract::Vector & NOX::Thyra::MultiVector::operator[] ( int i)
virtual

Return a reference to the i-th column of the multivector as an abstract vector.

Implements NOX::Abstract::MultiVector.

◆ operator[]() [2/2]

const NOX::Abstract::Vector & NOX::Thyra::MultiVector::operator[] ( int i) const
virtual

Return a const reference to the i-th column of the multivector as an abstract vector.

Implements NOX::Abstract::MultiVector.

◆ print()

void NOX::Thyra::MultiVector::print ( std::ostream & stream) const
virtual

Print the vector. This is meant for debugging purposes only.

Implements NOX::Abstract::MultiVector.

◆ random()

NOX::Abstract::MultiVector & NOX::Thyra::MultiVector::random ( bool useSeed = false,
int seed = 1 )
virtual

Initialize each element of this multi-vector with a random value.

Implements NOX::Abstract::MultiVector.

◆ scale()

NOX::Abstract::MultiVector & NOX::Thyra::MultiVector::scale ( double gamma)
virtual

Scale each element of this multivector by gamma.

Implements NOX::Abstract::MultiVector.

◆ setBlock()

NOX::Abstract::MultiVector & NOX::Thyra::MultiVector::setBlock ( const NOX::Abstract::MultiVector & source,
const std::vector< int > & index )
virtual

Copy the vectors in source to a set of vectors in *this. The index.size() vectors in source are copied to a subset of vectors in *this indicated by the indices given in index.

Implements NOX::Abstract::MultiVector.

References subView(), and thyraMultiVec.

◆ setImplicitWeighting()

void NOX::Thyra::MultiVector::setImplicitWeighting ( bool do_implicit_weighting)
virtual

Set to true to enable implicit weighting, false disables.

CAUTION: This is a power user feature and should only be used in concert with specialized NOX::Abstract::Vector implementations.

Implements NOX::Abstract::ImplicitWeighting.

◆ subCopy()

Teuchos::RCP< NOX::Abstract::MultiVector > NOX::Thyra::MultiVector::subCopy ( const std::vector< int > & index) const
virtual

Creates a new multi-vector with index.size() columns whose columns are copies of the columns of *this given by index.

Implements NOX::Abstract::MultiVector.

◆ subView()

Teuchos::RCP< NOX::Abstract::MultiVector > NOX::Thyra::MultiVector::subView ( const std::vector< int > & index) const
virtual

Creates a new multi-vector with ndex.size() columns that shares the columns of *this given by index.

Implements NOX::Abstract::MultiVector.

Referenced by setBlock().

◆ update() [1/3]

NOX::Abstract::MultiVector & NOX::Thyra::MultiVector::update ( double alpha,
const NOX::Abstract::MultiVector & a,
double beta,
const NOX::Abstract::MultiVector & b,
double gamma = 0.0 )
virtual

Compute x = (alpha * a) + (beta * b) + (gamma * x) where a and b are multi-vectors and x = *this.

Implements NOX::Abstract::MultiVector.

References thyraMultiVec.

◆ update() [2/3]

NOX::Abstract::MultiVector & NOX::Thyra::MultiVector::update ( double alpha,
const NOX::Abstract::MultiVector & a,
double gamma = 0.0 )
virtual

Compute x = (alpha * a) + (gamma * x) where a is a multi-vector and x = *this.

Implements NOX::Abstract::MultiVector.

References thyraMultiVec.

◆ update() [3/3]

NOX::Abstract::MultiVector & NOX::Thyra::MultiVector::update ( Teuchos::ETransp transb,
double alpha,
const NOX::Abstract::MultiVector & a,
const NOX::Abstract::MultiVector::DenseMatrix & b,
double gamma = 0.0 )
virtual

Compute x = (alpha * a * b) + (gamma * x) where a is a multivector, b is a dense matrix, x = *this, and op(b) = b if transb = Teuchos::NO_TRANS and op(b) is b transpose if transb = Teuchos::TRANS.

Implements NOX::Abstract::MultiVector.

References thyraMultiVec.

Member Data Documentation

◆ noxThyraVectors

std::vector< Teuchos::RCP<NOX::Thyra::Vector> > NOX::Thyra::MultiVector::noxThyraVectors
mutableprotected

NOX::Thyra::Vector's for each column of the multivector.

Each Thyra_Vector in the NOX::Thyra::Vector has a view into a column of the multivector and get filled in as needed by operator[].


The documentation for this class was generated from the following files: