ROL
|
Provides the C array implementation of the ROL::Vector interface for use with NumPy->C Array passing by pointer. This class in intended to be used with the Python ROL interface. More...
#include <ROL_CArrayVector.hpp>
Public Member Functions | |
CArrayVector (Element *array, unsigned int dim) | |
CArrayVector (const Teuchos::ArrayRCP< Element > array) | |
CArrayVector (unsigned int dim) | |
Teuchos::ArrayRCP< Element > | getVector () const |
Teuchos::ArrayRCP< Element > | getVector () |
void | plus (const Vector< Real > &x) |
Compute \(y \leftarrow y + x\), 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... | |
void | scale (const Real alpha) |
Compute \(y \leftarrow \alpha y\) where \(y = \mathtt{*this}\). More... | |
int | dimension () const |
Return dimension of the vector space. More... | |
Teuchos::RCP< Vector< Real > > | clone () const |
Clone to make a new (uninitialized) vector. More... | |
Teuchos::RCP< Vector< Real > > | basis (const int i) const |
Return i-th basis vector. More... | |
![]() | |
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 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. 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 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 Attributes | |
unsigned int | dim_ |
Teuchos::ArrayRCP< Element > | array_ |
Provides the C array implementation of the ROL::Vector interface for use with NumPy->C Array passing by pointer. This class in intended to be used with the Python ROL interface.
See https://github.com/cython/cython/wiki/tutorials-NumpyPointerToC
Definition at line 56 of file ROL_CArrayVector.hpp.
|
inline |
Definition at line 63 of file ROL_CArrayVector.hpp.
Referenced by ROL::CArrayVector< Real, Element >::basis(), and ROL::CArrayVector< Real, Element >::clone().
|
inline |
Definition at line 67 of file ROL_CArrayVector.hpp.
|
inline |
Definition at line 71 of file ROL_CArrayVector.hpp.
|
inline |
Definition at line 74 of file ROL_CArrayVector.hpp.
References ROL::CArrayVector< Real, Element >::array_.
Referenced by ROL::CArrayVector< Real, Element >::dot(), main(), and ROL::CArrayVector< Real, Element >::plus().
|
inline |
Definition at line 78 of file ROL_CArrayVector.hpp.
References ROL::CArrayVector< Real, Element >::array_.
|
inlinevirtual |
Compute \(y \leftarrow y + x\), where \(y = \mathtt{*this}\).
[in] | x | is the vector to be added to \(\mathtt{*this}\). |
On return \(\mathtt{*this} = \mathtt{*this} + x\).
Implements ROL::Vector< Real >.
Definition at line 82 of file ROL_CArrayVector.hpp.
References ROL::CArrayVector< Real, Element >::array_, ROL::CArrayVector< Real, Element >::dim_, and ROL::CArrayVector< Real, Element >::getVector().
|
inlinevirtual |
Compute \( \langle y,x \rangle \) where \(y = \mathtt{*this}\).
[in] | x | is the vector that forms the dot product with \(\mathtt{*this}\). |
Implements ROL::Vector< Real >.
Definition at line 92 of file ROL_CArrayVector.hpp.
References ROL::CArrayVector< Real, Element >::array_, ROL::CArrayVector< Real, Element >::dim_, and ROL::CArrayVector< Real, Element >::getVector().
Referenced by ROL::CArrayVector< Real, Element >::norm().
|
inlinevirtual |
Returns \( \| y \| \) where \(y = \mathtt{*this}\).
Implements ROL::Vector< Real >.
Definition at line 103 of file ROL_CArrayVector.hpp.
References ROL::CArrayVector< Real, Element >::dot().
|
inlinevirtual |
Compute \(y \leftarrow \alpha y\) where \(y = \mathtt{*this}\).
[in] | alpha | is the scaling of \(\mathtt{*this}\). |
On return \(\mathtt{*this} = \alpha (\mathtt{*this}) \).
Implements ROL::Vector< Real >.
Definition at line 109 of file ROL_CArrayVector.hpp.
References ROL::CArrayVector< Real, Element >::array_, and ROL::CArrayVector< Real, Element >::dim_.
Referenced by main().
|
inlinevirtual |
Return dimension of the vector space.
Overload if the basis is overloaded.
Reimplemented from ROL::Vector< Real >.
Definition at line 115 of file ROL_CArrayVector.hpp.
References ROL::CArrayVector< Real, Element >::dim_.
|
inlinevirtual |
Clone to make a new (uninitialized) vector.
Provides the means of allocating temporary memory in ROL.
Implements ROL::Vector< Real >.
Definition at line 119 of file ROL_CArrayVector.hpp.
References ROL::CArrayVector< Real, Element >::CArrayVector().
Referenced by main().
|
inlinevirtual |
Return i-th basis vector.
[in] | i | is the index of the basis function. |
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 123 of file ROL_CArrayVector.hpp.
References ROL::CArrayVector< Real, Element >::CArrayVector().
Referenced by main().
|
private |
Definition at line 59 of file ROL_CArrayVector.hpp.
Referenced by ROL::CArrayVector< Real, Element >::dimension(), ROL::CArrayVector< Real, Element >::dot(), ROL::CArrayVector< Real, Element >::plus(), and ROL::CArrayVector< Real, Element >::scale().
|
private |
Definition at line 60 of file ROL_CArrayVector.hpp.
Referenced by ROL::CArrayVector< Real, Element >::dot(), ROL::CArrayVector< Real, Element >::getVector(), ROL::CArrayVector< Real, Element >::plus(), and ROL::CArrayVector< Real, Element >::scale().