Skip to content

v0.1.0, initial release

Compare
Choose a tag to compare
@maksym-arutyunyan maksym-arutyunyan released this 16 Jun 14:48
· 7 commits to main since this release
b57dbdb

big_o infers asymptotic computational complexity

Example

use assert_approx_eq::assert_approx_eq;

// f(x) = gain * x ^ 2 + offset
let data = vec![(1., 1.), (2., 4.), (3., 9.), (4., 16.)];

let (complexity, _all) = big_o::infer_complexity(data).unwrap();

assert_eq!(complexity.name, big_o::Name::Quadratic);
assert_eq!(complexity.notation, "O(n^2)");
assert_approx_eq!(complexity.params.gain.unwrap(), 1.0, 1e-6);
assert_approx_eq!(complexity.params.offset.unwrap(), 0.0, 1e-6);