ROL
Public Member Functions | Private Types | Private Attributes | List of all members
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)
 Set \(y \leftarrow x\) where \(y = \mathtt{*this}\).
 
void plus (const Vector< Real > &x)
 Compute \(y \leftarrow y + x\), where \(y = \mathtt{*this}\).
 
void scale (const Real alpha)
 Compute \(y \leftarrow \alpha y\) where \(y = \mathtt{*this}\).
 
void axpy (const Real alpha, const Vector< Real > &x)
 Compute \(y \leftarrow \alpha x + y\) where \(y = \mathtt{*this}\).
 
Real dot (const Vector< Real > &x) const
 Compute \( \langle y,x \rangle \) where \(y = \mathtt{*this}\).
 
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::Vector< Real >
virtual ~Vector ()
 
virtual void plus (const Vector &x)=0
 Compute \(y \leftarrow y + x\), where \(y = \mathtt{*this}\).
 
virtual void scale (const Real alpha)=0
 Compute \(y \leftarrow \alpha y\) where \(y = \mathtt{*this}\).
 
virtual Real dot (const Vector &x) const =0
 Compute \( \langle y,x \rangle \) where \(y = \mathtt{*this}\).
 
virtual Real norm () const =0
 Returns \( \| y \| \) where \(y = \mathtt{*this}\).
 
virtual ROL::Ptr< Vectorclone () const =0
 Clone to make a new (uninitialized) vector.
 
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 int dimension () const
 Return dimension of the vector space.
 
virtual void set (const Vector &x)
 Set \(y \leftarrow x\) where \(y = \mathtt{*this}\).
 
virtual const Vectordual () 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.
 
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 applyUnary (const Elementwise::UnaryFunction< Real > &f)
 
virtual void applyBinary (const Elementwise::BinaryFunction< Real > &f, const Vector &x)
 
virtual Real reduce (const Elementwise::ReductionOp< Real > &r) const
 
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 61 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 62 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

Member Function Documentation

◆ set()

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

Set \(y \leftarrow x\) where \(y = \mathtt{*this}\).

   @param[in]      x     is a vector.

   On return \f$\mathtt{*this} = x\f$.
   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 81 of file ROL_SROMVector.hpp.

References ROL::SROMVector< Real >::avec_, ROL::SROMVector< Real >::getAtomVector(), ROL::SROMVector< Real >::getProbabilityVector(), and ROL::SROMVector< Real >::pvec_.

◆ plus()

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

Compute \(y \leftarrow y + x\), where \(y = \mathtt{*this}\).

   @param[in]      x  is the vector to be added to \f$\mathtt{*this}\f$.

   On return \f$\mathtt{*this} = \mathtt{*this} + x\f$.

   ---

Implements ROL::Vector< Real >.

Definition at line 87 of file ROL_SROMVector.hpp.

References ROL::SROMVector< Real >::avec_, ROL::SROMVector< Real >::getAtomVector(), ROL::SROMVector< Real >::getProbabilityVector(), and ROL::SROMVector< Real >::pvec_.

◆ 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::Vector< Real >.

Definition at line 93 of file ROL_SROMVector.hpp.

References ROL::SROMVector< Real >::avec_, and ROL::SROMVector< Real >::pvec_.

◆ axpy()

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

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

   @param[in]      alpha is the scaling of @b x.
   @param[in]      x     is a vector.

   On return \f$\mathtt{*this} = \mathtt{*this} + \alpha x \f$.
   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 98 of file ROL_SROMVector.hpp.

References ROL::SROMVector< Real >::avec_, ROL::SROMVector< Real >::getAtomVector(), ROL::SROMVector< Real >::getProbabilityVector(), and ROL::SROMVector< Real >::pvec_.

◆ dot()

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

Compute \( \langle y,x \rangle \) where \(y = \mathtt{*this}\).

   @param[in]      x  is the vector that forms the dot product with \f$\mathtt{*this}\f$.
   @return         The number equal to \f$\langle \mathtt{*this}, x \rangle\f$.

   ---

Implements ROL::Vector< Real >.

Definition at line 104 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().

◆ 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::Vector< Real >.

Definition at line 111 of file ROL_SROMVector.hpp.

References ROL::SROMVector< Real >::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::Vector< Real >.

Definition at line 117 of file ROL_SROMVector.hpp.

References ROL::SROMVector< Real >::avec_, and ROL::SROMVector< Real >::pvec_.

Referenced by ROL::SROMVector< Real >::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::Vector< Real >.

Definition at line 123 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_.

◆ 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::Vector< Real >.

Definition at line 135 of file ROL_SROMVector.hpp.

References ROL::SROMVector< Real >::avec_, and ROL::SROMVector< Real >::pvec_.

◆ applyUnary()

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

Reimplemented from ROL::Vector< Real >.

Definition at line 139 of file ROL_SROMVector.hpp.

References ROL::SROMVector< Real >::avec_, and ROL::SROMVector< Real >::pvec_.

◆ applyBinary()

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

◆ reduce()

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

Reimplemented from ROL::Vector< Real >.

Definition at line 150 of file ROL_SROMVector.hpp.

References ROL::SROMVector< Real >::avec_, and ROL::SROMVector< Real >::pvec_.

◆ getAtomVector() [1/2]

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

◆ getProbabilityVector() [1/2]

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

◆ getAtomVector() [2/2]

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

Definition at line 167 of file ROL_SROMVector.hpp.

References ROL::SROMVector< Real >::avec_.

◆ getProbabilityVector() [2/2]

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

Definition at line 171 of file ROL_SROMVector.hpp.

References ROL::SROMVector< Real >::pvec_.

◆ setAtomVector()

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

Definition at line 175 of file ROL_SROMVector.hpp.

References ROL::SROMVector< Real >::avec_.

◆ setProbabilityVector()

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

Definition at line 179 of file ROL_SROMVector.hpp.

References ROL::SROMVector< Real >::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

◆ dual_avec_

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

◆ dual_vec_

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

Definition at line 69 of file ROL_SROMVector.hpp.

Referenced by ROL::SROMVector< Real >::dual().

◆ isDualInitialized_

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

Definition at line 70 of file ROL_SROMVector.hpp.

Referenced by ROL::SROMVector< Real >::dual().


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