Skip to main content

s_to_t_topp3

Function s_to_t_topp3 

Source
pub fn s_to_t_topp3(
    s: &[f64],
    profile: Topp3ProfileRef<'_>,
    t0: f64,
) -> Result<(f64, Vec<f64>), CoppError>
Expand description

Compute cumulative time profile t(s) from a TOPP3/COPP3 profile.

§Semantics

  • t_s[i] is the time at station s[i].
  • initial condition is t_s[0] = t0.
  • returns (t_final, t_s) where t_final == *t_s.last().unwrap().

§Input contract

  • valid when s.len() >= 2 + profile.2.0 + profile.2.1;
  • requires profile.0.len() == s.len() and profile.1.len() == s.len();
  • all inputs must contain only finite values;
  • s must be strictly increasing.

§Returns

Returns (t_final, t_s) where t_s[i] is cumulative time at s[i].

§Errors

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

§Contract

  • t_s.len() == s.len() on valid input.
  • t_s[0] == t0 on valid input.