Skip to main content

s_to_t_topp2

Function s_to_t_topp2 

Source
pub fn s_to_t_topp2(
    s: &[f64],
    a: &[f64],
    t0: f64,
) -> Result<(f64, Vec<f64>), CoppError>
Expand description

Compute cumulative time profile t(s) from a(s).

§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 and a.len() == s.len();
  • s, a, and t0 must contain only finite values;
  • s must be strictly increasing;
  • each interval must have finite positive speed denominator.

§Returns

Returns (t_final, t_s) with t_s.len() == s.len() on valid input.

§Errors

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

§Contract

  • t_s is monotonically increasing when a is nonnegative and s is increasing.
  • t_s[0] == t0 always holds on valid input.