#include <NOX_Epetra_MultiVector.H>
Public Types | |
enum | MemoryType { CreateView, CreateCopy } |
Type of memory management to use when constructing the vector. More... | |
Public Member Functions | |
MultiVector (const Teuchos::RCP< Epetra_MultiVector > &source, NOX::CopyType type=NOX::DeepCopy, NOX::Epetra::MultiVector::MemoryType memoryType=NOX::Epetra::MultiVector::CreateCopy) | |
Constructor that creates a COPY or VIEW of the Epetra_MultiVector. | |
MultiVector (const Epetra_MultiVector &source, NOX::CopyType type=NOX::DeepCopy) | |
Construct by copying map and/or elements of an Epetra_MultiVector. | |
MultiVector (const NOX::Epetra::MultiVector &source, NOX::CopyType type=NOX::DeepCopy) | |
Copy constructor. | |
~MultiVector () | |
Destruct MultiVector. | |
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 Epetra_MultiVector & | getEpetraMultiVector () |
Get reference to underlying Epetra vector. | |
virtual const Epetra_MultiVector & | getEpetraMultiVector () const |
Get const reference to underlying Epetra vector. | |
virtual NOX::Abstract::MultiVector & | init (double value) |
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 Epetra_MultiVector &source) |
Copy source multi-vector source into this multi-vector. | |
virtual NOX::Abstract::MultiVector & | operator= (const NOX::Epetra::MultiVector &source) |
Copy source multi-vector source into this multi-vector. | |
virtual NOX::Abstract::MultiVector & | operator= (const NOX::Abstract::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::Epetra::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::Epetra::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::Epetra::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::Epetra::MultiVector &a, double beta, const NOX::Epetra::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::Epetra::MultiVector &a, const NOX::Abstract::MultiVector::DenseMatrix &b, double gamma=0.0) |
virtual Teuchos::RCP < NOX::Abstract::MultiVector > | clone (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::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 ndex.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::Epetra::MultiVector &y, NOX::Abstract::MultiVector::DenseMatrix &b) const |
Protected Member Functions | |
MultiVector (int numvecs) | |
Constructor (Protected). | |
void | checkIndex (int idx) const |
Checks whether an index is valid. Throws an error if invalid. | |
Protected Attributes | |
Teuchos::RCP< Epetra_MultiVector > | epetraMultiVec |
Pointer to petra vector owned by this object. | |
vector< NOX::Epetra::Vector * > | noxEpetraVectors |
NOX::Epetra::Vector's for each column of the multivector. |
Definition at line 62 of file NOX_Epetra_MultiVector.H.
Type of memory management to use when constructing the vector.
CreateView | Keeps a pointer to and uses the actual Epetra_Vector passed in. |
CreateCopy | Allocates a new underlying Epetra_Vector object. |
Definition at line 67 of file NOX_Epetra_MultiVector.H.
NOX::Epetra::MultiVector::MultiVector | ( | const Teuchos::RCP< Epetra_MultiVector > & | source, | |
NOX::CopyType | type = NOX::DeepCopy , |
|||
NOX::Epetra::MultiVector::MemoryType | memoryType = NOX::Epetra::MultiVector::CreateCopy | |||
) |
Constructor that creates a COPY or VIEW of the Epetra_MultiVector.
NOTE: This ctor should just always create a view. It should be implicit from the fact that a RCP object is being passed in that a persisting relationship is present. However, since this could cause confusion, the default is to make a copy and if a user wants a view, they must pass in an explicit flag.
A VIEW of a vector uses the same underlying memory. WARNING: A View can be dangerous since multiple objects can access the same memory locations.
Definition at line 57 of file NOX_Epetra_MultiVector.C.
References CreateView, NOX::DeepCopy, epetraMultiVec, noxEpetraVectors, and NOX::ShapeCopy.
NOX::Epetra::MultiVector::MultiVector | ( | const Epetra_MultiVector & | source, | |
NOX::CopyType | type = NOX::DeepCopy | |||
) |
Construct by copying map and/or elements of an Epetra_MultiVector.
Definition at line 87 of file NOX_Epetra_MultiVector.C.
References NOX::DeepCopy, epetraMultiVec, noxEpetraVectors, and NOX::ShapeCopy.
NOX::Epetra::MultiVector::MultiVector | ( | const NOX::Epetra::MultiVector & | source, | |
NOX::CopyType | type = NOX::DeepCopy | |||
) |
Copy constructor.
Definition at line 110 of file NOX_Epetra_MultiVector.C.
References NOX::DeepCopy, epetraMultiVec, getEpetraMultiVector(), noxEpetraVectors, numVectors(), and NOX::ShapeCopy.
NOX::Epetra::MultiVector::~MultiVector | ( | ) | [virtual] |
Destruct MultiVector.
Reimplemented from NOX::Abstract::MultiVector.
Definition at line 135 of file NOX_Epetra_MultiVector.C.
References noxEpetraVectors.
NOX::Epetra::MultiVector::MultiVector | ( | int | numvecs | ) | [protected] |
Constructor (Protected).
Definition at line 49 of file NOX_Epetra_MultiVector.C.
References noxEpetraVectors.
Epetra_MultiVector & NOX::Epetra::MultiVector::getEpetraMultiVector | ( | ) | [virtual] |
Get reference to underlying Epetra vector.
Definition at line 163 of file NOX_Epetra_MultiVector.C.
References epetraMultiVec.
Referenced by LOCA::Epetra::Group::applyComplexMultiVector(), LOCA::BorderedSolver::EpetraHouseholder::computeUV(), MultiVector(), and LOCA::BorderedSolver::EpetraHouseholder::updateJacobianForPreconditioner().
const Epetra_MultiVector & NOX::Epetra::MultiVector::getEpetraMultiVector | ( | ) | const [virtual] |
Get const reference to underlying Epetra vector.
Definition at line 169 of file NOX_Epetra_MultiVector.C.
References epetraMultiVec.
NOX::Abstract::MultiVector & NOX::Epetra::MultiVector::init | ( | double | value | ) | [virtual] |
Initialize every element of this multi-vector with gamma
.
Implements NOX::Abstract::MultiVector.
Definition at line 175 of file NOX_Epetra_MultiVector.C.
References epetraMultiVec.
NOX::Abstract::MultiVector & NOX::Epetra::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 182 of file NOX_Epetra_MultiVector.C.
References epetraMultiVec.
NOX::Abstract::MultiVector & NOX::Epetra::MultiVector::operator= | ( | const Epetra_MultiVector & | source | ) | [virtual] |
Copy source multi-vector source
into this multi-vector.
Definition at line 143 of file NOX_Epetra_MultiVector.C.
References epetraMultiVec.
Referenced by operator=().
NOX::Abstract::MultiVector & NOX::Epetra::MultiVector::operator= | ( | const NOX::Epetra::MultiVector & | source | ) | [virtual] |
Copy source multi-vector source
into this multi-vector.
Definition at line 156 of file NOX_Epetra_MultiVector.C.
References epetraMultiVec.
NOX::Abstract::MultiVector & NOX::Epetra::MultiVector::operator= | ( | const NOX::Abstract::MultiVector & | source | ) | [virtual] |
Copy source multi-vector source
into this multi-vector.
Implements NOX::Abstract::MultiVector.
Definition at line 150 of file NOX_Epetra_MultiVector.C.
References operator=().
NOX::Abstract::MultiVector & NOX::Epetra::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 191 of file NOX_Epetra_MultiVector.C.
NOX::Abstract::MultiVector & NOX::Epetra::MultiVector::augment | ( | const NOX::Abstract::MultiVector & | source | ) | [virtual] |
Append the vectors in source
to *this
.
Implements NOX::Abstract::MultiVector.
Definition at line 218 of file NOX_Epetra_MultiVector.C.
NOX::Abstract::Vector & NOX::Epetra::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 253 of file NOX_Epetra_MultiVector.C.
References NOX::Epetra::Vector::CreateView, epetraMultiVec, and noxEpetraVectors.
const NOX::Abstract::Vector & NOX::Epetra::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 270 of file NOX_Epetra_MultiVector.C.
References NOX::Epetra::Vector::CreateView, epetraMultiVec, and noxEpetraVectors.
NOX::Abstract::MultiVector & NOX::Epetra::MultiVector::scale | ( | double | gamma | ) | [virtual] |
Scale each element of this multivector by gamma
.
Implements NOX::Abstract::MultiVector.
Definition at line 287 of file NOX_Epetra_MultiVector.C.
References epetraMultiVec.
NOX::Abstract::MultiVector & NOX::Epetra::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 294 of file NOX_Epetra_MultiVector.C.
Referenced by update().
NOX::Abstract::MultiVector & NOX::Epetra::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 312 of file NOX_Epetra_MultiVector.C.
References update().
NOX::Abstract::MultiVector & NOX::Epetra::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 335 of file NOX_Epetra_MultiVector.C.
References update().
Teuchos::RCP< NOX::Abstract::MultiVector > NOX::Epetra::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.
Implements NOX::Abstract::MultiVector.
Definition at line 376 of file NOX_Epetra_MultiVector.C.
References epetraMultiVec.
Teuchos::RCP< NOX::Abstract::MultiVector > NOX::Epetra::MultiVector::clone | ( | int | numvecs | ) | const [virtual] |
Creates a new multi-vector with numvecs
columns.
Implements NOX::Abstract::MultiVector.
Definition at line 384 of file NOX_Epetra_MultiVector.C.
References epetraMultiVec.
Teuchos::RCP< NOX::Abstract::MultiVector > NOX::Epetra::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 394 of file NOX_Epetra_MultiVector.C.
References epetraMultiVec.
Teuchos::RCP< NOX::Abstract::MultiVector > NOX::Epetra::MultiVector::subView | ( | const 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.
Definition at line 407 of file NOX_Epetra_MultiVector.C.
References epetraMultiVec.
void NOX::Epetra::MultiVector::norm | ( | vector< double > & | result, | |
NOX::Abstract::Vector::NormType | type = NOX::Abstract::Vector::TwoNorm | |||
) | const [virtual] |
Norm.
Implements NOX::Abstract::MultiVector.
Definition at line 420 of file NOX_Epetra_MultiVector.C.
References epetraMultiVec, NOX::Abstract::Vector::MaxNorm, NOX::Abstract::Vector::OneNorm, and NOX::Abstract::Vector::TwoNorm.
void NOX::Epetra::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 438 of file NOX_Epetra_MultiVector.C.
int NOX::Epetra::MultiVector::length | ( | ) | const [virtual] |
Return the length of multi-vector.
Implements NOX::Abstract::MultiVector.
Definition at line 461 of file NOX_Epetra_MultiVector.C.
References epetraMultiVec.
int NOX::Epetra::MultiVector::numVectors | ( | ) | const [virtual] |
Return the number of vectors in the multi-vector.
Implements NOX::Abstract::MultiVector.
Definition at line 466 of file NOX_Epetra_MultiVector.C.
References epetraMultiVec.
Referenced by LOCA::BorderedSolver::EpetraAugmented::applyInverse(), and MultiVector().
void NOX::Epetra::MultiVector::print | ( | std::ostream & | stream | ) | const [virtual] |
Print the vector. This is meant for debugging purposes only.
Implements NOX::Abstract::MultiVector.
Definition at line 471 of file NOX_Epetra_MultiVector.C.
References epetraMultiVec.
void NOX::Epetra::MultiVector::checkIndex | ( | int | idx | ) | const [protected] |
Checks whether an index is valid. Throws an error if invalid.
Definition at line 477 of file NOX_Epetra_MultiVector.C.
References epetraMultiVec.
Teuchos::RCP<Epetra_MultiVector> NOX::Epetra::MultiVector::epetraMultiVec [protected] |
Pointer to petra vector owned by this object.
Definition at line 291 of file NOX_Epetra_MultiVector.H.
Referenced by checkIndex(), clone(), getEpetraMultiVector(), init(), length(), MultiVector(), norm(), numVectors(), operator=(), operator[](), print(), random(), scale(), subCopy(), and subView().
vector<NOX::Epetra::Vector*> NOX::Epetra::MultiVector::noxEpetraVectors [mutable, protected] |
NOX::Epetra::Vector's for each column of the multivector.
Each Epetra_Vector in the NOX::Epetra::Vector has a view into a column of the multivector and get filled in as needed by operator[].
Definition at line 298 of file NOX_Epetra_MultiVector.H.
Referenced by MultiVector(), operator[](), and ~MultiVector().