ROL
Public Member Functions | Private Types | Private Attributes | List of all members
ROL::DualScaledStdVector< Real, Element > Class Template Reference

Provides the std::vector implementation of the ROL::Vector interface that handles scalings in the inner product. Also see ROL::PrimalScaledStdVector. More...

#include <ROL_ScaledStdVector.hpp>

+ Inheritance diagram for ROL::DualScaledStdVector< Real, Element >:

Public Member Functions

 DualScaledStdVector (const Ptr< std::vector< Element > > &std_vec, const Ptr< std::vector< Element > > &scaling_vec)
 
Real dot (const Vector< Real > &x) const
 Compute \( \langle y,x \rangle \) where \(y = \mathtt{*this}\).
 
Ptr< Vector< Real > > clone () const
 Clone to make a new (uninitialized) vector.
 
const Vector< Real > & dual () 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.
 
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())}\).
 
- Public Member Functions inherited from ROL::StdVector< Real, Element >
 StdVector (const Ptr< std::vector< Element > > &std_vec)
 
 StdVector (const int dim, const Element val=0.0)
 
 StdVector (std::initializer_list< Element > ilist)
 
Real & operator[] (int i)
 
const Real & operator[] (int i) const
 
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 axpy (const Real alpha, const Vector< Real > &x)
 Compute \(y \leftarrow \alpha x + y\) where \(y = \mathtt{*this}\).
 
void scale (const Real alpha)
 Compute \(y \leftarrow \alpha y\) where \(y = \mathtt{*this}\).
 
Real norm () const
 Returns \( \| y \| \) where \(y = \mathtt{*this}\).
 
Ptr< const std::vector< Element > > getVector () const
 
Ptr< std::vector< Element > > getVector ()
 
Ptr< Vector< Real > > basis (const int i) const
 Return i-th basis vector.
 
int dimension () 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
 
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].
 
virtual void print (std::ostream &outStream) const
 
- Public Member Functions inherited from ROL::Vector< Real >
virtual ~Vector ()
 
virtual void zero ()
 Set to zero vector.
 
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< Element >::size_type uint
 

Private Attributes

Ptr< std::vector< Element > > scaling_vec_
 
Ptr< PrimalScaledStdVector< Real > > primal_vec_
 
bool isDualInitialized_
 

Detailed Description

template<class Real, class Element>
class ROL::DualScaledStdVector< Real, Element >

Provides the std::vector implementation of the ROL::Vector interface that handles scalings in the inner product. Also see ROL::PrimalScaledStdVector.

Definition at line 136 of file ROL_ScaledStdVector.hpp.

Member Typedef Documentation

◆ uint

template<class Real , class Element >
typedef std::vector<Element>::size_type ROL::DualScaledStdVector< Real, Element >::uint
private

Definition at line 138 of file ROL_ScaledStdVector.hpp.

Constructor & Destructor Documentation

◆ DualScaledStdVector()

template<class Real , class Element >
ROL::DualScaledStdVector< Real, Element >::DualScaledStdVector ( const Ptr< std::vector< Element > > & std_vec,
const Ptr< std::vector< Element > > & scaling_vec )
inline

Definition at line 148 of file ROL_ScaledStdVector.hpp.

Member Function Documentation

◆ dot()

template<class Real , class Element >
Real ROL::DualScaledStdVector< Real, Element >::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$.

   ---

Reimplemented from ROL::StdVector< Real, Element >.

Definition at line 153 of file ROL_ScaledStdVector.hpp.

References ROL::StdVector< Real, Element >::dimension(), and ROL::StdVector< Real, Element >::getVector().

Referenced by main().

◆ clone()

template<class Real , class Element >
Ptr< Vector< Real > > ROL::DualScaledStdVector< Real, Element >::clone ( ) 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.

   ---             

Reimplemented from ROL::StdVector< Real, Element >.

Definition at line 165 of file ROL_ScaledStdVector.hpp.

References ROL::StdVector< Real, Element >::dimension(), ROL::StdVector< Real, Element >::getVector(), and ROL::DualScaledStdVector< Real, Element >::scaling_vec_.

Referenced by main().

◆ dual()

template<class Real , class Element >
const Vector< Real > & ROL::DualScaledStdVector< Real, Element >::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 171 of file ROL_ScaledStdVector.hpp.

References ROL::StdVector< Real, Element >::getVector(), ROL::DualScaledStdVector< Real, Element >::isDualInitialized_, ROL::DualScaledStdVector< Real, Element >::primal_vec_, and ROL::DualScaledStdVector< Real, Element >::scaling_vec_.

Referenced by main().

◆ apply()

template<class Real , class Element >
Real ROL::DualScaledStdVector< Real, Element >::apply ( const Vector< Real > & x) const
inlinevirtual

Apply \(\mathtt{*this}\) to a dual vector. This is equivalent to the call \(\mathtt{this->dot(x.dual())}\).

Parameters
[in]xis a vector
Returns
The number equal to \(\langle \mathtt{*this}, x \rangle\).

Reimplemented from ROL::Vector< Real >.

Definition at line 186 of file ROL_ScaledStdVector.hpp.

References ROL::StdVector< Real, Element >::dot().

Referenced by main().

Member Data Documentation

◆ scaling_vec_

template<class Real , class Element >
Ptr<std::vector<Element> > ROL::DualScaledStdVector< Real, Element >::scaling_vec_
private

◆ primal_vec_

template<class Real , class Element >
Ptr<PrimalScaledStdVector<Real> > ROL::DualScaledStdVector< Real, Element >::primal_vec_
mutableprivate

◆ isDualInitialized_

template<class Real , class Element >
bool ROL::DualScaledStdVector< Real, Element >::isDualInitialized_
mutableprivate

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