Function icasadi::estimate_local_lipschitz_squared
source · pub fn estimate_local_lipschitz_squared(
u: &mut [f64],
p: &[f64],
jac: &mut [f64],
workspace: &mut [f64]
) -> f64
Expand description
Estimates a local squared Lipschitz constant for the gradient of the cost
Input arguments:
u
point where the squared Lipschitz constant is estimatedp
parameterjac
a slice which is updated with the Jacobian matrix of the cost function atu
; the provided value ofjac
is not usedworkspace
externally allocated workspace memory
Output arguments:
- local squared Lipschitz constant (at point
(u, p)
)
Method
This function computes a numerical approximation of the norm of the directional
derivative of gradf
along a direction h = max {delta, epsilon*u}
, where delta
and epsilon
are small numbers.
Example
let mut u: [f64; 10] = [1.0, 2.0, 3.0, -5.0, 1.0, 10.0, 14.0, 17.0, 3.0, 5.0];
let p = [1.0, -1.0];
let mut cost_value = 0.0;
let mut jac = vec![0.0; icasadi::num_decision_variables()];
let lip = icasadi::estimate_local_lipschitz_squared(&mut u, &p, &mut jac, &mut [0.0_f64; 10]);
Panics
No rust-side panics, unless the C function which is called via this interface fails.
Why squared?
We are trying to keep most crated under #![no_std]
and the square root is not
supported in no_std
mode.