Expand description

Find a satisfactory step length along predefined search direction

Example

use liblbfgs::math::LbfgsMath;
use liblbfgs::Problem;
use liblbfgs::default_evaluate;
use liblbfgs::line::LineSearch;
 
const N: usize = 100;
let mut x = [0.0; N];
for i in (0..N).step_by(2) {
    x[i] = -1.2;
    x[i + 1] = 1.0;
}
 
// construct problem
let mut prb = Problem::new(&mut x, default_evaluate(), None);
prb.evaluate();
// construct initial search direction
prb.update_search_direction();
// Compute the initial step
let mut step = 1.0/prb.search_direction().vec2norm();
 
let ls = LineSearch::default();
let ncall = ls.find(&mut prb, &mut step).expect("line search");

Structs

Enums

Line search algorithms.

Functions

prb holds input variables x, gradient gx arrays, and function value fx. on input it must contain the base point for the line search. on output it contains data on x + stp*d.