pub struct MorseComplex {
pub critical_points: Vec<(Vec<f64>, f64)>,
}Expand description
A Morse complex built from a collection of critical points of a Morse function.
Each critical point is stored as (coordinates, function_value).
Fields§
§critical_points: Vec<(Vec<f64>, f64)>Critical points: (position_coords, function_value).
Implementations§
Source§impl MorseComplex
impl MorseComplex
Sourcepub fn new(critical_points: Vec<(Vec<f64>, f64)>) -> Self
pub fn new(critical_points: Vec<(Vec<f64>, f64)>) -> Self
Create a new MorseComplex with the given critical points.
Sourcepub fn morse_index(&self, pt: &[f64]) -> usize
pub fn morse_index(&self, pt: &[f64]) -> usize
Compute the Morse index of a critical point by finite-difference Hessian.
The Morse index is the number of negative eigenvalues of the Hessian. This implementation approximates the Hessian via the ordering of surrounding critical points.
Sourcepub fn gradient_flow(&self) -> Vec<&(Vec<f64>, f64)>
pub fn gradient_flow(&self) -> Vec<&(Vec<f64>, f64)>
Simulate gradient flow: sort critical points by function value.
Returns the critical points in ascending order of function value, representing the flow from minima to maxima.
Sourcepub fn pair_critical_points(&self) -> Vec<(usize, usize)>
pub fn pair_critical_points(&self) -> Vec<(usize, usize)>
Pair critical points using Morse cancellation heuristic.
Returns pairs (min_idx, max_idx) of critical points that can be
cancelled (adjacent in function value with index difference 1).
Trait Implementations§
Source§impl Clone for MorseComplex
impl Clone for MorseComplex
Source§fn clone(&self) -> MorseComplex
fn clone(&self) -> MorseComplex
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for MorseComplex
impl RefUnwindSafe for MorseComplex
impl Send for MorseComplex
impl Sync for MorseComplex
impl Unpin for MorseComplex
impl UnsafeUnpin for MorseComplex
impl UnwindSafe for MorseComplex
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.