Skip to content

Releases: maksym-arutyunyan/big_o

v0.1.4

21 Oct 14:25
9d8eeaa
Compare
Choose a tag to compare
  • add custom errors

v0.1.3

20 Sep 11:37
5fb288d
Compare
Choose a tag to compare
  • fix fitting the best complexity by re-calculating delinearized residuals

v0.1.2

04 Jul 07:26
7101503
Compare
Choose a tag to compare
  • add complexity rank, that allows to compare complexities one to another

Examples

Performance of O(n) is better than O(n^3)

use big_o::{complexity, Name::Linear, Name::Cubic};

let linear = complexity("O(n)").unwrap();
assert_eq!(linear.name, Linear);

let cubic = complexity("O(n^3)").unwrap();
assert_eq!(cubic.name, Cubic);

assert!(linear.rank < cubic.rank);

Expect the result to be not worse than O(n^2)

// 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!(complexity.rank <= big_o::complexity("O(n^2)").unwrap().rank);

v0.1.1

02 Jul 14:14
075267c
Compare
Choose a tag to compare
  • update docs, minor cleanups

v0.1.0, initial release

16 Jun 14:48
b57dbdb
Compare
Choose a tag to compare

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);