pub struct PersistenceDiagram {
pub points: Vec<(f64, f64)>,
pub betti_numbers: Vec<usize>,
}Expand description
A persistence diagram: collection of (birth, death) pairs and the resulting Betti numbers.
Fields§
§points: Vec<(f64, f64)>(birth, death) pairs for each feature.
betti_numbers: Vec<usize>Betti numbers β₀, β₁, β₂, … (connected components, cycles, voids, …).
Implementations§
Source§impl PersistenceDiagram
impl PersistenceDiagram
Sourcepub fn from_distance_matrix(dist: &[f64], n: usize) -> Self
pub fn from_distance_matrix(dist: &[f64], n: usize) -> Self
Build a persistence diagram from a distance/similarity matrix.
Uses a Vietoris-Rips filtration approach.
dist is a flattened n×n distance matrix (row-major).
n is the number of points.
Sourcepub fn from_ndarray_matrix(mat: &Array2<f64>) -> Self
pub fn from_ndarray_matrix(mat: &Array2<f64>) -> Self
Build from an n×n ndarray distance matrix.
Sourcepub fn persistent_features(&self) -> Vec<(f64, f64)>
pub fn persistent_features(&self) -> Vec<(f64, f64)>
All persistence pairs where the feature survived (death > birth).
Sourcepub fn total_persistence(&self, p: f64) -> f64
pub fn total_persistence(&self, p: f64) -> f64
Total persistence: Σ |d - b|^p for each feature.
Trait Implementations§
Source§impl Clone for PersistenceDiagram
impl Clone for PersistenceDiagram
Source§fn clone(&self) -> PersistenceDiagram
fn clone(&self) -> PersistenceDiagram
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PersistenceDiagram
impl Debug for PersistenceDiagram
Source§impl<'de> Deserialize<'de> for PersistenceDiagram
impl<'de> Deserialize<'de> for PersistenceDiagram
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PersistenceDiagram
impl RefUnwindSafe for PersistenceDiagram
impl Send for PersistenceDiagram
impl Sync for PersistenceDiagram
impl Unpin for PersistenceDiagram
impl UnsafeUnpin for PersistenceDiagram
impl UnwindSafe for PersistenceDiagram
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more