pub type optimfn = unsafe extern "C-unwind" fn(n: c_int, par: *mut f64, ex: *mut c_void) -> f64;Expand description
Objective callback type for R’s optimisers: optimfn in R_ext/Applic.h,
typedef double optimfn(int n, double *par, void *ex).
Called with the parameter count, a pointer to n parameter values, and
the ex pointer given to the optimiser; returns the objective value.
lbfgsb requires a finite value: it raises an R error otherwise.
A Rust panic must not unwind out of the callback through R’s C frames:
catch it inside the callback (std::panic::catch_unwind), store the
payload in the ex state, return a finite value, and resume the panic
after the optimiser returns.
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 8 bytes