ROL
ROL::SROMVector< Real > Class Template Reference

Provides the std::vector implementation of the ROL::Vector interface. More...

#include <ROL_SROMVector.hpp>

Inheritance diagram for ROL::SROMVector< Real >:

Public Member Functions

 SROMVector (const ROL::Ptr< ProbabilityVector< Real > > &pvec, const ROL::Ptr< AtomVector< Real > > &avec)
void set (const Vector< Real > &x)
void plus (const Vector< Real > &x)
void scale (const Real alpha)
 Compute \(y \leftarrow \alpha y\) where \(y = \mathtt{*this}\).
void axpy (const Real alpha, const Vector< Real > &x)
Real dot (const Vector< Real > &x) const
Real norm () const
 Returns \( \| y \| \) where \(y = \mathtt{*this}\).
ROL::Ptr< Vector< Real > > clone (void) const
 Clone to make a new (uninitialized) vector.
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.
int dimension (void) const
 Return dimension of the vector space.
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::ROL::Vector< Real >
virtual ~Vector ()
virtual void plus (const Vector &x)=0
 Compute \(y \leftarrow y + x\), where \(y = \mathtt{*this}\).
virtual Real dot (const Vector &x) const =0
 Compute \( \langle y,x \rangle \) where \(y = \mathtt{*this}\).
virtual void axpy (const Real alpha, const Vector &x)
 Compute \(y \leftarrow \alpha x + y\) where \(y = \mathtt{*this}\).
virtual void zero ()
 Set to zero vector.
virtual ROL::Ptr< Vectorbasis (const int i) const
 Return i-th basis vector.
virtual void set (const Vector &x)
 Set \(y \leftarrow x\) where \(y = \mathtt{*this}\).
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())}\).
virtual void applyBinary (const Elementwise::BinaryFunction< Real > &f, const Vector &x)
virtual void print (std::ostream &outStream) const
virtual void setScalar (const Real C)
 Set \(y \leftarrow C\) where \(C\in\mathbb{R}\).
virtual void randomize (const Real l=0.0, const Real u=1.0)
 Set vector to be uniform random between [l,u].
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.

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_

Detailed Description

template<class Real>
class ROL::SROMVector< Real >

Provides the std::vector implementation of the ROL::Vector interface.

Definition at line 27 of file ROL_SROMVector.hpp.

Member Typedef Documentation

◆ uint

template<class Real>
typedef std::vector<Real>::size_type ROL::SROMVector< Real >::uint
private

Definition at line 28 of file ROL_SROMVector.hpp.

Constructor & Destructor Documentation

◆ SROMVector()

template<class Real>
ROL::SROMVector< Real >::SROMVector ( const ROL::Ptr< ProbabilityVector< Real > > & pvec,
const ROL::Ptr< AtomVector< Real > > & avec )
inline

Definition at line 40 of file ROL_SROMVector.hpp.

References avec_, clone(), dual_avec_, dual_pvec_, isDualInitialized_, and pvec_.

Referenced by applyBinary(), axpy(), dot(), plus(), and set().

Member Function Documentation

◆ set()

template<class Real>
void ROL::SROMVector< Real >::set ( const Vector< Real > & x)
inline

Definition at line 47 of file ROL_SROMVector.hpp.

References avec_, getAtomVector(), getProbabilityVector(), pvec_, and SROMVector().

◆ plus()

template<class Real>
void ROL::SROMVector< Real >::plus ( const Vector< Real > & x)
inline

Definition at line 53 of file ROL_SROMVector.hpp.

References avec_, getAtomVector(), getProbabilityVector(), pvec_, and SROMVector().

◆ scale()

template<class Real>
void ROL::SROMVector< Real >::scale ( const Real alpha)
inlinevirtual

Compute \(y \leftarrow \alpha y\) where \(y = \mathtt{*this}\).

  @param[in]      alpha is the scaling of \f$\mathtt{*this}\f$.

  On return \f$\mathtt{*this} = \alpha (\mathtt{*this}) \f$.

  ---

Implements ROL::ROL::Vector< Real >.

Definition at line 59 of file ROL_SROMVector.hpp.

References avec_, and pvec_.

◆ axpy()

template<class Real>
void ROL::SROMVector< Real >::axpy ( const Real alpha,
const Vector< Real > & x )
inline

Definition at line 64 of file ROL_SROMVector.hpp.

References avec_, getAtomVector(), getProbabilityVector(), pvec_, and SROMVector().

◆ dot()

template<class Real>
Real ROL::SROMVector< Real >::dot ( const Vector< Real > & x) const
inline

Definition at line 70 of file ROL_SROMVector.hpp.

References avec_, getAtomVector(), getProbabilityVector(), pvec_, and SROMVector().

Referenced by norm().

◆ norm()

template<class Real>
Real ROL::SROMVector< Real >::norm ( ) const
inlinevirtual

Returns \( \| y \| \) where \(y = \mathtt{*this}\).

  @return         A nonnegative number equal to the norm of \f$\mathtt{*this}\f$.

  ---

