Skip to main content

a_to_b_topp2

Function a_to_b_topp2 

Source
pub fn a_to_b_topp2(s: &[f64], a: &[f64]) -> Vec<f64>
Expand description

Compute segment profile b from node profile a.

§Definition

For each segment [s_k, s_{k+1}], this function computes: $b_k = \frac{1}{2}\frac{a_{k+1}-a_k}{s_{k+1}-s_k}$.

§Input contract

  • valid when s.len() >= 2 and a.len() == s.len();
  • otherwise returns an empty vector.

§Returns

Returns b with b.len() == s.len() - 1.

§Errors

This function does not return Result; invalid input is mapped to empty output.

§Contract

  • Output ordering is consistent with segment ordering on s.windows(2).
  • No allocation beyond returned vector and iterator temporaries.