assert_monotone

Macro assert_monotone 

Source
macro_rules! assert_monotone {
    ($fit:expr $(, $msg:literal $(, $($args:tt),*)?)?) => { ... };
}
Expand description

Asserts that the derivative of a fitted curve does not change sign over its x-range, indicating monotonicity. This means the function always increases or always decreases.

§Parameters

  • $fit: CurveFit or Polynomal object to test.

§Panics

Panics if derivative changes sign anywhere in the x-range.

§Example

let fit = MonomialFit::new(&[(0.0, 0.0), (1.0, 1.0)], 1).unwrap();
assert_monotone!(fit);