Skip to main content

force_positive_a

Function force_positive_a 

Source
pub fn force_positive_a(
    a: &mut [f64],
    b: &mut [f64],
    s: &[f64],
    num_stationary: (usize, usize),
    a_min: f64,
) -> bool
Expand description

Post-process (a, b) so that interpolated a(s) stays strictly positive per interval.

This is a numerical safety utility for downstream timing integration on profiles that may be very close to zero due to finite precision.

§Returns

Returns true when in-place adjustment succeeds, otherwise false.

§Errors

This function does not return Result; invalid inputs are reported by false with diagnostic prints.

§Contract

  • requires a.len() == b.len() == s.len() and s.len() >= 4;
  • requires endpoint a values to be nonnegative.