Skip to main content

force_positive_a

Function force_positive_a 

Source
pub fn force_positive_a(
    profile: Topp3ProfileMut<'_>,
    s: &[f64],
    a_min: f64,
) -> Result<bool, CoppError>
Expand description

Post-process a mutable (a, b) profile 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

Returns CoppError::InvalidInput when dimensions, station ordering, profile positivity, stationary counts, or numeric finiteness requirements are violated.

§Contract

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