ROL
|
Provides the std::vector implementation of the ROL::Vector interface. More...
#include <ROL_SROMVector.hpp>
Public Member Functions | |
SROMVector (const ROL::Ptr< ProbabilityVector< Real > > &pvec, const ROL::Ptr< AtomVector< Real > > &avec) | |
void | set (const Vector< Real > &x) |
Set \(y \leftarrow x\) where \(y = \mathtt{*this}\). More... | |
void | plus (const Vector< Real > &x) |
Compute \(y \leftarrow y + x\), where \(y = \mathtt{*this}\). More... | |
void | scale (const Real alpha) |
Compute \(y \leftarrow \alpha y\) where \(y = \mathtt{*this}\). More... | |
void | axpy (const Real alpha, const Vector< Real > &x) |
Compute \(y \leftarrow \alpha x + y\) where \(y = \mathtt{*this}\). More... | |
Real | dot (const Vector< Real > &x) const |
Compute \( \langle y,x \rangle \) where \(y = \mathtt{*this}\). More... | |
Real | norm () const |
Returns \( \| y \| \) where \(y = \mathtt{*this}\). More... | |
ROL::Ptr< Vector< Real > > | clone (void) const |
Clone to make a new (uninitialized) vector. More... | |
const Vector< Real > & | dual (void) const |
Return dual representation of \(\mathtt{*this}\), for example, the result of applying a Riesz map, or change of basis, or change of memory layout. More... | |
int | dimension (void) const |
Return dimension of the vector space. More... | |
void | applyUnary (const Elementwise::UnaryFunction< Real > &f) |
void | applyBinary (const Elementwise::BinaryFunction< Real > &f, const Vector< Real > &x) |
Real | reduce (const Elementwise::ReductionOp< Real > &r) const |
const ROL::Ptr< const AtomVector< Real > > | getAtomVector (void) const |
const ROL::Ptr< const ProbabilityVector< Real > > | getProbabilityVector (void) const |
ROL::Ptr< AtomVector< Real > > | getAtomVector (void) |
ROL::Ptr< ProbabilityVector < Real > > | getProbabilityVector (void) |
void | setAtomVector (const AtomVector< Real > &vec) |
void | setProbabilityVector (const ProbabilityVector< Real > &vec) |
Public Member Functions inherited from ROL::Vector< Real > | |
virtual | ~Vector () |
virtual void | zero () |
Set to zero vector. More... | |
virtual ROL::Ptr< Vector > | basis (const int i) const |
Return i-th basis vector. More... | |
virtual Real | apply (const Vector< Real > &x) const |
Apply \(\mathtt{*this}\) to a dual vector. This is equivalent to the call \(\mathtt{this->dot(x.dual())}\). More... | |
virtual void | print (std::ostream &outStream) const |
virtual void | setScalar (const Real C) |
Set \(y \leftarrow C\) where \(C\in\mathbb{R}\). More... | |
virtual void | randomize (const Real l=0.0, const Real u=1.0) |
Set vector to be uniform random between [l,u]. More... | |
virtual std::vector< Real > | checkVector (const Vector< Real > &x, const Vector< Real > &y, const bool printToStream=true, std::ostream &outStream=std::cout) const |
Verify vector-space methods. More... | |
Private Types | |
typedef std::vector< Real > ::size_type | uint |
Private Attributes | |
const ROL::Ptr < ProbabilityVector< Real > > | pvec_ |
const ROL::Ptr< AtomVector < Real > > | avec_ |
ROL::Ptr< Vector< Real > > | dual_pvec_ |
ROL::Ptr< Vector< Real > > | dual_avec_ |
ROL::Ptr< SROMVector< Real > > | dual_vec_ |
bool | isDualInitialized_ |
Provides the std::vector implementation of the ROL::Vector interface.
Definition at line 27 of file ROL_SROMVector.hpp.
|
private |
Definition at line 28 of file ROL_SROMVector.hpp.
|
inline |
Definition at line 40 of file ROL_SROMVector.hpp.
References ROL::SROMVector< Real >::avec_, ROL::SROMVector< Real >::clone(), ROL::SROMVector< Real >::dual_avec_, ROL::SROMVector< Real >::dual_pvec_, and ROL::SROMVector< Real >::pvec_.
|
inlinevirtual |
Set \(y \leftarrow x\) where \(y = \mathtt{*this}\).
[in] | x | is a vector. |
On return \(\mathtt{*this} = x\). Uses zero and plus methods for the computation. Please overload if a more efficient implementation is needed.
Reimplemented from ROL::Vector< Real >.
Definition at line 47 of file ROL_SROMVector.hpp.
References ROL::SROMVector< Real >::avec_, ROL::SROMVector< Real >::getAtomVector(), ROL::SROMVector< Real >::getProbabilityVector(), and ROL::SROMVector< Real >::pvec_.
|
inlinevirtual |
Compute \(y \leftarrow y + x\), where \(y = \mathtt{*this}\).
[in] | x | is the vector to be added to \(\mathtt{*this}\). |
On return \(\mathtt{*this} = \mathtt{*this} + x\).
Implements ROL::Vector< Real >.
Definition at line 53 of file ROL_SROMVector.hpp.
References ROL::SROMVector< Real >::avec_, ROL::SROMVector< Real >::getAtomVector(), ROL::SROMVector< Real >::getProbabilityVector(), and ROL::SROMVector< Real >::pvec_.
|
inlinevirtual |
Compute \(y \leftarrow \alpha y\) where \(y = \mathtt{*this}\).
[in] | alpha | is the scaling of \(\mathtt{*this}\). |
On return \(\mathtt{*this} = \alpha (\mathtt{*this}) \).
Implements ROL::Vector< Real >.
Definition at line 59 of file ROL_SROMVector.hpp.
References ROL::SROMVector< Real >::avec_, and ROL::SROMVector< Real >::pvec_.
|
inlinevirtual |
Compute \(y \leftarrow \alpha x + y\) where \(y = \mathtt{*this}\).
[in] | alpha | is the scaling of x. |
[in] | x | is a vector. |
On return \(\mathtt{*this} = \mathtt{*this} + \alpha x \). Uses clone, set, scale and plus for the computation. Please overload if a more efficient implementation is needed.
Reimplemented from ROL::Vector< Real >.
Definition at line 64 of file ROL_SROMVector.hpp.
References ROL::SROMVector< Real >::avec_, ROL::SROMVector< Real >::getAtomVector(), ROL::SROMVector< Real >::getProbabilityVector(), and ROL::SROMVector< Real >::pvec_.
|
inlinevirtual |
Compute \( \langle y,x \rangle \) where \(y = \mathtt{*this}\).
[in] | x | is the vector that forms the dot product with \(\mathtt{*this}\). |
Implements ROL::Vector< Real >.
Definition at line 70 of file ROL_SROMVector.hpp.
References ROL::SROMVector< Real >::avec_, ROL::SROMVector< Real >::getAtomVector(), ROL::SROMVector< Real >::getProbabilityVector(), and ROL::SROMVector< Real >::pvec_.
Referenced by ROL::SROMVector< Real >::norm().
|
inlinevirtual |
Returns \( \| y \| \) where \(y = \mathtt{*this}\).
Implements ROL::Vector< Real >.
Definition at line 77 of file ROL_SROMVector.hpp.
References ROL::SROMVector< Real >::dot().
|
inlinevirtual |
Clone to make a new (uninitialized) vector.
Provides the means of allocating temporary memory in ROL.
Implements ROL::Vector< Real >.
Definition at line 83 of file ROL_SROMVector.hpp.
References ROL::SROMVector< Real >::avec_, and ROL::SROMVector< Real >::pvec_.
Referenced by ROL::SROMVector< Real >::SROMVector().
|
inlinevirtual |
Return dual representation of \(\mathtt{*this}\), for example, the result of applying a Riesz map, or change of basis, or change of memory layout.
By default, returns the current object. Please overload if you need a dual representation.
Reimplemented from ROL::Vector< Real >.
Definition at line 89 of file ROL_SROMVector.hpp.
References ROL::SROMVector< Real >::avec_, ROL::SROMVector< Real >::dual_avec_, ROL::SROMVector< Real >::dual_pvec_, ROL::SROMVector< Real >::dual_vec_, ROL::SROMVector< Real >::isDualInitialized_, and ROL::SROMVector< Real >::pvec_.
|
inlinevirtual |
Return dimension of the vector space.
Overload if the basis is overloaded.
Reimplemented from ROL::Vector< Real >.
Definition at line 101 of file ROL_SROMVector.hpp.
References ROL::SROMVector< Real >::avec_, and ROL::SROMVector< Real >::pvec_.
|
inlinevirtual |
Reimplemented from ROL::Vector< Real >.
Definition at line 105 of file ROL_SROMVector.hpp.
References ROL::SROMVector< Real >::avec_, and ROL::SROMVector< Real >::pvec_.
|
inlinevirtual |
Reimplemented from ROL::Vector< Real >.
Definition at line 110 of file ROL_SROMVector.hpp.
References ROL::SROMVector< Real >::avec_, ROL::SROMVector< Real >::getAtomVector(), ROL::SROMVector< Real >::getProbabilityVector(), and ROL::SROMVector< Real >::pvec_.
|
inlinevirtual |
Reimplemented from ROL::Vector< Real >.
Definition at line 116 of file ROL_SROMVector.hpp.
References ROL::SROMVector< Real >::avec_, and ROL::SROMVector< Real >::pvec_.
|
inline |
Definition at line 125 of file ROL_SROMVector.hpp.
References ROL::SROMVector< Real >::avec_.
Referenced by ROL::SROMVector< Real >::applyBinary(), ROL::SROMVector< Real >::axpy(), ROL::SROMVector< Real >::dot(), ROL::MomentObjective< Real >::gradient(), ROL::CDFObjective< Real >::gradient(), ROL::MomentObjective< Real >::hessVec(), ROL::CDFObjective< Real >::hessVec(), ROL::SROMVector< Real >::plus(), ROL::SROMVector< Real >::set(), ROL::MomentObjective< Real >::value(), and ROL::CDFObjective< Real >::value().
|
inline |
Definition at line 129 of file ROL_SROMVector.hpp.
References ROL::SROMVector< Real >::pvec_.
Referenced by ROL::SROMVector< Real >::applyBinary(), ROL::SROMVector< Real >::axpy(), ROL::SROMVector< Real >::dot(), ROL::MomentObjective< Real >::gradient(), ROL::CDFObjective< Real >::gradient(), ROL::MomentObjective< Real >::hessVec(), ROL::CDFObjective< Real >::hessVec(), ROL::SROMVector< Real >::plus(), ROL::SROMVector< Real >::set(), ROL::MomentObjective< Real >::value(), and ROL::CDFObjective< Real >::value().
|
inline |
Definition at line 133 of file ROL_SROMVector.hpp.
References ROL::SROMVector< Real >::avec_.
|
inline |
Definition at line 137 of file ROL_SROMVector.hpp.
References ROL::SROMVector< Real >::pvec_.
|
inline |
Definition at line 141 of file ROL_SROMVector.hpp.
References ROL::SROMVector< Real >::avec_.
|
inline |
Definition at line 145 of file ROL_SROMVector.hpp.
References ROL::SROMVector< Real >::pvec_.
|
private |
Definition at line 30 of file ROL_SROMVector.hpp.
Referenced by ROL::SROMVector< Real >::applyBinary(), ROL::SROMVector< Real >::applyUnary(), ROL::SROMVector< Real >::axpy(), ROL::SROMVector< Real >::clone(), ROL::SROMVector< Real >::dimension(), ROL::SROMVector< Real >::dot(), ROL::SROMVector< Real >::dual(), ROL::SROMVector< Real >::getProbabilityVector(), ROL::SROMVector< Real >::plus(), ROL::SROMVector< Real >::reduce(), ROL::SROMVector< Real >::scale(), ROL::SROMVector< Real >::set(), ROL::SROMVector< Real >::setProbabilityVector(), and ROL::SROMVector< Real >::SROMVector().
|
private |
Definition at line 31 of file ROL_SROMVector.hpp.
Referenced by ROL::SROMVector< Real >::applyBinary(), ROL::SROMVector< Real >::applyUnary(), ROL::SROMVector< Real >::axpy(), ROL::SROMVector< Real >::clone(), ROL::SROMVector< Real >::dimension(), ROL::SROMVector< Real >::dot(), ROL::SROMVector< Real >::dual(), ROL::SROMVector< Real >::getAtomVector(), ROL::SROMVector< Real >::plus(), ROL::SROMVector< Real >::reduce(), ROL::SROMVector< Real >::scale(), ROL::SROMVector< Real >::set(), ROL::SROMVector< Real >::setAtomVector(), and ROL::SROMVector< Real >::SROMVector().
|
mutableprivate |
Definition at line 33 of file ROL_SROMVector.hpp.
Referenced by ROL::SROMVector< Real >::dual(), and ROL::SROMVector< Real >::SROMVector().
|
mutableprivate |
Definition at line 34 of file ROL_SROMVector.hpp.
Referenced by ROL::SROMVector< Real >::dual(), and ROL::SROMVector< Real >::SROMVector().
|
mutableprivate |
Definition at line 35 of file ROL_SROMVector.hpp.
Referenced by ROL::SROMVector< Real >::dual().
|
mutableprivate |
Definition at line 36 of file ROL_SROMVector.hpp.
Referenced by ROL::SROMVector< Real >::dual().