ROL
ROL::RiskVector< Real > Class Template Reference

#include <ROL_RiskVector.hpp>

Inheritance diagram for ROL::RiskVector< Real >:

Public Member Functions

 RiskVector (Ptr< ParameterList > &parlist, const Ptr< Vector< Real > > &vec, const Real stat=0)
 RiskVector (std::vector< Ptr< ParameterList > > &parlist, const Ptr< Vector< Real > > &vec, const Real stat=0)
 RiskVector (Ptr< ParameterList > &parlistObj, std::vector< Ptr< ParameterList > > &parlistCon, const Ptr< Vector< Real > > &vec, const Real stat=0)
 RiskVector (const Ptr< Vector< Real > > &vec, const Ptr< std::vector< Real > > &statObj, const std::vector< Ptr< std::vector< Real > > > &statCon)
 RiskVector (const Ptr< Vector< Real > > &vec)
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 (void) const
 Returns \( \| y \| \) where \(y = \mathtt{*this}\).
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.
Ptr< Vector< Real > > basis (const int i) const
 Return i-th basis vector.
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
void setScalar (const Real C)
 Set \(y \leftarrow C\) where \(C\in\mathbb{R}\).
void randomize (const Real l=0.0, const Real u=1.0)
 Set vector to be uniform random between [l,u].
int dimension (void) const
 Return dimension of the vector space.
