12 #ifndef MLPACK_CORE_OPTIMIZERS_FW_FUNC_SQ_HPP 13 #define MLPACK_CORE_OPTIMIZERS_FW_FUNC_SQ_HPP 18 namespace optimization {
34 FuncSq(
const arma::mat& A,
const arma::vec& b) : A(A), b(b)
46 arma::vec r = A * coords - b;
47 return arma::dot(r, r) * 0.5;
57 void Gradient(
const arma::mat& coords, arma::mat& gradient)
59 arma::vec r = A * coords - b;
double Evaluate(const arma::mat &coords)
Evaluation of the function.
arma::mat MatrixA() const
Get the matrix A.
void Gradient(const arma::mat &coords, arma::mat &gradient)
Gradient of square loss function.
arma::mat & MatrixA()
Modify the matrix A.
The core includes that mlpack expects; standard C++ includes and Armadillo.
arma::vec & Vectorb()
Modify the vector b.
FuncSq(const arma::mat &A, const arma::vec &b)
Construct the square loss function.
arma::vec Vectorb() const
Get the vector b.