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}\). 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< Vectorbasis (const int i) const
 Return i-th basis vector. 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_
 

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

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

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

Member Function Documentation

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

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

Parameters
[in]xis 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 81 of file ROL_SROMVector.hpp.

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

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

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

Parameters
[in]xis the vector to be added to \(\mathtt{*this}\).

On return \(\mathtt{*this} = \mathtt{*this} + x\).


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_.

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

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

Parameters
[in]alphais the scaling of \(\mathtt{*this}\).

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


Implements ROL::Vector< Real >.

Definition at line 93 of file ROL_SROMVector.hpp.

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

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}\).

Parameters
[in]alphais the scaling of x.
[in]xis 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 98 of file ROL_SROMVector.hpp.

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

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

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

Parameters
[in]xis the vector that forms the dot product with \(\mathtt{*this}\).
Returns
The number equal to \(\langle \mathtt{*this}, x \rangle\).

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().

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

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

Returns
A nonnegative number equal to the norm of \(\mathtt{*this}\).

Implements ROL::Vector< Real >.

Definition at line 111 of file ROL_SROMVector.hpp.

References ROL::SROMVector< Real >::dot().

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

Clone to make a new (uninitialized) vector.

Returns
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().

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_.

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

Return dimension of the vector space.

Returns
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_.

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_.

template<class Real>
void ROL::SROMVector< Real >::applyBinary ( const Elementwise::BinaryFunction< Real > &  f,
const Vector< Real > &  x 
)
inlinevirtual
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_.

template<class Real>
const ROL::Ptr<const AtomVector<Real> > ROL::SROMVector< Real >::getAtomVector ( void  ) const
inline
template<class Real>
const ROL::Ptr<const ProbabilityVector<Real> > ROL::SROMVector< Real >::getProbabilityVector ( void  ) const
inline
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_.

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_.

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_.

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

template<class Real>
const ROL::Ptr<ProbabilityVector<Real> > ROL::SROMVector< Real >::pvec_
private
template<class Real>
const ROL::Ptr<AtomVector<Real> > ROL::SROMVector< Real >::avec_
private
template<class Real>
ROL::Ptr<Vector<Real> > ROL::SROMVector< Real >::dual_pvec_
mutableprivate
template<class Real>
ROL::Ptr<Vector<Real> > ROL::SROMVector< Real >::dual_avec_
mutableprivate
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().

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: