holos_tda/persistent_class_artifact/
model.rs1use crate::{CriticalPair, PersistentClass, SparseDistanceMatrix};
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
6pub struct PersistenceCycleTerm {
7 pub u: usize,
9 pub v: usize,
11 pub coefficient: u32,
13}
14
15#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
17pub struct PersistenceTriangleTerm {
18 pub vertices: [usize; 3],
20 pub coefficient: u32,
22}
23
24#[derive(Debug, Clone)]
30pub struct PersistentClassArtifact {
31 pub(super) source: SparseDistanceMatrix,
32 pub(super) threshold: Option<f64>,
33 pub(super) class: PersistentClass,
34 pub(super) critical_pair: CriticalPair,
35 pub(super) cycle: Vec<PersistenceCycleTerm>,
36 pub(super) bounding_chain: Vec<PersistenceTriangleTerm>,
37}
38
39impl PersistentClassArtifact {
40 pub fn source(&self) -> &SparseDistanceMatrix {
42 &self.source
43 }
44
45 pub fn threshold(&self) -> Option<f64> {
47 self.threshold
48 }
49
50 pub fn class(&self) -> &PersistentClass {
52 &self.class
53 }
54
55 pub fn critical_pair(&self) -> &CriticalPair {
57 &self.critical_pair
58 }
59
60 pub fn cycle(&self) -> &[PersistenceCycleTerm] {
62 &self.cycle
63 }
64
65 pub fn bounding_chain(&self) -> &[PersistenceTriangleTerm] {
67 &self.bounding_chain
68 }
69}