#include <NOX_LAPACK_Vector.H>
Public Member Functions | |
Vector () | |
Construct an empty vector. | |
Vector (int n) | |
Construct a zero vector of length n. | |
Vector (int n, double *v) | |
Construct a vector of length n from given array. | |
Vector (const NOX::LAPACK::Vector &source, NOX::CopyType type=NOX::DeepCopy) | |
Copy constructor. | |
~Vector () | |
Destruct Vector. | |
int | length () const |
Return the length of vector. | |
double & | operator() (int i) |
Return the i-th element. | |
const double & | operator() (int i) const |
Return the i-th element (const version). | |
ostream & | leftshift (ostream &stream) const |
Prints out the vector to the specified stream. | |
void | print (std::ostream &stream) const |
Print the vector. To be used for debugging only. | |
NOX::Abstract::Vector & | init (double value) |
Initialize every element of this vector with gamma . | |
virtual NOX::Abstract::Vector & | random (bool useSeed=false, int seed=1) |
Initialize every element of this vector with random values. | |
NOX::Abstract::Vector & | operator= (const vector< double > &y) |
Replace this vector with STL double vector y. | |
NOX::Abstract::Vector & | operator= (const NOX::LAPACK::Vector &y) |
NOX::Abstract::Vector & | operator= (const NOX::Abstract::Vector &y) |
Copy source vector y into this vector. | |
NOX::Abstract::Vector & | abs (const NOX::LAPACK::Vector &y) |
NOX::Abstract::Vector & | abs (const NOX::Abstract::Vector &y) |
Put element-wise absolute values of source vector y into this vector. | |
NOX::Abstract::Vector & | reciprocal (const NOX::LAPACK::Vector &y) |
NOX::Abstract::Vector & | reciprocal (const NOX::Abstract::Vector &y) |
Put element-wise reciprocal of source vector y into this vector. | |
NOX::Abstract::Vector & | scale (double gamma) |
Scale each element of this vector by gamma . | |
NOX::Abstract::Vector & | scale (const NOX::LAPACK::Vector &a) |
NOX::Abstract::Vector & | scale (const NOX::Abstract::Vector &a) |
Scale this vector element-by-element by the vector a. | |
NOX::Abstract::Vector & | update (double alpha, const NOX::LAPACK::Vector &a, double gamma=0.0) |
NOX::Abstract::Vector & | update (double alpha, const NOX::Abstract::Vector &a, double gamma=0.0) |
Compute x = (alpha * a) + (gamma * x) where x is this vector. | |
NOX::Abstract::Vector & | update (double alpha, const NOX::LAPACK::Vector &a, double beta, const NOX::LAPACK::Vector &b, double gamma=0.0) |
NOX::Abstract::Vector & | update (double alpha, const NOX::Abstract::Vector &a, double beta, const NOX::Abstract::Vector &b, double gamma=0.0) |
Compute x = (alpha * a) + (beta * b) + (gamma * x) where x is this vector. | |
Teuchos::RCP < NOX::Abstract::Vector > | 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. | |
double | norm (NOX::Abstract::Vector::NormType type=NOX::Abstract::Vector::TwoNorm) const |
Norm. | |
double | norm (const NOX::LAPACK::Vector &weights) const |
double | norm (const NOX::Abstract::Vector &weights) const |
Weighted 2-Norm. | |
double | innerProduct (const NOX::LAPACK::Vector &y) const |
double | innerProduct (const NOX::Abstract::Vector &y) const |
Inner product with y . | |
Private Member Functions | |
double & | operator[] (int i) |
Return the i-th element. | |
const double & | operator[] (int i) const |
Return the i-th element. | |
Private Attributes | |
int | n |
The used length of vector. | |
vector< double > | x |
The vector owned by this object. |
Definition at line 67 of file NOX_LAPACK_Vector.H.
NOX::LAPACK::Vector::Vector | ( | ) |
Construct an empty vector.
Reimplemented from NOX::Abstract::Vector.
Definition at line 47 of file NOX_LAPACK_Vector.C.
NOX::LAPACK::Vector::Vector | ( | int | n | ) |
NOX::LAPACK::Vector::Vector | ( | int | n, | |
double * | v | |||
) |
NOX::LAPACK::Vector::Vector | ( | const NOX::LAPACK::Vector & | source, | |
NOX::CopyType | type = NOX::DeepCopy | |||
) |
NOX::LAPACK::Vector::~Vector | ( | ) | [virtual] |
Destruct Vector.
Reimplemented from NOX::Abstract::Vector.
Definition at line 72 of file NOX_LAPACK_Vector.C.
NOX::Abstract::Vector & NOX::LAPACK::Vector::init | ( | double | gamma | ) | [virtual] |
Initialize every element of this vector with gamma
.
Here x represents this vector, and we update it as
Implements NOX::Abstract::Vector.
Definition at line 96 of file NOX_LAPACK_Vector.C.
NOX::Abstract::Vector & NOX::LAPACK::Vector::random | ( | bool | useSeed = false , |
|
int | seed = 1 | |||
) | [virtual] |
Initialize every element of this vector with random values.
Reimplemented from NOX::Abstract::Vector.
Definition at line 103 of file NOX_LAPACK_Vector.C.
References n, NOX::Random::number(), NOX::Random::setSeed(), and x.
NOX::Abstract::Vector & NOX::LAPACK::Vector::operator= | ( | const vector< double > & | y | ) |
Replace this vector with STL double vector y.
Definition at line 76 of file NOX_LAPACK_Vector.C.
References x.
Referenced by operator=().
NOX::Abstract::Vector & NOX::LAPACK::Vector::operator= | ( | const NOX::Abstract::Vector & | y | ) | [virtual] |
Copy source vector y
into this vector.
Here x represents this vector, and we update it as
Implements NOX::Abstract::Vector.
Definition at line 83 of file NOX_LAPACK_Vector.C.
References operator=().
NOX::Abstract::Vector & NOX::LAPACK::Vector::abs | ( | const NOX::Abstract::Vector & | y | ) | [virtual] |
Put element-wise absolute values of source vector y
into this vector.
Here x represents this vector, and we update it as
Implements NOX::Abstract::Vector.
Definition at line 114 of file NOX_LAPACK_Vector.C.
NOX::Abstract::Vector & NOX::LAPACK::Vector::reciprocal | ( | const NOX::Abstract::Vector & | y | ) | [virtual] |
Put element-wise reciprocal of source vector y
into this vector.
Here x represents this vector, and we update it as
Implements NOX::Abstract::Vector.
Definition at line 128 of file NOX_LAPACK_Vector.C.
NOX::Abstract::Vector & NOX::LAPACK::Vector::scale | ( | double | gamma | ) | [virtual] |
Scale each element of this vector by gamma
.
Here x represents this vector, and we update it as
Implements NOX::Abstract::Vector.
Definition at line 142 of file NOX_LAPACK_Vector.C.
References x.
Referenced by NOX::LAPACK::Group::computeNewton(), and scale().
NOX::Abstract::Vector & NOX::LAPACK::Vector::scale | ( | const NOX::Abstract::Vector & | a | ) | [virtual] |
Scale this vector element-by-element by the vector a.
Here x represents this vector, and we update it as
Implements NOX::Abstract::Vector.
Definition at line 190 of file NOX_LAPACK_Vector.C.
References scale().
NOX::Abstract::Vector & NOX::LAPACK::Vector::update | ( | double | alpha, | |
const NOX::Abstract::Vector & | a, | |||
double | gamma = 0.0 | |||
) | [virtual] |
Compute x = (alpha * a) + (gamma * x) where x is this vector.
Here x represents this vector, and we update it as
Implements NOX::Abstract::Vector.
Definition at line 149 of file NOX_LAPACK_Vector.C.
NOX::Abstract::Vector & NOX::LAPACK::Vector::update | ( | double | alpha, | |
const NOX::Abstract::Vector & | a, | |||
double | beta, | |||
const NOX::Abstract::Vector & | b, | |||
double | gamma = 0.0 | |||
) | [virtual] |
Compute x = (alpha * a) + (beta * b) + (gamma * x) where x is this vector.
Here x represents this vector, and we update it as
Implements NOX::Abstract::Vector.
Definition at line 167 of file NOX_LAPACK_Vector.C.
Teuchos::RCP< NOX::Abstract::Vector > NOX::LAPACK::Vector::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" (the memory is allocated for the objects, but the current values are not copied into the vector). Note that there is no assumption that a vector created by ShapeCopy is initialized to zeros.
Implements NOX::Abstract::Vector.
Definition at line 204 of file NOX_LAPACK_Vector.C.
double NOX::LAPACK::Vector::norm | ( | NOX::Abstract::Vector::NormType | type = NOX::Abstract::Vector::TwoNorm |
) | const [virtual] |
Norm.
Here x represents this vector, and we compute its norm as follows: for each NOX::Abstract::Vector::NormType:
Implements NOX::Abstract::Vector.
Definition at line 211 of file NOX_LAPACK_Vector.C.
References NOX::LAPACK::i_one, NOX::Abstract::Vector::MaxNorm, NOX::Abstract::Vector::OneNorm, NOX::Abstract::Vector::TwoNorm, and x.
Referenced by NOX::LAPACK::Group::getNormF(), norm(), and LOCA::LAPACK::Interface::projectToDraw().
double NOX::LAPACK::Vector::norm | ( | const NOX::Abstract::Vector & | weights | ) | const [virtual] |
Weighted 2-Norm.
Here x represents this vector, and we compute its weighted norm as follows:
Implements NOX::Abstract::Vector.
Definition at line 239 of file NOX_LAPACK_Vector.C.
References norm().
double NOX::LAPACK::Vector::innerProduct | ( | const NOX::Abstract::Vector & | y | ) | const [virtual] |
Inner product with y
.
Here x represents this vector, and we compute its inner product with y as follows:
Implements NOX::Abstract::Vector.
Definition at line 261 of file NOX_LAPACK_Vector.C.
int NOX::LAPACK::Vector::length | ( | ) | const [virtual] |
Return the length of vector.
Implements NOX::Abstract::Vector.
Definition at line 277 of file NOX_LAPACK_Vector.C.
double & NOX::LAPACK::Vector::operator() | ( | int | i | ) |
const double & NOX::LAPACK::Vector::operator() | ( | int | i | ) | const |
Return the i-th element (const version).
Definition at line 297 of file NOX_LAPACK_Vector.C.
References x.
ostream & NOX::LAPACK::Vector::leftshift | ( | ostream & | stream | ) | const |
Prints out the vector to the specified stream.
For example, a vector would appear as
It will be all on one line, with a single space between each entry, bracketed on either side.
Definition at line 302 of file NOX_LAPACK_Vector.C.
References x.
Referenced by operator<<().
void NOX::LAPACK::Vector::print | ( | std::ostream & | stream | ) | const [virtual] |
Print the vector. To be used for debugging only.
Reimplemented from NOX::Abstract::Vector.
Definition at line 316 of file NOX_LAPACK_Vector.C.
double & NOX::LAPACK::Vector::operator[] | ( | int | i | ) | [private] |
const double & NOX::LAPACK::Vector::operator[] | ( | int | i | ) | const [private] |
int NOX::LAPACK::Vector::n [private] |
vector<double> NOX::LAPACK::Vector::x [private] |
The vector owned by this object.
Definition at line 193 of file NOX_LAPACK_Vector.H.
Referenced by init(), leftshift(), norm(), operator()(), operator=(), operator[](), random(), and scale().