SHOGUN  4.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Macros | Typedefs | Functions | Variables
lbfgs.cpp File Reference

Go to the source code of this file.

Classes

struct  tag_callback_data
 
struct  tag_iteration_data
 

Macros

#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, lbfgs_adjust_step_t proc_adjust_step)
 

Variables

static const lbfgs_parameter_t _defparam
 

Macro Definition 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;
#define max3(a, b, c)
Definition: lbfgs.cpp:80

Find a minimizer of an interpolated cubic function.

Parameters
cmThe minimizer of the interpolated cubic.
uThe value of one point, u.
fuThe value of f(u).
duThe value of f'(u).
vThe value of another point, v.
fvThe value of f(v).
dvThe value of f'(v).

Definition at line 1011 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); \
}
#define max2(a, b)
Definition: lbfgs.cpp:79
#define max3(a, b, c)
Definition: lbfgs.cpp:80

Find a minimizer of an interpolated cubic function.

Parameters
cmThe minimizer of the interpolated cubic.
uThe value of one point, u.
fuThe value of f(u).
duThe value of f'(u).
vThe value of another point, v.
fvThe value of f(v).
duThe value of f'(v).
xminThe minimum value.
xmaxThe maximum value.

Definition at line 1039 of file lbfgs.cpp.

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

Definition at line 1086 of file lbfgs.cpp.

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

Definition at line 79 of file lbfgs.cpp.

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

Definition at line 80 of file lbfgs.cpp.

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

Definition at line 78 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
qmThe minimizer of the interpolated quadratic.
uThe value of one point, u.
fuThe value of f(u).
duThe value of f'(u).
vThe value of another point, v.
fvThe value of f(v).

Definition at line 1070 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
qmThe minimizer of the interpolated quadratic.
uThe value of one point, u.
duThe value of f'(u).
vThe value of another point, v.
dvThe value of f'(v).

Definition at line 1082 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 998 of file lbfgs.cpp.


SHOGUN Machine Learning Toolbox - Documentation