Skip to main content

Module triangle

Module triangle 

Source
Expand description

Triangle helpers: cumulative ↔ incremental conversion, latest-diagonal extraction, individual age-to-age ratios.

All functions treat NaN as the unobserved sentinel and assume the input has been validated (see crate::validate).

Functions§

age_to_age
Individual age-to-age ratio C_{i, j+1} / C_{i, j}. Returns NaN where the ratio is undefined (pair unobserved or denominator ≤ 0).
cumulative_to_incremental
Convert cumulative to incremental in-place semantics: returns a new triangle-shaped Vec<f64> whose observed cells are period deltas. Cell (i, 0) is copied as-is; cell (i, j) with j > 0 is C_{i,j} − C_{i,j−1}. Unobserved cells become NaN.
incremental_to_cumulative
Convert incremental to cumulative. Mirror of cumulative_to_incremental.
latest_diagonal
Extract the latest-observed cumulative value for each origin.
link_count
Number of origins with both (i, j) and (i, j+1) observed (i.e. the count that feeds a development-j → j+1 LDF).