Skip to main content

DistanceMatrix

Struct DistanceMatrix 

Source
pub struct DistanceMatrix { /* private fields */ }
Expand description

Symmetric dissimilarity matrix. No metric assumptions: entries need not satisfy the triangle inequality. Entries must be non-negative and not NaN; +inf is legal and equivalent to an absent edge.

The matrix has two storage forms. The compact form holds the condensed lower triangle, n(n-1)/2 entries, and is the form every constructor builds. The full form holds both triangles row-major, n * n entries, so that a cofacet diameter fold reads one contiguous row per simplex vertex instead of one strided column.

Implementations§

Source§

impl DistanceMatrix

Source

pub fn from_points(points: &[Vec<f64>]) -> Result<Self>

Euclidean distances of a point cloud. Coordinates must be finite.

Source

pub fn from_condensed(condensed: Vec<f64>) -> Result<Self>

Build from the condensed lower triangle, row by row: d(1,0), d(2,0), d(2,1), d(3,0), and so on. An empty vector means one point (n = 1). Only DistanceMatrix::from_points can build an empty space (n = 0).

Source§

impl DistanceMatrix

Source

pub fn len(&self) -> usize

Number of points.

Source

pub fn is_empty(&self) -> bool

True when there are no points.

Source

pub fn get(&self, i: usize, j: usize) -> f64

Distance between points i and j (0 on the diagonal).

Source

pub fn enclosing_radius(&self) -> f64

Default threshold: the minimum over i of the maximum over j of d(i, j). Past that radius the complex is a cone and acquires no further homology.

Trait Implementations§

Source§

impl Clone for DistanceMatrix

Source§

fn clone(&self) -> DistanceMatrix

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DistanceMatrix

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.