#include <NOX_MultiVector.H>
Public Member Functions | |
MultiVector (const NOX::Abstract::Vector &v, int numVecs=1, NOX::CopyType type=NOX::DeepCopy) | |
Create MultiVector with numVecs columns out of a single NOX::Abstract::Vector. | |
MultiVector (const NOX::Abstract::Vector *const *vs, int numVecs, NOX::CopyType type=NOX::DeepCopy) | |
Create MultiVector out of array of NOX::Abstract::Vector's. | |
MultiVector (const MultiVector &source, NOX::CopyType type=NOX::DeepCopy) | |
Copy constructor. | |
virtual | ~MultiVector () |
Destructor. | |
virtual int | 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. | |
virtual NOX::Abstract::MultiVector & | init (double gamma) |
Initialize every element of this multi-vector with gamma . | |
virtual NOX::Abstract::MultiVector & | random (bool useSeed=false, int seed=1) |
Initialize each element of this multi-vector with a random value. | |
virtual NOX::Abstract::MultiVector & | operator= (const NOX::Abstract::MultiVector &source) |
Copy source multi-vector source into this multi-vector. | |
virtual NOX::Abstract::MultiVector & | operator= (const NOX::MultiVector &source) |
Copy source multi-vector source into this multi-vector. | |
virtual NOX::Abstract::MultiVector & | setBlock (const NOX::Abstract::MultiVector &source, const 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::MultiVector & | setBlock (const NOX::MultiVector &source, const vector< int > &index) |
virtual NOX::Abstract::MultiVector & | augment (const NOX::Abstract::MultiVector &source) |
Append the vectors in source to *this . | |
virtual NOX::Abstract::MultiVector & | augment (const NOX::MultiVector &source) |
virtual NOX::Abstract::Vector & | operator[] (int i) |
Return a reference to the i-th column of the multivector as an abstract vector. | |
virtual const NOX::Abstract::Vector & | operator[] (int i) const |
Return a const reference to the i-th column of the multivector as an abstract vector. | |
virtual NOX::Abstract::MultiVector & | scale (double gamma) |
Scale each element of this multivector by gamma . | |
virtual NOX::Abstract::MultiVector & | update (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::MultiVector & | update (double alpha, const NOX::MultiVector &a, double gamma=0.0) |
virtual NOX::Abstract::MultiVector & | update (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::MultiVector & | update (double alpha, const NOX::MultiVector &a, double beta, const NOX::MultiVector &b, double gamma=0.0) |
virtual NOX::Abstract::MultiVector & | update (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 NOX::Abstract::MultiVector & | update (Teuchos::ETransp transb, double alpha, const NOX::MultiVector &a, const NOX::Abstract::MultiVector::DenseMatrix &b, double gamma=0.0) |
virtual Teuchos::RCP < NOX::Abstract::MultiVector > | clone (NOX::CopyType type=NOX::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::MultiVector > | clone (int numvecs) const |
Creates a new multi-vector with numvecs columns. | |
virtual Teuchos::RCP < NOX::Abstract::MultiVector > | subCopy (const 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::MultiVector > | subView (const vector< int > &index) const |
Creates a new multi-vector with index.size() columns that shares the columns of *this given by index . | |
virtual void | norm (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 ![]() | |
virtual void | multiply (double alpha, const NOX::MultiVector &y, NOX::Abstract::MultiVector::DenseMatrix &b) const |
Protected Member Functions | |
MultiVector (int numvecs) | |
Create MultiVector holding numvecs vectors. | |
void | checkIndex (int idx) const |
Checks whether an index is valid. Throws an error if invalid. | |
void | checkSize (int sz) const |
Checks whether the given multivector size is compatible with this multivector. Throws an error if invalid. | |
Protected Attributes | |
vector< Teuchos::RCP < NOX::Abstract::Vector > > | vecs |
Stores pointers to NOX::Abstract::Vector's. |
Definition at line 54 of file NOX_MultiVector.H.
NOX::MultiVector::MultiVector | ( | const NOX::Abstract::Vector & | v, | |
int | numVecs = 1 , |
|||
NOX::CopyType | type = NOX::DeepCopy | |||
) |
Create MultiVector with numVecs
columns out of a single NOX::Abstract::Vector.
Definition at line 54 of file NOX_MultiVector.C.
References NOX::Abstract::Vector::clone(), and vecs.
NOX::MultiVector::MultiVector | ( | const NOX::Abstract::Vector *const * | vs, | |
int | numVecs, | |||
NOX::CopyType | type = NOX::DeepCopy | |||
) |
Create MultiVector out of array of NOX::Abstract::Vector's.
Definition at line 69 of file NOX_MultiVector.C.
References NOX::Abstract::Vector::clone(), and vecs.
NOX::MultiVector::MultiVector | ( | const MultiVector & | source, | |
NOX::CopyType | type = NOX::DeepCopy | |||
) |
NOX::MultiVector::~MultiVector | ( | ) | [virtual] |
Destructor.
Reimplemented from NOX::Abstract::MultiVector.
Definition at line 94 of file NOX_MultiVector.C.
NOX::MultiVector::MultiVector | ( | int | numvecs | ) | [protected] |
NOX::Abstract::MultiVector & NOX::MultiVector::init | ( | double | gamma | ) | [virtual] |
Initialize every element of this multi-vector with gamma
.
Implements NOX::Abstract::MultiVector.
Definition at line 100 of file NOX_MultiVector.C.
References vecs.
NOX::Abstract::MultiVector & NOX::MultiVector::random | ( | bool | useSeed = false , |
|
int | seed = 1 | |||
) | [virtual] |
Initialize each element of this multi-vector with a random value.
Implements NOX::Abstract::MultiVector.
Definition at line 108 of file NOX_MultiVector.C.
References vecs.
NOX::Abstract::MultiVector & NOX::MultiVector::operator= | ( | const NOX::Abstract::MultiVector & | source | ) | [virtual] |
Copy source multi-vector source
into this multi-vector.
Implements NOX::Abstract::MultiVector.
Definition at line 118 of file NOX_MultiVector.C.
NOX::Abstract::MultiVector & NOX::MultiVector::operator= | ( | const NOX::MultiVector & | source | ) | [virtual] |
Copy source multi-vector source
into this multi-vector.
Definition at line 124 of file NOX_MultiVector.C.
References checkSize(), and vecs.
NOX::Abstract::MultiVector & NOX::MultiVector::setBlock | ( | const NOX::Abstract::MultiVector & | source, | |
const 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.
Definition at line 136 of file NOX_MultiVector.C.
NOX::Abstract::MultiVector & NOX::MultiVector::augment | ( | const NOX::Abstract::MultiVector & | source | ) | [virtual] |
Append the vectors in source
to *this
.
Implements NOX::Abstract::MultiVector.
Definition at line 159 of file NOX_MultiVector.C.
NOX::Abstract::Vector & NOX::MultiVector::operator[] | ( | int | i | ) | [virtual] |
Return a reference to the i-th column of the multivector as an abstract vector.
Implements NOX::Abstract::MultiVector.
Definition at line 179 of file NOX_MultiVector.C.
References checkIndex(), and vecs.
const NOX::Abstract::Vector & NOX::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.
Definition at line 186 of file NOX_MultiVector.C.
References checkIndex(), and vecs.
NOX::Abstract::MultiVector & NOX::MultiVector::scale | ( | double | gamma | ) | [virtual] |
Scale each element of this multivector by gamma
.
Implements NOX::Abstract::MultiVector.
Definition at line 193 of file NOX_MultiVector.C.
References vecs.
NOX::Abstract::MultiVector & NOX::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.
Definition at line 201 of file NOX_MultiVector.C.
Referenced by update().
NOX::Abstract::MultiVector & NOX::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.
Definition at line 218 of file NOX_MultiVector.C.
References update().
NOX::Abstract::MultiVector & NOX::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.
Definition at line 239 of file NOX_MultiVector.C.
References update().
Teuchos::RCP< NOX::Abstract::MultiVector > NOX::MultiVector::clone | ( | NOX::CopyType | type = NOX::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.
Implements NOX::Abstract::MultiVector.
Definition at line 312 of file NOX_MultiVector.C.
Teuchos::RCP< NOX::Abstract::MultiVector > NOX::MultiVector::clone | ( | int | numvecs | ) | const [virtual] |
Creates a new multi-vector with numvecs
columns.
Implements NOX::Abstract::MultiVector.
Definition at line 320 of file NOX_MultiVector.C.
References NOX::ShapeCopy, and vecs.
Teuchos::RCP< NOX::Abstract::MultiVector > NOX::MultiVector::subCopy | ( | const 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.
Definition at line 331 of file NOX_MultiVector.C.
References checkIndex(), NOX::DeepCopy, and vecs.
Teuchos::RCP< NOX::Abstract::MultiVector > NOX::MultiVector::subView | ( | const vector< int > & | index | ) | const [virtual] |
Creates a new multi-vector with index.size()
columns that shares the columns of *this
given by index
.
Implements NOX::Abstract::MultiVector.
Definition at line 345 of file NOX_MultiVector.C.
References checkIndex(), and vecs.
void NOX::MultiVector::norm | ( | vector< double > & | result, | |
NOX::Abstract::Vector::NormType | type = NOX::Abstract::Vector::TwoNorm | |||
) | const [virtual] |
Norm.
Implements NOX::Abstract::MultiVector.
Definition at line 359 of file NOX_MultiVector.C.
References vecs.
void NOX::MultiVector::multiply | ( | double | alpha, | |
const NOX::Abstract::MultiVector & | y, | |||
NOX::Abstract::MultiVector::DenseMatrix & | b | |||
) | const [virtual] |
Computes the matrix-matrix product .
Implements NOX::Abstract::MultiVector.
Definition at line 370 of file NOX_MultiVector.C.
int NOX::MultiVector::length | ( | ) | const [virtual] |
Return the length of multi-vector.
Implements NOX::Abstract::MultiVector.
Definition at line 388 of file NOX_MultiVector.C.
References vecs.
int NOX::MultiVector::numVectors | ( | ) | const [virtual] |
Return the number of vectors in the multi-vector.
Implements NOX::Abstract::MultiVector.
Definition at line 394 of file NOX_MultiVector.C.
References vecs.
void NOX::MultiVector::print | ( | std::ostream & | stream | ) | const [virtual] |
Print the vector. This is meant for debugging purposes only.
Implements NOX::Abstract::MultiVector.
Definition at line 400 of file NOX_MultiVector.C.
References vecs.
void NOX::MultiVector::checkIndex | ( | int | idx | ) | const [protected] |
Checks whether an index is valid. Throws an error if invalid.
Definition at line 407 of file NOX_MultiVector.C.
References vecs.
Referenced by operator[](), subCopy(), and subView().
void NOX::MultiVector::checkSize | ( | int | sz | ) | const [protected] |
Checks whether the given multivector size is compatible with this multivector. Throws an error if invalid.
Definition at line 416 of file NOX_MultiVector.C.
References vecs.
Referenced by operator=().
vector< Teuchos::RCP<NOX::Abstract::Vector> > NOX::MultiVector::vecs [protected] |
Stores pointers to NOX::Abstract::Vector's.
Definition at line 250 of file NOX_MultiVector.H.
Referenced by checkIndex(), checkSize(), clone(), init(), length(), MultiVector(), norm(), numVectors(), operator=(), operator[](), print(), random(), scale(), subCopy(), and subView().