bfgs 0.1.0

A pure Rust implementation of the BFGS optimization algorithm
Documentation
  • Coverage
  • 100%
    2 out of 2 items documented1 out of 2 items with examples
  • Size
  • Source code size: 13.57 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.27 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 23s Average build duration of successful builds.
  • all releases: 23s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Documentation
  • paulkernfeld/bfgs
    21 4 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • paulkernfeld

bfgs

This package contains an implementation of BFGS, an algorithm for minimizing convex twice-differentiable functions.

In this example, we minimize a 2d function:

extern crate bfgs;
extern crate ndarray;

use ndarray::prelude::*;

fn main() {
    let x0 = Array::from_vec(vec![8.888, 1.234]);  // Chosen arbitrarily
    let f = |x: &Array1<f64>| x.dot(x);
    let g = |x: &Array1<f64>| 2.0 * x;
    let x_min = bfgs::bfgs(x0, f, g);
    assert_eq!(x_min, Ok(Array::from_vec(vec![0.0, 0.0])));
}

License: MIT/Apache-2.0