pub struct CoherenceMeasure {
pub alignment: f64,
pub disagreement: Vec<f64>,
pub dominant_mode: Vec<f64>,
}Expand description
Measures how well a belief assignment aligns across the sheaf.
Alignment = 1 - ||L_F x|| / ||x|| (higher = more coherent). Per-edge disagreement = ||F_{ij} x_i - F_{ij} x_j|| where F_{ij} is the restriction map. Dominant mode = eigenvector of the smallest nonzero eigenvalue (most coherent non-trivial pattern).
Fields§
§alignment: f64Overall alignment score: 1 - ||L_F x|| / ||x||.
disagreement: Vec<f64>Per-edge disagreement values.
dominant_mode: Vec<f64>Eigenvector of smallest nonzero eigenvalue.
Implementations§
Source§impl CoherenceMeasure
impl CoherenceMeasure
Sourcepub fn from_flat(
sheaf: &CellularSheaf,
x: &[f64],
max_iter: usize,
tol: f64,
) -> Result<Self, SheafError>
pub fn from_flat( sheaf: &CellularSheaf, x: &[f64], max_iter: usize, tol: f64, ) -> Result<Self, SheafError>
Compute coherence measures for a flat belief vector.
Sourcepub fn from_values(
sheaf: &CellularSheaf,
values: &[Vec<f64>],
max_iter: usize,
tol: f64,
) -> Result<Self, SheafError>
pub fn from_values( sheaf: &CellularSheaf, values: &[Vec<f64>], max_iter: usize, tol: f64, ) -> Result<Self, SheafError>
Compute coherence from per-node values.
Sourcepub fn is_aligned(&self, threshold: f64) -> bool
pub fn is_aligned(&self, threshold: f64) -> bool
True if alignment is above a threshold.
Sourcepub fn avg_disagreement(&self) -> f64
pub fn avg_disagreement(&self) -> f64
Average per-edge disagreement.
Sourcepub fn max_disagreement(&self) -> f64
pub fn max_disagreement(&self) -> f64
Maximum per-edge disagreement.
Trait Implementations§
Source§impl Clone for CoherenceMeasure
impl Clone for CoherenceMeasure
Source§fn clone(&self) -> CoherenceMeasure
fn clone(&self) -> CoherenceMeasure
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 CoherenceMeasure
impl Debug for CoherenceMeasure
Source§impl<'de> Deserialize<'de> for CoherenceMeasure
impl<'de> Deserialize<'de> for CoherenceMeasure
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 CoherenceMeasure
impl RefUnwindSafe for CoherenceMeasure
impl Send for CoherenceMeasure
impl Sync for CoherenceMeasure
impl Unpin for CoherenceMeasure
impl UnsafeUnpin for CoherenceMeasure
impl UnwindSafe for CoherenceMeasure
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