ROL
Public Member Functions | Private Types | Private Attributes | List of all members
ROL::PrimalScaledStdVector< 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::DualScaledStdVector. More...

#include <ROL_ScaledStdVector.hpp>

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

Public Member Functions

 PrimalScaledStdVector (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}\). More...
 
Ptr< Vector< Real > > clone () const
 Clone to make a new (uninitialized) vector. More...
 
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. More...
 
- Public Member Functions inherited from ROL::StdVector< Real >
 StdVector (const Ptr< std::vector< Real >> &std_vec)
 
 StdVector (const int dim, const Realval=0.0)
 
 StdVector (std::initializer_list< Real > 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}\). More...
 
void plus (const Vector< Real > &x)
 Compute \(y \leftarrow y + x\), 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...
 
void scale (const Real alpha)
 Compute \(y \leftarrow \alpha y\) where \(y = \mathtt{*this}\). More...
 
Real norm () const
 Returns \( \| y \| \) where \(y = \mathtt{*this}\). More...
 
Ptr< const std::vector< Real > > getVector () const
 
Ptr< std::vector< Real > > getVector ()
 
Ptr< Vector< Real > > basis (const int i) const
 Return i-th basis vector. More...
 
int dimension () 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
 
void setScalar (const Real C)
 Set \(y \leftarrow C\) where \(C\in\mathbb{R}\). More...
 
void randomize (const Real l=0.0, const Real u=1.0)
 Set vector to be uniform random between [l,u]. More...
 
virtual void print (std::ostream &outStream) const
 
- Public Member Functions inherited from ROL::Vector< Real >
virtual ~Vector ()
 
virtual void zero ()
 Set to zero vector. 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< Element >
::size_type 
uint
 

Private Attributes

Ptr< std::vector< Element > > scaling_vec_
 
Ptr< DualScaledStdVector< Real > > dual_vec_
 
bool isDualInitialized_
 

Detailed Description

template<class Real, class Element = Real>
class ROL::PrimalScaledStdVector< Real, Element >

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

Definition at line 62 of file ROL_ScaledStdVector.hpp.

Member Typedef Documentation

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

Definition at line 70 of file ROL_ScaledStdVector.hpp.

Constructor & Destructor Documentation

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

Definition at line 80 of file ROL_ScaledStdVector.hpp.

Member Function Documentation

template<class Real, class Element = Real>
Real ROL::PrimalScaledStdVector< Real, Element >::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\).

Reimplemented from ROL::StdVector< Real >.

Definition at line 85 of file ROL_ScaledStdVector.hpp.

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

Referenced by main().

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


Reimplemented from ROL::StdVector< Real >.

Definition at line 97 of file ROL_ScaledStdVector.hpp.

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

Referenced by main().

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

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

Referenced by main().

Member Data Documentation

template<class Real, class Element = Real>
Ptr<std::vector<Element> > ROL::PrimalScaledStdVector< Real, Element >::scaling_vec_
private
template<class Real, class Element = Real>
Ptr<DualScaledStdVector<Real> > ROL::PrimalScaledStdVector< Real, Element >::dual_vec_
mutableprivate
template<class Real, class Element = Real>
bool ROL::PrimalScaledStdVector< Real, Element >::isDualInitialized_
mutableprivate

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