Classes | Defines | Typedefs | Functions | Variables

lbfgs.cpp File Reference

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 Documentation

#define CUBIC_MINIMIZER (   cm,
  u,
  fu,
  du,
  v,
  fv,
  dv 
)
Value:
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.

Parameters:
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).

Definition at line 971 of file lbfgs.cpp.

#define CUBIC_MINIMIZER2 (   cm,
  u,
  fu,
  du,
  v,
  fv,
  dv,
  xmin,
  xmax 
)
Value:
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.

Parameters:
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.

Definition at line 999 of file lbfgs.cpp.

#define fsigndiff (   x,
  y 
)    (*(x) * (*(y) / fabs(*(y))) < 0.)

Definition at line 1046 of file lbfgs.cpp.

#define max2 (   a,
  b 
)    ((a) >= (b) ? (a) : (b))

Definition at line 76 of file lbfgs.cpp.

#define max3 (   a,
  b,
  c 
)    max2(max2((a), (b)), (c));

Definition at line 77 of file lbfgs.cpp.

#define min2 (   a,
  b 
)    ((a) <= (b) ? (a) : (b))

Definition at line 75 of file lbfgs.cpp.

#define QUARD_MINIMIZER (   qm,
  u,
  fu,
  du,
  v,
  fv 
)
Value:
a = (v) - (u); \
    (qm) = (u) + (du) / (((fu) - (fv)) / a + (du)) / 2 * a;

Find a minimizer of an interpolated quadratic function.

Parameters:
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).

Definition at line 1030 of file lbfgs.cpp.

#define QUARD_MINIMIZER2 (   qm,
  u,
  du,
  v,
  dv 
)
Value:
a = (u) - (v); \
    (qm) = (v) + (dv) / ((dv) - (du)) * a;

Find a minimizer of an interpolated quadratic function.

Parameters:
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).

Definition at line 1042 of file lbfgs.cpp.

#define USES_MINIMIZER   float64_t a, d, gamma, theta, p, q, r, s;

Define the local variables for computing minimizers.

Definition at line 958 of file lbfgs.cpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation