SG++-Doxygen-Documentation
sgpp::optimization::ComponentScalarFunctionGradient Class Reference

One component of a vector-valued function gradient. More...

#include <ComponentScalarFunctionGradient.hpp>

Inheritance diagram for sgpp::optimization::ComponentScalarFunctionGradient:
sgpp::optimization::ScalarFunctionGradient

Public Member Functions

void clone (std::unique_ptr< ScalarFunctionGradient > &clone) const override
 
 ComponentScalarFunctionGradient (ScalarFunctionGradient &fGradient, std::vector< double > defaultValues=std::vector< double >())
 Constructor. More...
 
 ComponentScalarFunctionGradient (VectorFunctionGradient &fGradient, size_t k, std::vector< double > defaultValues=std::vector< double >())
 Constructor. More...
 
double eval (const base::DataVector &x, base::DataVector &gradient) override
 
 ~ComponentScalarFunctionGradient () override
 Destructor. More...
 
- Public Member Functions inherited from sgpp::optimization::ScalarFunctionGradient
size_t getNumberOfParameters () const
 
 ScalarFunctionGradient (size_t d)
 Constructor. More...
 
virtual ~ScalarFunctionGradient ()
 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...
 
ScalarFunctionGradientfGradientScalar
 scalar-valued function gradient More...
 
VectorFunctionGradientfGradientVector
 vector-valued function gradient More...
 
size_t k
 index of component More...
 
base::DataMatrix tmpMat
 temporary matrix More...
 
base::DataVector tmpVec1
 temporary vector 1 More...
 
base::DataVector tmpVec2
 temporary vector 2 More...
 
- Protected Attributes inherited from sgpp::optimization::ScalarFunctionGradient
size_t d
 dimension of the domain More...
 

Detailed Description

One component of a vector-valued function gradient.

See also
ComponentScalarFunction

Constructor & Destructor Documentation

◆ ComponentScalarFunctionGradient() [1/2]

sgpp::optimization::ComponentScalarFunctionGradient::ComponentScalarFunctionGradient ( ScalarFunctionGradient fGradient,
std::vector< double >  defaultValues = std::vector<double>() 
)
inline

Constructor.

Use it like this: ComponentScalarFunctionGradient gGradient(fGradient, {NAN, NAN, 0.42}); where fGradient is a scalar-valued function gradient with 3 parameters. This selects the first two parameters of fGradient, while constantly using 0.42 for the third parameter.

Parameters
fGradientscalar-valued function gradient
defaultValuesVector 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().

◆ ComponentScalarFunctionGradient() [2/2]

sgpp::optimization::ComponentScalarFunctionGradient::ComponentScalarFunctionGradient ( VectorFunctionGradient fGradient,
size_t  k,
std::vector< double >  defaultValues = std::vector<double>() 
)
inline

Constructor.

Use it like this: ComponentScalarFunctionGradient gGradient(fGradient, 3, {NAN, NAN, 0.42}); where fGradient is a vector-valued function gradient with 5 components and 3 parameters. This selects the first two parameters and the fourth component of fGradient, while constantly using 0.42 for the third parameter.

Parameters
fGradientvector-valued function gradient (m components)
kindex of component \(f_k\) to select (between 0 and m - 1)
defaultValuessee other constructor

References initialize().

◆ ~ComponentScalarFunctionGradient()

sgpp::optimization::ComponentScalarFunctionGradient::~ComponentScalarFunctionGradient ( )
inlineoverride

Destructor.

Member Function Documentation

◆ clone()

void sgpp::optimization::ComponentScalarFunctionGradient::clone ( std::unique_ptr< ScalarFunctionGradient > &  clone) const
inlineoverridevirtual
Parameters
[out]clonepointer to cloned object

Implements sgpp::optimization::ScalarFunctionGradient.

References ComponentScalarFunctionGradient().

◆ eval()

double sgpp::optimization::ComponentScalarFunctionGradient::eval ( const base::DataVector x,
base::DataVector gradient 
)
inlineoverridevirtual
Parameters
[in]xevaluation point \(\vec{x} \in [0, 1]^n\)
[out]gradient\(\nabla_{\vec{x}} g(\vec{x})\)
Returns
\(g(\vec{x}) := f_k(y_1, \dotsc, y_d)\) where \((x_1, \dotsc, x_n) = (y_{i_1}, \dotsc, y_{i_n})\)

Implements sgpp::optimization::ScalarFunctionGradient.

References defaultValues, dF, sgpp::optimization::ScalarFunctionGradient::eval(), sgpp::optimization::VectorFunctionGradient::eval(), fGradientScalar, fGradientVector, k, tmpMat, tmpVec1, and tmpVec2.

◆ initialize()

void sgpp::optimization::ComponentScalarFunctionGradient::initialize ( )
inlineprotected

References dF.

Referenced by ComponentScalarFunctionGradient().

Member Data Documentation

◆ defaultValues

std::vector<double> sgpp::optimization::ComponentScalarFunctionGradient::defaultValues
protected

vector of default values, indicating free variables with NAN

Referenced by eval().

◆ dF

size_t sgpp::optimization::ComponentScalarFunctionGradient::dF
protected

dimension of underlying function

Referenced by eval(), and initialize().

◆ fGradientScalar

ScalarFunctionGradient* sgpp::optimization::ComponentScalarFunctionGradient::fGradientScalar
protected

scalar-valued function gradient

Referenced by eval().

◆ fGradientVector

VectorFunctionGradient* sgpp::optimization::ComponentScalarFunctionGradient::fGradientVector
protected

vector-valued function gradient

Referenced by eval().

◆ k

size_t sgpp::optimization::ComponentScalarFunctionGradient::k
protected

index of component

Referenced by eval().

◆ tmpMat

base::DataMatrix sgpp::optimization::ComponentScalarFunctionGradient::tmpMat
protected

temporary matrix

Referenced by eval().

◆ tmpVec1

base::DataVector sgpp::optimization::ComponentScalarFunctionGradient::tmpVec1
protected

temporary vector 1

Referenced by eval().

◆ tmpVec2

base::DataVector sgpp::optimization::ComponentScalarFunctionGradient::tmpVec2
protected

temporary vector 2

Referenced by eval().


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