ROL
Public Member Functions | List of all members
ROL::ElementwiseVector< Real > Class Template Referenceabstract

Intermediate abstract class which does not require users implements plus, set, scale, axpy, norm, dot, or zero if they implement the three elementwise functions: applyUnary, applyBinary, and reduce. More...

#include <ROL_ElementwiseVector.hpp>

+ Inheritance diagram for ROL::ElementwiseVector< Real >:

Public Member Functions

virtual ~ElementwiseVector ()
 
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...
 
virtual Real dot (const Vector< Real > &x) const
 Compute \( \langle y,x \rangle \) where \(y = \mathtt{*this}\). More...
 
virtual Real norm () const
 Returns \( \| 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...
 
void zero ()
 Set to zero vector. More...
 
void set (const Vector< Real > &x)
 Set \(y \leftarrow x\) where \(y = \mathtt{*this}\). More...
 
virtual void applyUnary (const Elementwise::UnaryFunction< Real > &uf)=0
 
virtual void applyBinary (const Elementwise::BinaryFunction< Real > &bf, const Vector< Real > &x)=0
 
virtual Real reduce (const Elementwise::ReductionOp< Real > &r) const =0
 
- Public Member Functions inherited from ROL::Vector< Real >
virtual ~Vector ()
 
virtual ROL::Ptr< Vectorclone () const =0
 Clone to make a new (uninitialized) vector. More...
 
virtual ROL::Ptr< Vectorbasis (const int i) const
 Return i-th basis vector. More...
 
virtual int dimension () const
 Return dimension of the vector space. More...
 
virtual const Vectordual () 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...
 
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...
 

Detailed Description

template<class Real>
class ROL::ElementwiseVector< Real >

Intermediate abstract class which does not require users implements plus, set, scale, axpy, norm, dot, or zero if they implement the three elementwise functions: applyUnary, applyBinary, and reduce.

dot and norm are unweighted dot products and Euclidean norm by default

Definition at line 64 of file ROL_ElementwiseVector.hpp.

Constructor & Destructor Documentation

template<class Real >
virtual ROL::ElementwiseVector< Real >::~ElementwiseVector ( )
inlinevirtual

Definition at line 68 of file ROL_ElementwiseVector.hpp.

Member Function Documentation

template<class Real >
void ROL::ElementwiseVector< 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 70 of file ROL_ElementwiseVector.hpp.

References ROL::ElementwiseVector< Real >::applyBinary().

template<class Real >
void ROL::ElementwiseVector< 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 74 of file ROL_ElementwiseVector.hpp.

References ROL::ElementwiseVector< Real >::applyUnary().

template<class Real >
virtual Real ROL::ElementwiseVector< 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 >.

Reimplemented in ROL::RieszDualVector< Real >, and ROL::RieszPrimalVector< Real >.

Definition at line 78 of file ROL_ElementwiseVector.hpp.

References ROL::Vector< Real >::clone().

Referenced by ROL::ElementwiseVector< Real >::norm().

template<class Real >
virtual Real ROL::ElementwiseVector< 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 85 of file ROL_ElementwiseVector.hpp.

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

template<class Real >
void ROL::ElementwiseVector< 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 89 of file ROL_ElementwiseVector.hpp.

References ROL::ElementwiseVector< Real >::applyBinary().

template<class Real >
void ROL::ElementwiseVector< Real >::zero ( )
inlinevirtual

Set to zero vector.

Uses scale by zero for the computation. Please overload if a more efficient implementation is needed.


Reimplemented from ROL::Vector< Real >.

Definition at line 93 of file ROL_ElementwiseVector.hpp.

References ROL::ElementwiseVector< Real >::applyUnary().

template<class Real >
void ROL::ElementwiseVector< 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 97 of file ROL_ElementwiseVector.hpp.

References ROL::ElementwiseVector< Real >::applyBinary().

template<class Real >
virtual void ROL::ElementwiseVector< Real >::applyUnary ( const Elementwise::UnaryFunction< Real > &  uf)
pure virtual
template<class Real >
virtual void ROL::ElementwiseVector< Real >::applyBinary ( const Elementwise::BinaryFunction< Real > &  bf,
const Vector< Real > &  x 
)
pure virtual
template<class Real >
virtual Real ROL::ElementwiseVector< Real >::reduce ( const Elementwise::ReductionOp< Real > &  r) const
pure virtual

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