13 #ifndef MLPACK_CORE_OPTIMIZERS_FUNCTION_ADD_EVALUATE_HPP 14 #define MLPACK_CORE_OPTIMIZERS_FUNCTION_ADD_EVALUATE_HPP 20 namespace optimization {
26 template<
typename FunctionType,
27 bool HasEvaluateWithGradient =
28 traits::HasEvaluateWithGradient<FunctionType,
31 traits::HasEvaluate<FunctionType, traits::EvaluateForm>::value>
42 template<
typename FunctionType,
bool HasEvaluateWithGradient>
43 class AddEvaluate<FunctionType, HasEvaluateWithGradient, true>
50 this))->Evaluate(coordinates);
58 template<
typename FunctionType>
71 coordinates, gradient);
80 template<
typename FunctionType,
81 bool HasEvaluateWithGradient =
82 traits::HasEvaluateWithGradient<FunctionType,
85 traits::HasEvaluate<FunctionType,
97 template<
typename FunctionType,
bool HasEvaluateWithGradient>
102 double Evaluate(
const arma::mat& coordinates)
const 104 return static_cast<const FunctionType*
>(
static_cast<const
114 template<
typename FunctionType>
123 double Evaluate(
const arma::mat& coordinates)
const 137 template<
typename FunctionType,
138 bool HasEvaluateWithGradient =
139 traits::HasEvaluateWithGradient<FunctionType,
142 traits::HasEvaluate<FunctionType,
154 template<
typename FunctionType,
bool HasEvaluateWithGradient>
159 static double Evaluate(
const arma::mat& coordinates)
161 return FunctionType::Evaluate(coordinates);
169 template<
typename FunctionType>
178 static double Evaluate(
const arma::mat& coordinates)
181 return FunctionType::EvaluateWithGradient(coordinates, gradient);
double(*)(const arma::mat &) EvaluateStaticForm
This is the form of a static Evaluate() method.
double(*)(const arma::mat &, arma::mat &) EvaluateWithGradientStaticForm
This is the form of a static EvaluateWithGradient() method.
double Evaluate(traits::UnconstructableType &)
double(FunctionType::*)(const arma::mat &) const EvaluateConstForm
This is the form of a const Evaluate() method.
double(FunctionType::*)(const arma::mat &, arma::mat &) const EvaluateWithGradientConstForm
This is the form of a const EvaluateWithGradient() method.
The AddEvaluate mixin class will provide an Evaluate() method if the given FunctionType has EvaluateW...
The core includes that mlpack expects; standard C++ includes and Armadillo.
The AddEvaluateStatic mixin class will provide a static Evaluate() method if the given FunctionType h...
double Evaluate(const arma::mat &coordinates)
Return the objective function for the given coordinates.
double Evaluate(const arma::mat &coordinates)
double Evaluate(const arma::mat &coordinates) const
Return the objective function for the given coordinates.
static double Evaluate(const arma::mat &coordinates)
This is a utility type used to provide unusable overloads from each of the mixin classes.
static double Evaluate(const arma::mat &coordinates)
Return the objective function for the given coordinates.
The AddEvaluateConst mixin class will provide a const Evaluate() method if the given FunctionType has...
double(FunctionType::*)(const arma::mat &, arma::mat &) EvaluateWithGradientForm
This is the form of a non-const EvaluateWithGradient() method.
double Evaluate(const arma::mat &coordinates) const
The Function class is a wrapper class for any FunctionType that will add any possible derived methods...