13 #ifndef MLPACK_CORE_OPTIMIZERS_ADD_DECOMPOSABLE_EVALUATE_WITH_GRADIENT_CONST_HPP 14 #define MLPACK_CORE_OPTIMIZERS_ADD_DECOMPOSABLE_EVALUATE_WITH_GRADIENT_CONST_HPP 20 namespace optimization {
24 template<
typename FunctionType>
29 template<
typename FunctionType>
31 double(FunctionType::*)(
const arma::mat&,
const size_t,
const size_t)
const;
33 template<
typename FunctionType>
38 template<
typename FunctionType>
44 template<
typename FunctionType>
46 void(FunctionType::*)(
const arma::mat&,
51 template<
typename FunctionType,
typename... Ts>
56 template<
typename FunctionType>
58 double(FunctionType::*)(
const arma::mat&,
63 template<
typename FunctionType>
65 void(FunctionType::*)(
const arma::mat&,
70 template<
typename FunctionType>
72 double(*)(
const arma::mat&,
const size_t, arma::mat&,
const size_t);
83 template<
typename FunctionType,
84 bool HasDecomposableEvaluate =
85 aux::HasEvaluate<FunctionType,
87 aux::HasEvaluate<FunctionType,
89 aux::HasEvaluate<FunctionType,
92 aux::HasGradient<FunctionType,
94 aux::HasGradient<FunctionType,
96 aux::HasGradient<FunctionType,
98 bool HasEvaluateWithGradient =
99 aux::HasEvaluateWithGradient<FunctionType,
101 aux::HasEvaluateWithGradient<FunctionType,
103 aux::HasEvaluateWithGradient<FunctionType,
111 template<
typename FunctionType>
126 const size_t batchSize)
128 const double objective = FunctionType::Evaluate(coordinates, begin,
130 FunctionType::Gradient(coordinates, begin, gradient, batchSize);
139 template<
typename FunctionType>
151 const size_t batchSize)
154 return FunctionType::EvaluateWithGradient(coordinates, begin, gradient,
163 template<
typename FunctionType>
177 const size_t batchSize)
180 (void) FunctionType::EvaluateWithGradient(coordinates, begin, gradient,
void Gradient(const arma::mat &coordinates, const size_t begin, arma::mat &gradient, const size_t batchSize)
Calculate the gradient and store it in the given matrix.
void(FunctionType::*)(const arma::mat &, const size_t, arma::mat &, const size_t) const DecomposableGradientConstForm
double(FunctionType::*)(const arma::mat &, const size_t, arma::mat &, const size_t) DecomposableEvaluateWithGradientForm
The AddDecomposableEvaluateWithGradient mixin class will add a decomposable EvaluateWithGradient() me...
double(*)(const arma::mat &, size_t, size_t) DecomposableEvaluateStaticForm
The core includes that mlpack expects; standard C++ includes and Armadillo.
double EvaluateWithGradient(const arma::mat &coordinates, const size_t begin, arma::mat &gradient, const size_t batchSize)
Return both the evaluated objective function and its gradient, storing the gradient in the given matr...
void(FunctionType::*)(const arma::mat &, const size_t, arma::mat &, const size_t) DecomposableGradientForm
double(FunctionType::*)(const arma::mat &, const size_t, const size_t) DecomposableEvaluateForm
void(*)(const arma::mat &, const size_t, arma::mat &) DecomposableGradientStaticForm
double(FunctionType::*)(const arma::mat &, const size_t, const size_t) const DecomposableEvaluateConstForm
double(*)(const arma::mat &, const size_t, arma::mat &, const size_t) DecomposableEvaluateWithGradientStaticForm
double Evaluate(const arma::mat &coordinates, const size_t begin, const size_t batchSize)
Return the objective function for the given coordinates.
void(FunctionType::*)(const arma::mat &, const size_t, arma::mat &, const size_t) const DecomposableEvaluateWithGradientConstForm