Implements ROL::ROL::Vector< Real >.

Definition at line 77 of file ROL_SROMVector.hpp.

References dot().

◆ clone()

template<class Real>
ROL::Ptr< Vector< Real > > ROL::SROMVector< Real >::clone ( void ) const
inlinevirtual

Clone to make a new (uninitialized) vector.

  @return         A reference-counted pointer to the cloned vector.

  Provides the means of allocating temporary memory in ROL.

  ---             

Implements ROL::ROL::Vector< Real >.

Definition at line 83 of file ROL_SROMVector.hpp.

References avec_, and pvec_.

Referenced by SROMVector().

◆ dual()

template<class Real>
const Vector< Real > & ROL::SROMVector< Real >::dual ( void ) const
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.

Returns
A const reference to dual representation.

By default, returns the current object. Please overload if you need a dual representation.


Reimplemented from ROL::ROL::Vector< Real >.

Definition at line 89 of file ROL_SROMVector.hpp.

References avec_, dual_avec_, dual_pvec_, dual_vec_, isDualInitialized_, and pvec_.

◆ dimension()

template<class Real>
int ROL::SROMVector< Real >::dimension ( void ) const
inlinevirtual

Return dimension of the vector space.

  @return The dimension of the vector space, i.e., the total number of basis vectors.

  Overload if the basis is overloaded.

  ---

Reimplemented from ROL::ROL::Vector< Real >.

Definition at line 101 of file ROL_SROMVector.hpp.

References avec_, and pvec_.

◆ applyUnary()

template<class Real>
void ROL::SROMVector< Real >::applyUnary ( const Elementwise::UnaryFunction< Real > & f)
inlinevirtual

Reimplemented from ROL::ROL::Vector< Real >.

Definition at line 105 of file ROL_SROMVector.hpp.

References avec_, and pvec_.

◆ applyBinary()

template<class Real>
void ROL::SROMVector< Real >::applyBinary ( const Elementwise::BinaryFunction< Real > & f,
const Vector< Real > & x )
inline

Definition at line 110 of file ROL_SROMVector.hpp.

References avec_, getAtomVector(), getProbabilityVector(), pvec_, and SROMVector().

◆ reduce()

template<class Real>
Real ROL::SROMVector< Real >::reduce ( const Elementwise::ReductionOp< Real > & r) const
inlinevirtual

Reimplemented from ROL::ROL::Vector< Real >.

Definition at line 116 of file ROL_SROMVector.hpp.

References avec_, and pvec_.

◆ getAtomVector() [1/2]

◆ getProbabilityVector() [1/2]

◆ getAtomVector() [2/2]

template<class Real>
ROL::Ptr< AtomVector< Real > > ROL::SROMVector< Real >::getAtomVector ( void )
inline

Definition at line 133 of file ROL_SROMVector.hpp.

References avec_.

◆ getProbabilityVector() [2/2]

template<class Real>
ROL::Ptr< ProbabilityVector< Real > > ROL::SROMVector< Real >::getProbabilityVector ( void )
inline

Definition at line 137 of file ROL_SROMVector.hpp.

References pvec_.

◆ setAtomVector()

template<class Real>
void ROL::SROMVector< Real >::setAtomVector ( const AtomVector< Real > & vec)
inline

Definition at line 141 of file ROL_SROMVector.hpp.

References avec_.

◆ setProbabilityVector()

template<class Real>
void ROL::SROMVector< Real >::setProbabilityVector ( const ProbabilityVector< Real > & vec)
inline

Definition at line 145 of file ROL_SROMVector.hpp.

References pvec_.

Member Data Documentation

◆ pvec_

template<class Real>
const ROL::Ptr<ProbabilityVector<Real> > ROL::SROMVector< Real >::pvec_
private

◆ avec_

template<class Real>
const ROL::Ptr<AtomVector<Real> > ROL::SROMVector< Real >::avec_
private

◆ dual_pvec_

template<class Real>
ROL::Ptr<Vector<Real> > ROL::SROMVector< Real >::dual_pvec_
mutableprivate

Definition at line 33 of file ROL_SROMVector.hpp.

Referenced by dual(), and SROMVector().

◆ dual_avec_

template<class Real>
ROL::Ptr<Vector<Real> > ROL::SROMVector< Real >::dual_avec_
mutableprivate

Definition at line 34 of file ROL_SROMVector.hpp.

Referenced by dual(), and SROMVector().

◆ dual_vec_

template<class Real>
ROL::Ptr<SROMVector<Real> > ROL::SROMVector< Real >::dual_vec_
mutableprivate

Definition at line 35 of file ROL_SROMVector.hpp.

Referenced by dual().

◆ isDualInitialized_

template<class Real>
bool ROL::SROMVector< Real >::isDualInitialized_
mutableprivate

Definition at line 36 of file ROL_SROMVector.hpp.

Referenced by dual(), and SROMVector().


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