SHOGUN
v2.0.0
|
Go to the source code of this file.
Classes | |
struct | tag_callback_data |
struct | tag_iteration_data |
Defines | |
#define | min2(a, b) ((a) <= (b) ? (a) : (b)) |
#define | max2(a, b) ((a) >= (b) ? (a) : (b)) |
#define | max3(a, b, c) max2(max2((a), (b)), (c)); |
#define | USES_MINIMIZER float64_t a, d, gamma, theta, p, q, r, s; |
#define | CUBIC_MINIMIZER(cm, u, fu, du, v, fv, dv) |
#define | CUBIC_MINIMIZER2(cm, u, fu, du, v, fv, dv, xmin, xmax) |
#define | QUARD_MINIMIZER(qm, u, fu, du, v, fv) |
#define | QUARD_MINIMIZER2(qm, u, du, v, dv) |
#define | fsigndiff(x, y) (*(x) * (*(y) / fabs(*(y))) < 0.) |
Typedefs | |
typedef struct tag_callback_data | callback_data_t |
typedef struct tag_iteration_data | iteration_data_t |
typedef int32_t(* | line_search_proc )(int32_t n, float64_t *x, float64_t *f, float64_t *g, float64_t *s, float64_t *stp, const float64_t *xp, const float64_t *gp, float64_t *wa, callback_data_t *cd, const lbfgs_parameter_t *param) |
Functions | |
static int32_t | line_search_backtracking (int32_t n, float64_t *x, float64_t *f, float64_t *g, float64_t *s, float64_t *stp, const float64_t *xp, const float64_t *gp, float64_t *wa, callback_data_t *cd, const lbfgs_parameter_t *param) |
static int32_t | line_search_backtracking_owlqn (int32_t n, float64_t *x, float64_t *f, float64_t *g, float64_t *s, float64_t *stp, const float64_t *xp, const float64_t *gp, float64_t *wp, callback_data_t *cd, const lbfgs_parameter_t *param) |
static int32_t | line_search_morethuente (int32_t n, float64_t *x, float64_t *f, float64_t *g, float64_t *s, float64_t *stp, const float64_t *xp, const float64_t *gp, float64_t *wa, callback_data_t *cd, const lbfgs_parameter_t *param) |
static int32_t | update_trial_interval (float64_t *x, float64_t *fx, float64_t *dx, float64_t *y, float64_t *fy, float64_t *dy, float64_t *t, float64_t *ft, float64_t *dt, const float64_t tmin, const float64_t tmax, int32_t *brackt) |
static float64_t | owlqn_x1norm (const float64_t *x, const int32_t start, const int32_t n) |
static void | owlqn_pseudo_gradient (float64_t *pg, const float64_t *x, const float64_t *g, const int32_t n, const float64_t c, const int32_t start, const int32_t end) |
static void | owlqn_project (float64_t *d, const float64_t *sign, const int32_t start, const int32_t end) |
void | lbfgs_parameter_init (lbfgs_parameter_t *param) |
int32_t | lbfgs (int32_t n, float64_t *x, float64_t *ptr_fx, lbfgs_evaluate_t proc_evaluate, lbfgs_progress_t proc_progress, void *instance, lbfgs_parameter_t *_param) |
Variables | |
static const lbfgs_parameter_t | _defparam |
#define CUBIC_MINIMIZER | ( | cm, | |
u, | |||
fu, | |||
du, | |||
v, | |||
fv, | |||
dv | |||
) |
d = (v) - (u); \ theta = ((fu) - (fv)) * 3 / d + (du) + (dv); \ p = fabs(theta); \ q = fabs(du); \ r = fabs(dv); \ s = max3(p, q, r); \ /* gamma = s*sqrt((theta/s)**2 - (du/s) * (dv/s)) */ \ a = theta / s; \ gamma = s * sqrt(a * a - ((du) / s) * ((dv) / s)); \ if ((v) < (u)) gamma = -gamma; \ p = gamma - (du) + theta; \ q = gamma - (du) + gamma + (dv); \ r = p / q; \ (cm) = (u) + r * d;
Find a minimizer of an interpolated cubic function.
cm | The minimizer of the interpolated cubic. |
u | The value of one point, u. |
fu | The value of f(u). |
du | The value of f'(u). |
v | The value of another point, v. |
fv | The value of f(v). |
du | The value of f'(v). |
#define CUBIC_MINIMIZER2 | ( | cm, | |
u, | |||
fu, | |||
du, | |||
v, | |||
fv, | |||
dv, | |||
xmin, | |||
xmax | |||
) |
d = (v) - (u); \ theta = ((fu) - (fv)) * 3 / d + (du) + (dv); \ p = fabs(theta); \ q = fabs(du); \ r = fabs(dv); \ s = max3(p, q, r); \ /* gamma = s*sqrt((theta/s)**2 - (du/s) * (dv/s)) */ \ a = theta / s; \ gamma = s * sqrt(max2(0, a * a - ((du) / s) * ((dv) / s))); \ if ((u) < (v)) gamma = -gamma; \ p = gamma - (dv) + theta; \ q = gamma - (dv) + gamma + (du); \ r = p / q; \ if (r < 0. && gamma != 0.) { \ (cm) = (v) - r * d; \ } else if (a < 0) { \ (cm) = (xmax); \ } else { \ (cm) = (xmin); \ }
Find a minimizer of an interpolated cubic function.
cm | The minimizer of the interpolated cubic. |
u | The value of one point, u. |
fu | The value of f(u). |
du | The value of f'(u). |
v | The value of another point, v. |
fv | The value of f(v). |
du | The value of f'(v). |
xmin | The maximum value. |
xmin | The minimum value. |
#define fsigndiff | ( | x, | |
y | |||
) | (*(x) * (*(y) / fabs(*(y))) < 0.) |
#define QUARD_MINIMIZER | ( | qm, | |
u, | |||
fu, | |||
du, | |||
v, | |||
fv | |||
) |
a = (v) - (u); \ (qm) = (u) + (du) / (((fu) - (fv)) / a + (du)) / 2 * a;
Find a minimizer of an interpolated quadratic function.
qm | The minimizer of the interpolated quadratic. |
u | The value of one point, u. |
fu | The value of f(u). |
du | The value of f'(u). |
v | The value of another point, v. |
fv | The value of f(v). |
#define QUARD_MINIMIZER2 | ( | qm, | |
u, | |||
du, | |||
v, | |||
dv | |||
) |
a = (u) - (v); \ (qm) = (v) + (dv) / ((dv) - (du)) * a;
Find a minimizer of an interpolated quadratic function.
qm | The minimizer of the interpolated quadratic. |
u | The value of one point, u. |
du | The value of f'(u). |
v | The value of another point, v. |
dv | The value of f'(v). |
#define USES_MINIMIZER float64_t a, d, gamma, theta, p, q, r, s; |