SG++-Doxygen-Documentation
|
One component of a vector-valued function. More...
#include <ComponentScalarFunction.hpp>
Public Member Functions | |
void | clone (std::unique_ptr< ScalarFunction > &clone) const override |
ComponentScalarFunction (ScalarFunction &f, std::vector< double > defaultValues=std::vector< double >()) | |
Constructor. More... | |
ComponentScalarFunction (VectorFunction &f, size_t k, std::vector< double > defaultValues=std::vector< double >()) | |
Constructor. More... | |
double | eval (const base::DataVector &x) override |
~ComponentScalarFunction () override | |
Destructor. More... | |
Public Member Functions inherited from sgpp::optimization::ScalarFunction | |
size_t | getNumberOfParameters () const |
ScalarFunction (size_t d) | |
Constructor. More... | |
virtual | ~ScalarFunction () |
Destructor. More... | |
Protected Member Functions | |
void | initialize () |
Protected Attributes | |
std::vector< double > | defaultValues |
vector of default values, indicating free variables with NAN More... | |
size_t | dF |
dimension of underlying function More... | |
ScalarFunction * | fScalar |
scalar-valued function More... | |
VectorFunction * | fVector |
vector-valued function More... | |
size_t | k |
index of component More... | |
base::DataVector | tmpVec1 |
temporary vector 1 More... | |
base::DataVector | tmpVec2 |
temporary vector 2 More... | |
Protected Attributes inherited from sgpp::optimization::ScalarFunction | |
size_t | d |
dimension of the domain More... | |
One component of a vector-valued function.
Given a vector-valued \(f\colon [0, 1]^d \to \mathbb{R}^m\) and indices \(1 \le i_1 < \dotsb < i_n \le d\), this class represents a new function \(g\colon [0, 1]^n \to \mathbb{R}\) with \(g(y_{i_1}, \dotsc, y_{i_n}) := f_k(y_1, \dotsc, y_d)\), where \(y_t\) is constant for \(t \in \{i_1, \dotsc, i_n\}\).
The resulting function \(g\) is similar to a "slice plot" of the component \(f_k\) of \(f\).
|
inline |
Constructor.
Use it like this: ComponentScalarFunction g(f, {NAN, NAN, 0.42}); where f is a scalar-valued function with 3 parameters. This selects the first two parameters of f, while constantly using 0.42 for the third parameter.
f | scalar-valued function |
defaultValues | Vector of constant default values. It can be either empty (the default) or a vector of exactly m doubles, each of which can be finite or NAN. If the vector is empty, it will be initialized as m NANs (i.e., no restriction of the parameter domain). Each NAN represents a free parameter \(x_t\), while the finite entries denote the constant values for the corresponding parameter. |
References initialize().
Referenced by clone().
|
inline |
Constructor.
Use it like this: ComponentScalarFunction g(f, 3, {NAN, NAN, 0.42}); where f is a vector-valued function with 5 components and 3 parameters. This selects the first two parameters and the fourth component of f, while constantly using 0.42 for the third parameter.
f | vector-valued function (m components) |
k | index of component \(f_k\) to select (between 0 and m - 1) |
defaultValues | see other constructor |
References initialize().
|
inlineoverride |
Destructor.
|
inlineoverridevirtual |
[out] | clone | pointer to cloned object |
Implements sgpp::optimization::ScalarFunction.
References ComponentScalarFunction().
|
inlineoverridevirtual |
x | evaluation point \(\vec{x} \in [0, 1]^n\) |
Implements sgpp::optimization::ScalarFunction.
References defaultValues, dF, sgpp::optimization::ScalarFunction::eval(), sgpp::optimization::VectorFunction::eval(), fScalar, fVector, k, tmpVec1, and tmpVec2.
|
inlineprotected |
References dF.
Referenced by ComponentScalarFunction().
|
protected |
vector of default values, indicating free variables with NAN
Referenced by eval().
|
protected |
dimension of underlying function
Referenced by eval(), and initialize().
|
protected |
scalar-valued function
Referenced by eval().
|
protected |
vector-valued function
Referenced by eval().
|
protected |
index of component
Referenced by eval().
|
protected |
temporary vector 1
Referenced by eval().
|
protected |
temporary vector 2
Referenced by eval().