File optimisation.hpp

Contains numerical methods for optimisation and root-finding.

Oliver W. Laslett

namespace optimisation


int newton_raphson_1(double *x_root, const std::function<double(const double)> f, const std::function<double(const double)> fdash, const double x0, const double eps = 1e-7, const size_t max_iter = 1000, )
int newton_raphson_noinv(double *x_root, double *x_tmp, double *jac_out, lapack_int *ipiv, int *lapack_err_code, const std::function<void(double *, double *, const double *)> func_and_jacobian, const double *x0, const lapack_int dim, const double eps = 1e-7, const size_t max_iter = 1000, )


const int SUCCESS = 0

Optimisation success return code.

const int MAX_ITERATIONS_ERR = 1

Optimisation maximum iterations reached error code.

const int LAPACK_ERR = 2

Otimisation internal LAPACK error code.

This error code indicates an error ocurred in an internal LAPACK call. Further investigation will be needed to determine the cause.