1#![allow(non_camel_case_types)]
3
4pub const LBFGS_FLOAT: u32 = 64;
5pub const LBFGS_IEEE_FLOAT: u32 = 1;
6pub type lbfgsfloatval_t = f64;
7#[doc = " L-BFGS reaches convergence."]
8pub const LBFGS_SUCCESS: ::std::os::raw::c_int = 0;
9#[doc = " L-BFGS reaches convergence."]
10pub const LBFGS_CONVERGENCE: ::std::os::raw::c_int = 0;
11#[doc = " L-BFGS reaches convergence."]
12pub const LBFGS_STOP: ::std::os::raw::c_int = 1;
13#[doc = " The initial variables already minimize the objective function."]
14pub const LBFGS_ALREADY_MINIMIZED: ::std::os::raw::c_int = 2;
15#[doc = " Unknown error."]
16pub const LBFGSERR_UNKNOWNERROR: ::std::os::raw::c_int = -1024;
17#[doc = " Logic error."]
18pub const LBFGSERR_LOGICERROR: ::std::os::raw::c_int = -1023;
19#[doc = " Insufficient memory."]
20pub const LBFGSERR_OUTOFMEMORY: ::std::os::raw::c_int = -1022;
21#[doc = " The minimization process has been canceled."]
22pub const LBFGSERR_CANCELED: ::std::os::raw::c_int = -1021;
23#[doc = " Invalid number of variables specified."]
24pub const LBFGSERR_INVALID_N: ::std::os::raw::c_int = -1020;
25#[doc = " Invalid number of variables (for SSE) specified."]
26pub const LBFGSERR_INVALID_N_SSE: ::std::os::raw::c_int = -1019;
27#[doc = " The array x must be aligned to 16 (for SSE)."]
28pub const LBFGSERR_INVALID_X_SSE: ::std::os::raw::c_int = -1018;
29#[doc = " Invalid parameter lbfgs_parameter_t::epsilon specified."]
30pub const LBFGSERR_INVALID_EPSILON: ::std::os::raw::c_int = -1017;
31#[doc = " Invalid parameter lbfgs_parameter_t::past specified."]
32pub const LBFGSERR_INVALID_TESTPERIOD: ::std::os::raw::c_int = -1016;
33#[doc = " Invalid parameter lbfgs_parameter_t::delta specified."]
34pub const LBFGSERR_INVALID_DELTA: ::std::os::raw::c_int = -1015;
35#[doc = " Invalid parameter lbfgs_parameter_t::linesearch specified."]
36pub const LBFGSERR_INVALID_LINESEARCH: ::std::os::raw::c_int = -1014;
37#[doc = " Invalid parameter lbfgs_parameter_t::max_step specified."]
38pub const LBFGSERR_INVALID_MINSTEP: ::std::os::raw::c_int = -1013;
39#[doc = " Invalid parameter lbfgs_parameter_t::max_step specified."]
40pub const LBFGSERR_INVALID_MAXSTEP: ::std::os::raw::c_int = -1012;
41#[doc = " Invalid parameter lbfgs_parameter_t::ftol specified."]
42pub const LBFGSERR_INVALID_FTOL: ::std::os::raw::c_int = -1011;
43#[doc = " Invalid parameter lbfgs_parameter_t::wolfe specified."]
44pub const LBFGSERR_INVALID_WOLFE: ::std::os::raw::c_int = -1010;
45#[doc = " Invalid parameter lbfgs_parameter_t::gtol specified."]
46pub const LBFGSERR_INVALID_GTOL: ::std::os::raw::c_int = -1009;
47#[doc = " Invalid parameter lbfgs_parameter_t::xtol specified."]
48pub const LBFGSERR_INVALID_XTOL: ::std::os::raw::c_int = -1008;
49#[doc = " Invalid parameter lbfgs_parameter_t::max_linesearch specified."]
50pub const LBFGSERR_INVALID_MAXLINESEARCH: ::std::os::raw::c_int = -1007;
51#[doc = " Invalid parameter lbfgs_parameter_t::orthantwise_c specified."]
52pub const LBFGSERR_INVALID_ORTHANTWISE: ::std::os::raw::c_int = -1006;
53#[doc = " Invalid parameter lbfgs_parameter_t::orthantwise_start specified."]
54pub const LBFGSERR_INVALID_ORTHANTWISE_START: ::std::os::raw::c_int = -1005;
55#[doc = " Invalid parameter lbfgs_parameter_t::orthantwise_end specified."]
56pub const LBFGSERR_INVALID_ORTHANTWISE_END: ::std::os::raw::c_int = -1004;
57#[doc = " The line-search step went out of the interval of uncertainty."]
58pub const LBFGSERR_OUTOFINTERVAL: ::std::os::raw::c_int = -1003;
59#[doc = " A logic error occurred; alternatively, the interval of uncertainty"]
60#[doc = "became too small."]
61pub const LBFGSERR_INCORRECT_TMINMAX: ::std::os::raw::c_int = -1002;
62#[doc = " A rounding error occurred; alternatively, no line-search step"]
63#[doc = "satisfies the sufficient decrease and curvature conditions."]
64pub const LBFGSERR_ROUNDING_ERROR: ::std::os::raw::c_int = -1001;
65#[doc = " The line-search step became smaller than lbfgs_parameter_t::min_step."]
66pub const LBFGSERR_MINIMUMSTEP: ::std::os::raw::c_int = -1000;
67#[doc = " The line-search step became larger than lbfgs_parameter_t::max_step."]
68pub const LBFGSERR_MAXIMUMSTEP: ::std::os::raw::c_int = -999;
69#[doc = " The line-search routine reaches the maximum number of evaluations."]
70pub const LBFGSERR_MAXIMUMLINESEARCH: ::std::os::raw::c_int = -998;
71#[doc = " The algorithm routine reaches the maximum number of iterations."]
72pub const LBFGSERR_MAXIMUMITERATION: ::std::os::raw::c_int = -997;
73#[doc = " Relative width of the interval of uncertainty is at most"]
74#[doc = "lbfgs_parameter_t::xtol."]
75pub const LBFGSERR_WIDTHTOOSMALL: ::std::os::raw::c_int = -996;
76#[doc = " A logic error (negative line-search step) occurred."]
77pub const LBFGSERR_INVALIDPARAMETERS: ::std::os::raw::c_int = -995;
78#[doc = " The current search direction increases the objective function value."]
79pub const LBFGSERR_INCREASEGRADIENT: ::std::os::raw::c_int = -994;
80#[doc = " Return values of lbfgs()."]
81#[doc = ""]
82#[doc = " Roughly speaking, a negative value indicates an error."]
83pub type _bindgen_ty_1 = ::std::os::raw::c_int;
84#[doc = " The default algorithm (MoreThuente method)."]
85pub const LBFGS_LINESEARCH_DEFAULT: ::std::os::raw::c_uint = 0;
86#[doc = " MoreThuente method proposd by More and Thuente."]
87pub const LBFGS_LINESEARCH_MORETHUENTE: ::std::os::raw::c_uint = 0;
88#[doc = " Backtracking method with the Armijo condition."]
89#[doc = " The backtracking method finds the step length such that it satisfies"]
90#[doc = " the sufficient decrease (Armijo) condition,"]
91#[doc = " - f(x + a * d) <= f(x) + lbfgs_parameter_t::ftol * a * g(x)^T d,"]
92#[doc = ""]
93#[doc = " where x is the current point, d is the current search direction, and"]
94#[doc = " a is the step length."]
95pub const LBFGS_LINESEARCH_BACKTRACKING_ARMIJO: ::std::os::raw::c_uint = 1;
96#[doc = " The backtracking method with the defualt (regular Wolfe) condition."]
97pub const LBFGS_LINESEARCH_BACKTRACKING: ::std::os::raw::c_uint = 2;
98#[doc = " Backtracking method with regular Wolfe condition."]
99#[doc = " The backtracking method finds the step length such that it satisfies"]
100#[doc = " both the Armijo condition (LBFGS_LINESEARCH_BACKTRACKING_ARMIJO)"]
101#[doc = " and the curvature condition,"]
102#[doc = " - g(x + a * d)^T d >= lbfgs_parameter_t::wolfe * g(x)^T d,"]
103#[doc = ""]
104#[doc = " where x is the current point, d is the current search direction, and"]
105#[doc = " a is the step length."]
106pub const LBFGS_LINESEARCH_BACKTRACKING_WOLFE: ::std::os::raw::c_uint = 2;
107#[doc = " Backtracking method with strong Wolfe condition."]
108#[doc = " The backtracking method finds the step length such that it satisfies"]
109#[doc = " both the Armijo condition (LBFGS_LINESEARCH_BACKTRACKING_ARMIJO)"]
110#[doc = " and the following condition,"]
111#[doc = " - |g(x + a * d)^T d| <= lbfgs_parameter_t::wolfe * |g(x)^T d|,"]
112#[doc = ""]
113#[doc = " where x is the current point, d is the current search direction, and"]
114#[doc = " a is the step length."]
115pub const LBFGS_LINESEARCH_BACKTRACKING_STRONG_WOLFE: ::std::os::raw::c_uint = 3;
116#[doc = " Line search algorithms."]
117pub type _bindgen_ty_2 = ::std::os::raw::c_uint;
118#[doc = " L-BFGS optimization parameters."]
119#[doc = " Call lbfgs_parameter_init() function to initialize parameters to the"]
120#[doc = " default values."]
121#[repr(C)]
122#[derive(Debug, Copy, Clone)]
123pub struct lbfgs_parameter_t {
124 #[doc = " The number of corrections to approximate the inverse hessian matrix."]
125 #[doc = " The L-BFGS routine stores the computation results of previous \\ref m"]
126 #[doc = " iterations to approximate the inverse hessian matrix of the current"]
127 #[doc = " iteration. This parameter controls the size of the limited memories"]
128 #[doc = " (corrections). The default value is \\c 6. Values less than \\c 3 are"]
129 #[doc = " not recommended. Large values will result in excessive computing time."]
130 pub m: ::std::os::raw::c_int,
131 #[doc = " Epsilon for convergence test."]
132 #[doc = " This parameter determines the accuracy with which the solution is to"]
133 #[doc = " be found. A minimization terminates when"]
134 #[doc = " ||g|| < \\ref epsilon * max(1, ||x||),"]
135 #[doc = " where ||.|| denotes the Euclidean (L2) norm. The default value is"]
136 #[doc = " \\c 1e-5."]
137 pub epsilon: lbfgsfloatval_t,
138 #[doc = " Distance for delta-based convergence test."]
139 #[doc = " This parameter determines the distance, in iterations, to compute"]
140 #[doc = " the rate of decrease of the objective function. If the value of this"]
141 #[doc = " parameter is zero, the library does not perform the delta-based"]
142 #[doc = " convergence test. The default value is \\c 0."]
143 pub past: ::std::os::raw::c_int,
144 #[doc = " Delta for convergence test."]
145 #[doc = " This parameter determines the minimum rate of decrease of the"]
146 #[doc = " objective function. The library stops iterations when the"]
147 #[doc = " following condition is met:"]
148 #[doc = " (f' - f) / f < \\ref delta,"]
149 #[doc = " where f' is the objective value of \\ref past iterations ago, and f is"]
150 #[doc = " the objective value of the current iteration."]
151 #[doc = " The default value is \\c 1e-5."]
152 pub delta: lbfgsfloatval_t,
153 #[doc = " The maximum number of iterations."]
154 #[doc = " The lbfgs() function terminates an optimization process with"]
155 #[doc = " ::LBFGSERR_MAXIMUMITERATION status code when the iteration count"]
156 #[doc = " exceedes this parameter. Setting this parameter to zero continues an"]
157 #[doc = " optimization process until a convergence or error. The default value"]
158 #[doc = " is \\c 0."]
159 pub max_iterations: ::std::os::raw::c_int,
160 #[doc = " The line search algorithm."]
161 #[doc = " This parameter specifies a line search algorithm to be used by the"]
162 #[doc = " L-BFGS routine."]
163 pub linesearch: ::std::os::raw::c_int,
164 #[doc = " The maximum number of trials for the line search."]
165 #[doc = " This parameter controls the number of function and gradients evaluations"]
166 #[doc = " per iteration for the line search routine. The default value is \\c 40."]
167 pub max_linesearch: ::std::os::raw::c_int,
168 #[doc = " The minimum step of the line search routine."]
169 #[doc = " The default value is \\c 1e-20. This value need not be modified unless"]
170 #[doc = " the exponents are too large for the machine being used, or unless the"]
171 #[doc = " problem is extremely badly scaled (in which case the exponents should"]
172 #[doc = " be increased)."]
173 pub min_step: lbfgsfloatval_t,
174 #[doc = " The maximum step of the line search."]
175 #[doc = " The default value is \\c 1e+20. This value need not be modified unless"]
176 #[doc = " the exponents are too large for the machine being used, or unless the"]
177 #[doc = " problem is extremely badly scaled (in which case the exponents should"]
178 #[doc = " be increased)."]
179 pub max_step: lbfgsfloatval_t,
180 #[doc = " A parameter to control the accuracy of the line search routine."]
181 #[doc = " The default value is \\c 1e-4. This parameter should be greater"]
182 #[doc = " than zero and smaller than \\c 0.5."]
183 pub ftol: lbfgsfloatval_t,
184 #[doc = " A coefficient for the Wolfe condition."]
185 #[doc = " This parameter is valid only when the backtracking line-search"]
186 #[doc = " algorithm is used with the Wolfe condition,"]
187 #[doc = " ::LBFGS_LINESEARCH_BACKTRACKING_STRONG_WOLFE or"]
188 #[doc = " ::LBFGS_LINESEARCH_BACKTRACKING_WOLFE ."]
189 #[doc = " The default value is \\c 0.9. This parameter should be greater"]
190 #[doc = " the \\ref ftol parameter and smaller than \\c 1.0."]
191 pub wolfe: lbfgsfloatval_t,
192 #[doc = " A parameter to control the accuracy of the line search routine."]
193 #[doc = " The default value is \\c 0.9. If the function and gradient"]
194 #[doc = " evaluations are inexpensive with respect to the cost of the"]
195 #[doc = " iteration (which is sometimes the case when solving very large"]
196 #[doc = " problems) it may be advantageous to set this parameter to a small"]
197 #[doc = " value. A typical small value is \\c 0.1. This parameter shuold be"]
198 #[doc = " greater than the \\ref ftol parameter (\\c 1e-4) and smaller than"]
199 #[doc = " \\c 1.0."]
200 pub gtol: lbfgsfloatval_t,
201 #[doc = " The machine precision for floating-point values."]
202 #[doc = " This parameter must be a positive value set by a client program to"]
203 #[doc = " estimate the machine precision. The line search routine will terminate"]
204 #[doc = " with the status code (::LBFGSERR_ROUNDING_ERROR) if the relative width"]
205 #[doc = " of the interval of uncertainty is less than this parameter."]
206 pub xtol: lbfgsfloatval_t,
207 #[doc = " Coeefficient for the L1 norm of variables."]
208 #[doc = " This parameter should be set to zero for standard minimization"]
209 #[doc = " problems. Setting this parameter to a positive value activates"]
210 #[doc = " Orthant-Wise Limited-memory Quasi-Newton (OWL-QN) method, which"]
211 #[doc = " minimizes the objective function F(x) combined with the L1 norm |x|"]
212 #[doc = " of the variables, {F(x) + C |x|}. This parameter is the coeefficient"]
213 #[doc = " for the |x|, i.e., C. As the L1 norm |x| is not differentiable at"]
214 #[doc = " zero, the library modifies function and gradient evaluations from"]
215 #[doc = " a client program suitably; a client program thus have only to return"]
216 #[doc = " the function value F(x) and gradients G(x) as usual. The default value"]
217 #[doc = " is zero."]
218 pub orthantwise_c: lbfgsfloatval_t,
219 #[doc = " Start index for computing L1 norm of the variables."]
220 #[doc = " This parameter is valid only for OWL-QN method"]
221 #[doc = " (i.e., \\ref orthantwise_c != 0). This parameter b (0 <= b < N)"]
222 #[doc = " specifies the index number from which the library computes the"]
223 #[doc = " L1 norm of the variables x,"]
224 #[doc = " |x| := |x_{b}| + |x_{b+1}| + ... + |x_{N}| ."]
225 #[doc = " In other words, variables x_1, ..., x_{b-1} are not used for"]
226 #[doc = " computing the L1 norm. Setting b (0 < b < N), one can protect"]
227 #[doc = " variables, x_1, ..., x_{b-1} (e.g., a bias term of logistic"]
228 #[doc = " regression) from being regularized. The default value is zero."]
229 pub orthantwise_start: ::std::os::raw::c_int,
230 #[doc = " End index for computing L1 norm of the variables."]
231 #[doc = " This parameter is valid only for OWL-QN method"]
232 #[doc = " (i.e., \\ref orthantwise_c != 0). This parameter e (0 < e <= N)"]
233 #[doc = " specifies the index number at which the library stops computing the"]
234 #[doc = " L1 norm of the variables x,"]
235 pub orthantwise_end: ::std::os::raw::c_int,
236}
237#[test]
238fn bindgen_test_layout_lbfgs_parameter_t() {
239 assert_eq!(
240 ::std::mem::size_of::<lbfgs_parameter_t>(),
241 112usize,
242 concat!("Size of: ", stringify!(lbfgs_parameter_t))
243 );
244 assert_eq!(
245 ::std::mem::align_of::<lbfgs_parameter_t>(),
246 8usize,
247 concat!("Alignment of ", stringify!(lbfgs_parameter_t))
248 );
249 assert_eq!(
250 unsafe { &(*(::std::ptr::null::<lbfgs_parameter_t>())).m as *const _ as usize },
251 0usize,
252 concat!(
253 "Offset of field: ",
254 stringify!(lbfgs_parameter_t),
255 "::",
256 stringify!(m)
257 )
258 );
259 assert_eq!(
260 unsafe { &(*(::std::ptr::null::<lbfgs_parameter_t>())).epsilon as *const _ as usize },
261 8usize,
262 concat!(
263 "Offset of field: ",
264 stringify!(lbfgs_parameter_t),
265 "::",
266 stringify!(epsilon)
267 )
268 );
269 assert_eq!(
270 unsafe { &(*(::std::ptr::null::<lbfgs_parameter_t>())).past as *const _ as usize },
271 16usize,
272 concat!(
273 "Offset of field: ",
274 stringify!(lbfgs_parameter_t),
275 "::",
276 stringify!(past)
277 )
278 );
279 assert_eq!(
280 unsafe { &(*(::std::ptr::null::<lbfgs_parameter_t>())).delta as *const _ as usize },
281 24usize,
282 concat!(
283 "Offset of field: ",
284 stringify!(lbfgs_parameter_t),
285 "::",
286 stringify!(delta)
287 )
288 );
289 assert_eq!(
290 unsafe {
291 &(*(::std::ptr::null::<lbfgs_parameter_t>())).max_iterations as *const _ as usize
292 },
293 32usize,
294 concat!(
295 "Offset of field: ",
296 stringify!(lbfgs_parameter_t),
297 "::",
298 stringify!(max_iterations)
299 )
300 );
301 assert_eq!(
302 unsafe { &(*(::std::ptr::null::<lbfgs_parameter_t>())).linesearch as *const _ as usize },
303 36usize,
304 concat!(
305 "Offset of field: ",
306 stringify!(lbfgs_parameter_t),
307 "::",
308 stringify!(linesearch)
309 )
310 );
311 assert_eq!(
312 unsafe {
313 &(*(::std::ptr::null::<lbfgs_parameter_t>())).max_linesearch as *const _ as usize
314 },
315 40usize,
316 concat!(
317 "Offset of field: ",
318 stringify!(lbfgs_parameter_t),
319 "::",
320 stringify!(max_linesearch)
321 )
322 );
323 assert_eq!(
324 unsafe { &(*(::std::ptr::null::<lbfgs_parameter_t>())).min_step as *const _ as usize },
325 48usize,
326 concat!(
327 "Offset of field: ",
328 stringify!(lbfgs_parameter_t),
329 "::",
330 stringify!(min_step)
331 )
332 );
333 assert_eq!(
334 unsafe { &(*(::std::ptr::null::<lbfgs_parameter_t>())).max_step as *const _ as usize },
335 56usize,
336 concat!(
337 "Offset of field: ",
338 stringify!(lbfgs_parameter_t),
339 "::",
340 stringify!(max_step)
341 )
342 );
343 assert_eq!(
344 unsafe { &(*(::std::ptr::null::<lbfgs_parameter_t>())).ftol as *const _ as usize },
345 64usize,
346 concat!(
347 "Offset of field: ",
348 stringify!(lbfgs_parameter_t),
349 "::",
350 stringify!(ftol)
351 )
352 );
353 assert_eq!(
354 unsafe { &(*(::std::ptr::null::<lbfgs_parameter_t>())).wolfe as *const _ as usize },
355 72usize,
356 concat!(
357 "Offset of field: ",
358 stringify!(lbfgs_parameter_t),
359 "::",
360 stringify!(wolfe)
361 )
362 );
363 assert_eq!(
364 unsafe { &(*(::std::ptr::null::<lbfgs_parameter_t>())).gtol as *const _ as usize },
365 80usize,
366 concat!(
367 "Offset of field: ",
368 stringify!(lbfgs_parameter_t),
369 "::",
370 stringify!(gtol)
371 )
372 );
373 assert_eq!(
374 unsafe { &(*(::std::ptr::null::<lbfgs_parameter_t>())).xtol as *const _ as usize },
375 88usize,
376 concat!(
377 "Offset of field: ",
378 stringify!(lbfgs_parameter_t),
379 "::",
380 stringify!(xtol)
381 )
382 );
383 assert_eq!(
384 unsafe { &(*(::std::ptr::null::<lbfgs_parameter_t>())).orthantwise_c as *const _ as usize },
385 96usize,
386 concat!(
387 "Offset of field: ",
388 stringify!(lbfgs_parameter_t),
389 "::",
390 stringify!(orthantwise_c)
391 )
392 );
393 assert_eq!(
394 unsafe {
395 &(*(::std::ptr::null::<lbfgs_parameter_t>())).orthantwise_start as *const _ as usize
396 },
397 104usize,
398 concat!(
399 "Offset of field: ",
400 stringify!(lbfgs_parameter_t),
401 "::",
402 stringify!(orthantwise_start)
403 )
404 );
405 assert_eq!(
406 unsafe {
407 &(*(::std::ptr::null::<lbfgs_parameter_t>())).orthantwise_end as *const _ as usize
408 },
409 108usize,
410 concat!(
411 "Offset of field: ",
412 stringify!(lbfgs_parameter_t),
413 "::",
414 stringify!(orthantwise_end)
415 )
416 );
417}
418#[doc = " Callback interface to provide objective function and gradient evaluations."]
419#[doc = ""]
420#[doc = " The lbfgs() function call this function to obtain the values of objective"]
421#[doc = " function and its gradients when needed. A client program must implement"]
422#[doc = " this function to evaluate the values of the objective function and its"]
423#[doc = " gradients, given current values of variables."]
424#[doc = ""]
425#[doc = " @param instance The user data sent for lbfgs() function by the client."]
426#[doc = " @param x The current values of variables."]
427#[doc = " @param g The gradient vector. The callback function must compute"]
428#[doc = " the gradient values for the current variables."]
429#[doc = " @param n The number of variables."]
430#[doc = " @param step The current step of the line search routine."]
431#[doc = " @retval lbfgsfloatval_t The value of the objective function for the current"]
432#[doc = " variables."]
433pub type lbfgs_evaluate_t = ::std::option::Option<
434 unsafe extern "C" fn(
435 instance: *mut ::std::os::raw::c_void,
436 x: *const lbfgsfloatval_t,
437 g: *mut lbfgsfloatval_t,
438 n: ::std::os::raw::c_int,
439 step: lbfgsfloatval_t,
440 ) -> lbfgsfloatval_t,
441>;
442#[doc = " Callback interface to receive the progress of the optimization process."]
443#[doc = ""]
444#[doc = " The lbfgs() function call this function for each iteration. Implementing"]
445#[doc = " this function, a client program can store or display the current progress"]
446#[doc = " of the optimization process."]
447#[doc = ""]
448#[doc = " @param instance The user data sent for lbfgs() function by the client."]
449#[doc = " @param x The current values of variables."]
450#[doc = " @param g The current gradient values of variables."]
451#[doc = " @param fx The current value of the objective function."]
452#[doc = " @param xnorm The Euclidean norm of the variables."]
453#[doc = " @param gnorm The Euclidean norm of the gradients."]
454#[doc = " @param step The line-search step used for this iteration."]
455#[doc = " @param n The number of variables."]
456#[doc = " @param k The iteration count."]
457#[doc = " @param ls The number of evaluations called for this iteration."]
458#[doc = " @retval int Zero to continue the optimization process. Returning a"]
459#[doc = " non-zero value will cancel the optimization process."]
460pub type lbfgs_progress_t = ::std::option::Option<
461 unsafe extern "C" fn(
462 instance: *mut ::std::os::raw::c_void,
463 x: *const lbfgsfloatval_t,
464 g: *const lbfgsfloatval_t,
465 fx: lbfgsfloatval_t,
466 xnorm: lbfgsfloatval_t,
467 gnorm: lbfgsfloatval_t,
468 step: lbfgsfloatval_t,
469 n: ::std::os::raw::c_int,
470 k: ::std::os::raw::c_int,
471 ls: ::std::os::raw::c_int,
472 ) -> ::std::os::raw::c_int,
473>;
474extern "C" {
475 #[doc = " Start a L-BFGS optimization."]
476 #[doc = ""]
477 #[doc = " @param n The number of variables."]
478 #[doc = " @param x The array of variables. A client program can set"]
479 #[doc = " default values for the optimization and receive the"]
480 #[doc = " optimization result through this array. This array"]
481 #[doc = " must be allocated by ::lbfgs_malloc function"]
482 #[doc = " for libLBFGS built with SSE/SSE2 optimization routine"]
483 #[doc = " enabled. The library built without SSE/SSE2"]
484 #[doc = " optimization does not have such a requirement."]
485 #[doc = " @param ptr_fx The pointer to the variable that receives the final"]
486 #[doc = " value of the objective function for the variables."]
487 #[doc = " This argument can be set to \\c NULL if the final"]
488 #[doc = " value of the objective function is unnecessary."]
489 #[doc = " @param proc_evaluate The callback function to provide function and"]
490 #[doc = " gradient evaluations given a current values of"]
491 #[doc = " variables. A client program must implement a"]
492 #[doc = " callback function compatible with \\ref"]
493 #[doc = " lbfgs_evaluate_t and pass the pointer to the"]
494 #[doc = " callback function."]
495 #[doc = " @param proc_progress The callback function to receive the progress"]
496 #[doc = " (the number of iterations, the current value of"]
497 #[doc = " the objective function) of the minimization"]
498 #[doc = " process. This argument can be set to \\c NULL if"]
499 #[doc = " a progress report is unnecessary."]
500 #[doc = " @param instance A user data for the client program. The callback"]
501 #[doc = " functions will receive the value of this argument."]
502 #[doc = " @param param The pointer to a structure representing parameters for"]
503 #[doc = " L-BFGS optimization. A client program can set this"]
504 #[doc = " parameter to \\c NULL to use the default parameters."]
505 #[doc = " Call lbfgs_parameter_init() function to fill a"]
506 #[doc = " structure with the default values."]
507 #[doc = " @retval int The status code. This function returns zero if the"]
508 #[doc = " minimization process terminates without an error. A"]
509 #[doc = " non-zero value indicates an error."]
510 pub fn lbfgs(
511 n: ::std::os::raw::c_int,
512 x: *mut lbfgsfloatval_t,
513 ptr_fx: *mut lbfgsfloatval_t,
514 proc_evaluate: lbfgs_evaluate_t,
515 proc_progress: lbfgs_progress_t,
516 instance: *mut ::std::os::raw::c_void,
517 param: *mut lbfgs_parameter_t,
518 ) -> ::std::os::raw::c_int;
519}
520extern "C" {
521 #[doc = " Initialize L-BFGS parameters to the default values."]
522 #[doc = ""]
523 #[doc = " Call this function to fill a parameter structure with the default values"]
524 #[doc = " and overwrite parameter values if necessary."]
525 #[doc = ""]
526 #[doc = " @param param The pointer to the parameter structure."]
527 pub fn lbfgs_parameter_init(param: *mut lbfgs_parameter_t);
528}
529extern "C" {
530 #[doc = " Allocate an array for variables."]
531 #[doc = ""]
532 #[doc = " This function allocates an array of variables for the convenience of"]
533 #[doc = " ::lbfgs function; the function has a requreiemt for a variable array"]
534 #[doc = " when libLBFGS is built with SSE/SSE2 optimization routines. A user does"]
535 #[doc = " not have to use this function for libLBFGS built without SSE/SSE2"]
536 #[doc = " optimization."]
537 #[doc = ""]
538 #[doc = " @param n The number of variables."]
539 pub fn lbfgs_malloc(n: ::std::os::raw::c_int) -> *mut lbfgsfloatval_t;
540}
541extern "C" {
542 #[doc = " Free an array of variables."]
543 #[doc = ""]
544 #[doc = " @param x The array of variables allocated by ::lbfgs_malloc"]
545 #[doc = " function."]
546 pub fn lbfgs_free(x: *mut lbfgsfloatval_t);
547}
548extern "C" {
549 #[doc = " Get string description of an lbfgs() return code."]
550 #[doc = ""]
551 #[doc = " @param err A value returned by lbfgs()."]
552 pub fn lbfgs_strerror(err: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char;
553}