Ptr< const StdVector< Real > > getStatisticVector (const int comp, const int index=0) const
Ptr< StdVector< Real > > getStatisticVector (const int comp, const int index=0)
Ptr< const Vector< Real > > getVector (void) const
Ptr< Vector< Real > > getVector (void)
Ptr< std::vector< Real > > getStatistic (const int comp=0, const int index=0)
Ptr< const std::vector< Real > > getStatistic (const int comp=0, const int index=0) const
void setStatistic (const Real stat, const int comp=0, const int index=0)
void setStatistic (const std::vector< Real > &stat, const int comp=0, const int index=0)
void setVector (const Vector< 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 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 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 Member Functions

void initializeObj (Ptr< ParameterList > &parlist, const Real stat=1)
void initializeCon (std::vector< Ptr< ParameterList > > &parlist, const Real stat=1)

Private Attributes

Ptr< std::vector< Real > > statObj_
Ptr< StdVector< Real > > statObj_vec_
bool augmentedObj_
int nStatObj_
std::vector< Ptr< std::vector< Real > > > statCon_
std::vector< Ptr< StdVector< Real > > > statCon_vec_
bool augmentedCon_
std::vector< int > nStatCon_
Ptr< Vector< Real > > vec_
bool isDualInitialized_
Ptr< std::vector< Real > > dualObj_
std::vector< Ptr< std::vector< Real > > > dualCon_
Ptr< Vector< Real > > dual_vec1_
Ptr< RiskVector< Real > > dual_vec_

Detailed Description

template<class Real>
class ROL::RiskVector< Real >

Definition at line 20 of file ROL_RiskVector.hpp.

Constructor & Destructor Documentation

◆ RiskVector() [1/5]

template<class Real>
ROL::RiskVector< Real >::RiskVector ( Ptr< ParameterList > & parlist,
const Ptr< Vector< Real > > & vec,
const Real stat = 0 )
inline

◆ RiskVector() [2/5]

template<class Real>
ROL::RiskVector< Real >::RiskVector ( std::vector< Ptr< ParameterList > > & parlist,
const Ptr< Vector< Real > > & vec,
const Real stat = 0 )
inline

◆ RiskVector() [3/5]

template<class Real>
ROL::RiskVector< Real >::RiskVector ( Ptr< ParameterList > & parlistObj,
std::vector< Ptr< ParameterList > > & parlistCon,
const Ptr< Vector< Real > > & vec,
const Real stat = 0 )
inline

◆ RiskVector() [4/5]

template<class Real>
ROL::RiskVector< Real >::RiskVector ( const Ptr< Vector< Real > > & vec,
const Ptr< std::vector< Real > > & statObj,
const std::vector< Ptr< std::vector< Real > > > & statCon )
inline

◆ RiskVector() [5/5]

template<class Real>
ROL::RiskVector< Real >::RiskVector ( const Ptr< Vector< Real > > & vec)
inline

Member Function Documentation

◆ initializeObj()

template<class Real>
void ROL::RiskVector< Real >::initializeObj ( Ptr< ParameterList > & parlist,
const Real stat = 1 )
inlineprivate

Definition at line 40 of file ROL_RiskVector.hpp.

References augmentedObj_, nStatObj_, ROL::RandVarFunctionalInfo(), statObj_, and statObj_vec_.

Referenced by RiskVector(), and RiskVector().

◆ initializeCon()

template<class Real>
void ROL::RiskVector< Real >::initializeCon ( std::vector< Ptr< ParameterList > > & parlist,
const Real stat = 1 )
inlineprivate

Definition at line 61 of file ROL_RiskVector.hpp.

References augmentedCon_, nStatCon_, ROL::RandVarFunctionalInfo(), statCon_, and statCon_vec_.

Referenced by RiskVector(), and RiskVector().

◆ set()

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

◆ plus()

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

◆ scale()

template<class Real>
void ROL::RiskVector< 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 193 of file ROL_RiskVector.hpp.

References augmentedCon_, augmentedObj_, statCon_vec_, statObj_vec_, and vec_.

◆ axpy()

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

◆ dot()

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

◆ norm()

template<class Real>
Real ROL::RiskVector< Real >::norm ( void ) 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 241 of file ROL_RiskVector.hpp.

References dot().

◆ clone()

template<class Real>
Ptr< Vector< Real > > ROL::RiskVector< 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 245 of file ROL_RiskVector.hpp.

References augmentedObj_, nStatCon_, nStatObj_, statCon_vec_, statObj_vec_, and vec_.

◆ dual()

template<class Real>
const Vector< Real > & ROL::RiskVector< 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 260 of file ROL_RiskVector.hpp.

References augmentedCon_, augmentedObj_, dual_vec1_, dual_vec_, dualCon_, dualObj_, isDualInitialized_, setStatistic(), statCon_, statObj_, statObj_vec_, and vec_.

◆ basis()

template<class Real>
Ptr< Vector< Real > > ROL::RiskVector< Real >::basis ( const int i) const
inlinevirtual

Return i-th basis vector.

  @param[in] i is the index of the basis function.
  @return A reference-counted pointer to the basis vector with index @b i.

  Overloading the basis is only required if the default gradient implementation
  is used, which computes a finite-difference approximation.

  ---

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

Definition at line 296 of file ROL_RiskVector.hpp.

References augmentedObj_, nStatCon_, nStatObj_, statCon_vec_, statObj_vec_, and vec_.

◆ applyUnary()

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

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

Definition at line 340 of file ROL_RiskVector.hpp.

References augmentedCon_, augmentedObj_, statCon_vec_, statObj_vec_, and vec_.

◆ applyBinary()

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

◆ reduce()

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

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

Definition at line 371 of file ROL_RiskVector.hpp.

References augmentedCon_, augmentedObj_, reduce(), statCon_vec_, statObj_vec_, and vec_.

Referenced by reduce().

◆ setScalar()

template<class Real>
void ROL::RiskVector< Real >::setScalar ( const Real C)
inlinevirtual

Set \(y \leftarrow C\) where \(C\in\mathbb{R}\).

  @param[in]      C     is a scalar.

  On return \f$\mathtt{*this} = C\f$.
  Uses #applyUnary methods for the computation.
  Please overload if a more efficient implementation is needed.

  ---

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

Definition at line 388 of file ROL_RiskVector.hpp.

References augmentedCon_, augmentedObj_, statCon_vec_, statObj_vec_, and vec_.

◆ randomize()

template<class Real>
void ROL::RiskVector< Real >::randomize ( const Real l = 0.0,
const Real u = 1.0 )
inlinevirtual

Set vector to be uniform random between [l,u].

  @param[in]      l     is a the lower bound.
  @param[in]      u     is a the upper bound.

  On return the components of \f$\mathtt{*this}\f$ are uniform
  random numbers on the interval \f$[l,u]\f$.
        The default implementation uses #applyUnary methods for the
        computation. Please overload if a more efficient implementation is
  needed.

  ---

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

Definition at line 403 of file ROL_RiskVector.hpp.

References augmentedCon_, augmentedObj_, statCon_vec_, statObj_vec_, and vec_.

◆ dimension()

template<class Real>
int ROL::RiskVector< 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 418 of file ROL_RiskVector.hpp.

References augmentedCon_, augmentedObj_, dim, statCon_vec_, statObj_vec_, and vec_.

◆ getStatisticVector() [1/2]

template<class Real>
Ptr< const StdVector< Real > > ROL::RiskVector< Real >::getStatisticVector ( const int comp,
const int index = 0 ) const
inline

Definition at line 438 of file ROL_RiskVector.hpp.

References statCon_vec_, and statObj_vec_.

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

◆ getStatisticVector() [2/2]

template<class Real>
Ptr< StdVector< Real > > ROL::RiskVector< Real >::getStatisticVector ( const int comp,
const int index = 0 )
inline

Definition at line 451 of file ROL_RiskVector.hpp.

References statCon_vec_, and statObj_vec_.

◆ getVector() [1/2]

◆ getVector() [2/2]

template<class Real>
Ptr< Vector< Real > > ROL::RiskVector< Real >::getVector ( void )
inline

Definition at line 467 of file ROL_RiskVector.hpp.

References vec_.

◆ getStatistic() [1/2]

◆ getStatistic() [2/2]

template<class Real>
Ptr< const std::vector< Real > > ROL::RiskVector< Real >::getStatistic ( const int comp = 0,
const int index = 0 ) const
inline

Definition at line 493 of file ROL_RiskVector.hpp.

References augmentedCon_, augmentedObj_, statCon_, and statObj_.

◆ setStatistic() [1/2]

template<class Real>
void ROL::RiskVector< Real >::setStatistic ( const Real stat,
const int comp = 0,
const int index = 0 )
inline

◆ setStatistic() [2/2]

template<class Real>
void ROL::RiskVector< Real >::setStatistic ( const std::vector< Real > & stat,
const int comp = 0,
const int index = 0 )
inline

Definition at line 526 of file ROL_RiskVector.hpp.

References augmentedCon_, augmentedObj_, nStatCon_, nStatObj_, statCon_, and statObj_.

◆ setVector()

template<class Real>
void ROL::RiskVector< Real >::setVector ( const Vector< Real > & vec)
inline

Definition at line 548 of file ROL_RiskVector.hpp.

References vec_.

Member Data Documentation

◆ statObj_

template<class Real>
Ptr<std::vector<Real> > ROL::RiskVector< Real >::statObj_
private

◆ statObj_vec_

◆ augmentedObj_

◆ nStatObj_

template<class Real>
int ROL::RiskVector< Real >::nStatObj_
private

◆ statCon_

template<class Real>
std::vector<Ptr<std::vector<Real> > > ROL::RiskVector< Real >::statCon_
private

◆ statCon_vec_

template<class Real>
std::vector<Ptr<StdVector<Real> > > ROL::RiskVector< Real >::statCon_vec_
private

◆ augmentedCon_

◆ nStatCon_

template<class Real>
std::vector<int> ROL::RiskVector< Real >::nStatCon_
private

Definition at line 30 of file ROL_RiskVector.hpp.

Referenced by basis(), clone(), initializeCon(), RiskVector(), setStatistic(), and setStatistic().

◆ vec_

◆ isDualInitialized_

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

Definition at line 34 of file ROL_RiskVector.hpp.

Referenced by dual(), RiskVector(), RiskVector(), RiskVector(), RiskVector(), and RiskVector().

◆ dualObj_

template<class Real>
Ptr<std::vector<Real> > ROL::RiskVector< Real >::dualObj_
mutableprivate

Definition at line 35 of file ROL_RiskVector.hpp.

Referenced by dual().

◆ dualCon_

template<class Real>
std::vector<Ptr<std::vector<Real> > > ROL::RiskVector< Real >::dualCon_
mutableprivate

Definition at line 36 of file ROL_RiskVector.hpp.

Referenced by dual().

◆ dual_vec1_

template<class Real>
Ptr<Vector<Real> > ROL::RiskVector< Real >::dual_vec1_
mutableprivate

Definition at line 37 of file ROL_RiskVector.hpp.

Referenced by dual().

◆ dual_vec_

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

Definition at line 38 of file ROL_RiskVector.hpp.

Referenced by dual().


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