14 #ifndef MLPACK_CORE_OPTIMIZERS_FW_TEST_FUNC_FW_HPP 15 #define MLPACK_CORE_OPTIMIZERS_FW_TEST_FUNC_FW_HPP 20 namespace optimization {
40 double f = std::pow(coords[0] - 0.1, 2);
41 f += std::pow(coords[1] - 0.2, 2);
42 f += std::pow(coords[2] - 0.3, 2);
52 void Gradient(
const arma::mat& coords, arma::mat& gradient)
54 gradient.set_size(3, 1);
55 gradient[0] = coords[0] - 0.1;
56 gradient[1] = coords[1] - 0.2;
57 gradient[2] = coords[2] - 0.3;
The core includes that mlpack expects; standard C++ includes and Armadillo.
Simple test function for classic Frank Wolfe Algorithm:
void Gradient(const arma::mat &coords, arma::mat &gradient)
Gradient of the function.
double Evaluate(const arma::mat &coords)
Evaluation of the function.