ROL
|
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>
Public Member Functions | |
virtual | ~ElementwiseVector () |
void | plus (const Vector< Real > &x) |
Compute \(y \leftarrow y + x\), where \(y = \mathtt{*this}\). | |
void | scale (const Real alpha) |
Compute \(y \leftarrow \alpha y\) where \(y = \mathtt{*this}\). | |
virtual Real | dot (const Vector< Real > &x) const |
Compute \( \langle y,x \rangle \) where \(y = \mathtt{*this}\). | |
virtual Real | norm () const |
Returns \( \| y \| \) where \(y = \mathtt{*this}\). | |
void | axpy (const Real alpha, const Vector< Real > &x) |
Compute \(y \leftarrow \alpha x + y\) where \(y = \mathtt{*this}\). | |
void | zero () |
Set to zero vector. | |
void | set (const Vector< Real > &x) |
Set \(y \leftarrow x\) where \(y = \mathtt{*this}\). | |
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 |
![]() | |
virtual | ~Vector () |
virtual void | plus (const Vector &x)=0 |
Compute \(y \leftarrow y + x\), where \(y = \mathtt{*this}\). | |
virtual void | scale (const Real alpha)=0 |
Compute \(y \leftarrow \alpha y\) where \(y = \mathtt{*this}\). | |
virtual Real | dot (const Vector &x) const =0 |
Compute \( \langle y,x \rangle \) where \(y = \mathtt{*this}\). | |
virtual Real | norm () const =0 |
Returns \( \| y \| \) where \(y = \mathtt{*this}\). | |
virtual ROL::Ptr< Vector > | clone () const =0 |
Clone to make a new (uninitialized) vector. | |
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 ROL::Ptr< Vector > | basis (const int i) const |
Return i-th basis vector. | |
virtual int | dimension () const |
Return dimension of the vector space. | |
virtual void | set (const Vector &x) |
Set \(y \leftarrow x\) where \(y = \mathtt{*this}\). | |
virtual const Vector & | 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. | |
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 | 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}\). | |
virtual void | randomize (const Real l=0.0, const Real u=1.0) |
Set vector to be uniform random between [l,u]. | |
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. | |
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.
|
inlinevirtual |
Definition at line 68 of file ROL_ElementwiseVector.hpp.
|
inlinevirtual |
Compute \(y \leftarrow y + x\), where \(y = \mathtt{*this}\).
@param[in] x is the vector to be added to \f$\mathtt{*this}\f$. On return \f$\mathtt{*this} = \mathtt{*this} + x\f$. ---
Implements ROL::Vector< Real >.
Definition at line 70 of file ROL_ElementwiseVector.hpp.
References ROL::ElementwiseVector< Real >::applyBinary().
|
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::Vector< Real >.
Definition at line 74 of file ROL_ElementwiseVector.hpp.
References ROL::ElementwiseVector< Real >::applyUnary().
|
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$. ---
Implements ROL::Vector< Real >.
Reimplemented in ROL::RieszPrimalVector< Real >, and ROL::RieszDualVector< Real >.
Definition at line 78 of file ROL_ElementwiseVector.hpp.
References ROL::Vector< Real >::clone().
Referenced by ROL::ElementwiseVector< Real >::norm().
|
inlinevirtual |
Returns \( \| y \| \) where \(y = \mathtt{*this}\).
@return A nonnegative number equal to the norm of \f$\mathtt{*this}\f$. ---
Implements ROL::Vector< Real >.
Definition at line 85 of file ROL_ElementwiseVector.hpp.
References ROL::ElementwiseVector< Real >::dot().
|
inlinevirtual |
Compute \(y \leftarrow \alpha x + y\) where \(y = \mathtt{*this}\).
@param[in] alpha is the scaling of @b x. @param[in] x is a vector. On return \f$\mathtt{*this} = \mathtt{*this} + \alpha x \f$. 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().
|
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().
|
inlinevirtual |
Set \(y \leftarrow x\) where \(y = \mathtt{*this}\).
@param[in] x is a vector. On return \f$\mathtt{*this} = x\f$. 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().
|
pure virtual |
Reimplemented from ROL::Vector< Real >.
Implemented in ROL::RieszPrimalVector< Real >, and ROL::RieszDualVector< Real >.
Referenced by ROL::ElementwiseVector< Real >::scale(), and ROL::ElementwiseVector< Real >::zero().
|
pure virtual |
Reimplemented from ROL::Vector< Real >.
Implemented in ROL::RieszPrimalVector< Real >, and ROL::RieszDualVector< Real >.
Referenced by ROL::ElementwiseVector< Real >::axpy(), ROL::ElementwiseVector< Real >::plus(), and ROL::ElementwiseVector< Real >::set().
|
pure virtual |
Reimplemented from ROL::Vector< Real >.
Implemented in ROL::RieszPrimalVector< Real >, and ROL::RieszDualVector< Real >.