mlpack  git-master
Function< FunctionType > Class Template Reference

The Function class is a wrapper class for any FunctionType that will add any possible derived methods. More...

Inheritance diagram for Function< FunctionType >:

Additional Inherited Members

- Public Member Functions inherited from AddDecomposableEvaluateWithGradientConst< FunctionType >
double EvaluateWithGradient (traits::UnconstructableType &, const size_t, const size_t) const
 
- Public Member Functions inherited from AddDecomposableEvaluateWithGradient< FunctionType >
double EvaluateWithGradient (traits::UnconstructableType &, const size_t, const size_t)
 
- Public Member Functions inherited from AddDecomposableGradientConst< FunctionType >
void Gradient (traits::UnconstructableType &, const size_t, const size_t) const
 
- Public Member Functions inherited from AddDecomposableGradient< FunctionType >
void Gradient (traits::UnconstructableType &, const size_t, const size_t)
 
- Public Member Functions inherited from AddDecomposableEvaluateStatic< FunctionType >
double Evaluate (traits::UnconstructableType &, const size_t) const
 
- Public Member Functions inherited from AddDecomposableEvaluateConst< FunctionType >
double Evaluate (traits::UnconstructableType &, const size_t, const size_t) const
 
- Public Member Functions inherited from AddDecomposableEvaluate< FunctionType >
double Evaluate (traits::UnconstructableType &, const size_t, const size_t)
 
double Evaluate (traits::UnconstructableType &, const size_t)
 
- Public Member Functions inherited from AddEvaluateWithGradientConst< FunctionType >
double EvaluateWithGradient (traits::UnconstructableType &) const
 
- Public Member Functions inherited from AddEvaluateWithGradient< FunctionType >
double EvaluateWithGradient (traits::UnconstructableType &)
 
- Public Member Functions inherited from AddGradientConst< FunctionType >
void Gradient (traits::UnconstructableType &) const
 
- Public Member Functions inherited from AddGradient< FunctionType >
void Gradient (traits::UnconstructableType &)
 
- Public Member Functions inherited from AddEvaluateConst< FunctionType >
double Evaluate (traits::UnconstructableType &) const
 
- Public Member Functions inherited from AddEvaluate< FunctionType >
double Evaluate (traits::UnconstructableType &)
 
- Static Public Member Functions inherited from AddDecomposableEvaluateWithGradientStatic< FunctionType >
static double EvaluateWithGradient (traits::UnconstructableType &, const size_t, const size_t)
 
- Static Public Member Functions inherited from AddDecomposableGradientStatic< FunctionType >
static void Gradient (traits::UnconstructableType &, const size_t, const size_t)
 
- Static Public Member Functions inherited from AddEvaluateWithGradientStatic< FunctionType >
static double EvaluateWithGradient (traits::UnconstructableType &)
 
- Static Public Member Functions inherited from AddGradientStatic< FunctionType >
static void Gradient (traits::UnconstructableType &)
 
- Static Public Member Functions inherited from AddEvaluateStatic< FunctionType >
static double Evaluate (traits::UnconstructableType &)
 

Detailed Description


template
<
typename
FunctionType
>

class mlpack::optimization::Function< FunctionType >

The Function class is a wrapper class for any FunctionType that will add any possible derived methods.

For instance, if the given FunctionType has Evaluate() and Gradient(), then Function<FunctionType> will have EvaluateWithGradient(). This infrastructure allows two things:

  1. Optimizers can expect FunctionTypes to have a wider array of functions than those FunctionTypes may actually implement.
  2. FunctionTypes don't need to implement every single method that an optimizer might require, just those from which every method can be inferred.

This class works by inheriting from a large set of "mixin" classes that provide missing functions, if needed. For instance, the AddGradient<> mixin will provide a Gradient() method if the given FunctionType implements an EvaluateWithGradient() method.

Since all of the casting is static and each of the mixin classes is an empty class, there should be no runtime overhead at all for this functionality. In addition, this class does not (to the best of my knowledge) rely on any undefined behavior.

Definition at line 22 of file function.hpp.


The documentation for this class was generated from the following file:
  • /var/www/www.mlpack.org/mlpack-git/src/mlpack/core/optimizers/function.hpp