cocycle 0.1.1

Topological data analysis in pure Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Hereditary insertion-radius constraint on candidate simplices.

pub(super) fn factor(epsilon: f64) -> f64 {
    if epsilon < 1.0 {
        epsilon * (1.0 - epsilon) / 2.0
    } else {
        0.0
    }
}
pub(super) fn allows(value: f64, factor: f64, radii: impl Iterator<Item = Option<f64>>) -> bool {
    // All products are finite: factor <= 1/8, value is a validated edge value.
    // Keep this multiplication order identical for edges and higher simplices.
    let threshold = value * factor;
    radii
        .into_iter()
        .all(|radius| radius.is_none_or(|r| r >= threshold))
}