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

#include <example_02.hpp>

+ Inheritance diagram for OptDualStdVector< Real, Element >:

Public Member Functions

 OptDualStdVector (const ROL::Ptr< std::vector< Element > > &std_vec)
 
void plus (const ROL::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...
 
Real dot (const ROL::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< ROL::Vector< Real > > clone () const
 Clone to make a new (uninitialized) vector. More...
 
ROL::Ptr< const std::vector
< Element > > 
getVector () const
 
ROL::Ptr< std::vector< Element > > getVector ()
 
ROL::Ptr< ROL::Vector< Real > > basis (const int i) const
 Return i-th basis vector. More...
 
int dimension () const
 Return dimension of the vector space. More...
 
const ROL::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...
 
 OptDualStdVector (const ROL::Ptr< std::vector< Element > > &std_vec)
 
void plus (const ROL::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...
 
Real dot (const ROL::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< ROL::Vector< Real > > clone () const
 Clone to make a new (uninitialized) vector. More...
 
ROL::Ptr< const std::vector
< Element > > 
getVector () const
 
ROL::Ptr< std::vector< Element > > getVector ()
 
ROL::Ptr< ROL::Vector< Real > > basis (const int i) const
 Return i-th basis vector. More...
 
int dimension () const
 Return dimension of the vector space. More...
 
const ROL::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...
 
 OptDualStdVector (const ROL::Ptr< std::vector< Element > > &std_vec, ROL::Ptr< FiniteDifference< Real > >fd)
 
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...
 
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 () const
 Clone to make a new (uninitialized) vector. More...
 
ROL::Ptr< const std::vector
< Element > > 
getVector () const
 
ROL::Ptr< std::vector< Element > > getVector ()
 
ROL::Ptr< Vector< Real > > basis (const int i) const
 Return i-th basis vector. More...
 
int dimension () const
 Return dimension of the vector space. 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::Vector< Real >
virtual ~Vector ()
 
virtual void axpy (const Real alpha, const Vector &x)
 Compute \(y \leftarrow \alpha x + y\) where \(y = \mathtt{*this}\). More...
 
virtual void zero ()
 Set to zero vector. More...
 
virtual void set (const Vector &x)
 Set \(y \leftarrow x\) where \(y = \mathtt{*this}\). More...
 
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}\). 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< Element > vector
 
typedef ROL::Vector< Real > V
 
typedef vector::size_type uint
 
typedef std::vector< Element > vector
 
typedef ROL::Vector< Real > V
 
typedef vector::size_type uint
 
typedef std::vector< Element > vector
 
typedef vector::size_type uint
 

Private Attributes

ROL::Ptr< std::vector< Element > > std_vec_
 
ROL::Ptr< OptStdVector< Real > > dual_vec_
 
ROL::Ptr< FiniteDifference
< Real > > 
fd_
 

Detailed Description

template<class Real, class Element = Real>
class OptDualStdVector< Real, Element >

Definition at line 69 of file dual-spaces/rosenbrock-1/example_01.cpp.

Member Typedef Documentation

template<class Real, class Element = Real>
typedef std::vector<Element> OptDualStdVector< Real, Element >::vector
private

Definition at line 160 of file dual-spaces/rosenbrock-1/example_01.cpp.

template<class Real, class Element = Real>
typedef ROL::Vector<Real> OptDualStdVector< Real, Element >::V
private

Definition at line 161 of file dual-spaces/rosenbrock-1/example_01.cpp.

template<class Real, class Element = Real>
typedef vector::size_type OptDualStdVector< Real, Element >::uint
private

Definition at line 163 of file dual-spaces/rosenbrock-1/example_01.cpp.

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

Definition at line 211 of file gross-pitaevskii/example_02.hpp.

template<class Real, class Element = Real>
typedef vector::size_type OptDualStdVector< Real, Element >::uint
private

Definition at line 212 of file gross-pitaevskii/example_02.hpp.

Constructor & Destructor Documentation

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

Definition at line 171 of file dual-spaces/rosenbrock-1/example_01.cpp.

template<class Real, class Element = Real>
OptDualStdVector< Real, Element >::OptDualStdVector ( const ROL::Ptr< std::vector< Element > > &  std_vec)
inline
template<class Real, class Element = Real>
OptDualStdVector< Real, Element >::OptDualStdVector ( const ROL::Ptr< std::vector< Element > > &  std_vec,
ROL::Ptr< FiniteDifference< Real > >  fd 
)
inline

Definition at line 221 of file gross-pitaevskii/example_02.hpp.

Member Function Documentation

template<class Real, class Element = Real>
void OptDualStdVector< Real, Element >::plus ( const ROL::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 173 of file dual-spaces/rosenbrock-1/example_01.cpp.

References OptDualStdVector< Real, Element >::dimension(), OptDualStdVector< Real, Element >::getVector(), and OptDualStdVector< Real, Element >::std_vec_.

template<class Real, class Element = Real>
void OptDualStdVector< Real, Element >::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 183 of file dual-spaces/rosenbrock-1/example_01.cpp.

References OptDualStdVector< Real, Element >::dimension(), and OptDualStdVector< Real, Element >::std_vec_.

template<class Real, class Element = Real>
Real OptDualStdVector< Real, Element >::dot ( const ROL::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 190 of file dual-spaces/rosenbrock-1/example_01.cpp.

References OptDualStdVector< Real, Element >::dimension(), OptDualStdVector< Real, Element >::getVector(), and OptDualStdVector< Real, Element >::std_vec_.

Referenced by OptDualStdVector< Real, Element >::norm().

template<class Real, class Element = Real>
Real OptDualStdVector< Real, Element >::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 201 of file dual-spaces/rosenbrock-1/example_01.cpp.

References OptDualStdVector< Real, Element >::dot().

template<class Real, class Element = Real>
ROL::Ptr<ROL::Vector<Real> > OptDualStdVector< 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.


Implements ROL::Vector< Real >.

Definition at line 207 of file dual-spaces/rosenbrock-1/example_01.cpp.

References OptDualStdVector< Real, Element >::std_vec_.

template<class Real, class Element = Real>
ROL::Ptr<const std::vector<Element> > OptDualStdVector< Real, Element >::getVector ( void  ) const
inline
template<class Real, class Element = Real>
ROL::Ptr<std::vector<Element> > OptDualStdVector< Real, Element >::getVector ( void  )
inline
template<class Real, class Element = Real>
ROL::Ptr<ROL::Vector<Real> > OptDualStdVector< Real, Element >::basis ( const int  i) const
inlinevirtual

Return i-th basis vector.

Parameters
[in]iis the index of the basis function.
Returns
A reference-counted pointer to the basis vector with index i.

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


Reimplemented from ROL::Vector< Real >.

Definition at line 219 of file dual-spaces/rosenbrock-1/example_01.cpp.

References OptDualStdVector< Real, Element >::std_vec_.

template<class Real, class Element = Real>
int OptDualStdVector< Real, Element >::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 228 of file dual-spaces/rosenbrock-1/example_01.cpp.

References OptDualStdVector< Real, Element >::std_vec_.

Referenced by OptDualStdVector< Real, Element >::dot(), OptDualStdVector< Real, Element >::plus(), and OptDualStdVector< Real, Element >::scale().

template<class Real, class Element = Real>
const ROL::Vector<Real>& OptDualStdVector< 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 230 of file dual-spaces/rosenbrock-1/example_01.cpp.

References OptDualStdVector< Real, Element >::dual_vec_.

template<class Real, class Element = Real>
void OptDualStdVector< Real, Element >::plus ( const ROL::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 178 of file dual-spaces/simple-eq-constr-1/example_01.cpp.

References OptDualStdVector< Real, Element >::dimension(), OptDualStdVector< Real, Element >::getVector(), and OptDualStdVector< Real, Element >::std_vec_.

template<class Real, class Element = Real>
void OptDualStdVector< Real, Element >::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 187 of file dual-spaces/simple-eq-constr-1/example_01.cpp.

References OptDualStdVector< Real, Element >::dimension(), and OptDualStdVector< Real, Element >::std_vec_.

template<class Real, class Element = Real>
Real OptDualStdVector< Real, Element >::dot ( const ROL::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 194 of file dual-spaces/simple-eq-constr-1/example_01.cpp.

References OptDualStdVector< Real, Element >::dimension(), OptDualStdVector< Real, Element >::getVector(), and OptDualStdVector< Real, Element >::std_vec_.

template<class Real, class Element = Real>
Real OptDualStdVector< Real, Element >::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 205 of file dual-spaces/simple-eq-constr-1/example_01.cpp.

References OptDualStdVector< Real, Element >::dot().

template<class Real, class Element = Real>
ROL::Ptr<ROL::Vector<Real> > OptDualStdVector< 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.


Implements ROL::Vector< Real >.

Definition at line 211 of file dual-spaces/simple-eq-constr-1/example_01.cpp.

References OptDualStdVector< Real, Element >::std_vec_.

template<class Real, class Element = Real>
ROL::Ptr<const std::vector<Element> > OptDualStdVector< Real, Element >::getVector ( void  ) const
inline
template<class Real, class Element = Real>
ROL::Ptr<std::vector<Element> > OptDualStdVector< Real, Element >::getVector ( void  )
inline
template<class Real, class Element = Real>
ROL::Ptr<ROL::Vector<Real> > OptDualStdVector< Real, Element >::basis ( const int  i) const
inlinevirtual

Return i-th basis vector.

Parameters
[in]iis the index of the basis function.
Returns
A reference-counted pointer to the basis vector with index i.

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


Reimplemented from ROL::Vector< Real >.

Definition at line 223 of file dual-spaces/simple-eq-constr-1/example_01.cpp.

References OptDualStdVector< Real, Element >::std_vec_.

template<class Real, class Element = Real>
int OptDualStdVector< Real, Element >::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 231 of file dual-spaces/simple-eq-constr-1/example_01.cpp.

References OptDualStdVector< Real, Element >::std_vec_.

template<class Real, class Element = Real>
const ROL::Vector<Real>& OptDualStdVector< 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 233 of file dual-spaces/simple-eq-constr-1/example_01.cpp.

References OptDualStdVector< Real, Element >::dual_vec_.

template<class Real, class Element = Real>
void OptDualStdVector< Real, Element >::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 224 of file gross-pitaevskii/example_02.hpp.

References OptDualStdVector< Real, Element >::getVector().

template<class Real, class Element = Real>
void OptDualStdVector< Real, Element >::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 233 of file gross-pitaevskii/example_02.hpp.

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

Implements ROL::Vector< Real >.

Definition at line 240 of file gross-pitaevskii/example_02.hpp.

References OptDualStdVector< Real, Element >::getVector().

template<class Real, class Element = Real>
Real OptDualStdVector< Real, Element >::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 254 of file gross-pitaevskii/example_02.hpp.

template<class Real, class Element = Real>
ROL::Ptr<Vector<Real> > OptDualStdVector< 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.


Implements ROL::Vector< Real >.

Definition at line 260 of file gross-pitaevskii/example_02.hpp.

template<class Real, class Element = Real>
ROL::Ptr<const std::vector<Element> > OptDualStdVector< Real, Element >::getVector ( void  ) const
inline

Definition at line 264 of file gross-pitaevskii/example_02.hpp.

template<class Real, class Element = Real>
ROL::Ptr<std::vector<Element> > OptDualStdVector< Real, Element >::getVector ( void  )
inline

Definition at line 268 of file gross-pitaevskii/example_02.hpp.

template<class Real, class Element = Real>
ROL::Ptr<Vector<Real> > OptDualStdVector< Real, Element >::basis ( const int  i) const
inlinevirtual

Return i-th basis vector.

Parameters
[in]iis the index of the basis function.
Returns
A reference-counted pointer to the basis vector with index i.

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


Reimplemented from ROL::Vector< Real >.

Definition at line 272 of file gross-pitaevskii/example_02.hpp.

template<class Real, class Element = Real>
int OptDualStdVector< Real, Element >::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 279 of file gross-pitaevskii/example_02.hpp.

template<class Real, class Element = Real>
const Vector<Real>& OptDualStdVector< 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 281 of file gross-pitaevskii/example_02.hpp.

Member Data Documentation

template<class Real, class Element = Real>
ROL::Ptr< std::vector< Element > > OptDualStdVector< Real, Element >::std_vec_
private
template<class Real, class Element = Real>
ROL::Ptr< OptStdVector< Real > > OptDualStdVector< Real, Element >::dual_vec_
mutableprivate
template<class Real, class Element = Real>
ROL::Ptr<FiniteDifference<Real> > OptDualStdVector< Real, Element >::fd_
private

Definition at line 217 of file gross-pitaevskii/example_02.hpp.


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