pub enum Lp<T: Float> {
    Infinity,
    Integer(i32),
    Float(T),
}
Expand description

The Lp norm

The Lp norm computes the pth root of the sum of elements to the pth power.

The Lp norm requires p to be greater than or equal 1.

We use an enum for this norm to allow us to explicitly handle special cases at compile time. For example, we have an Infinity variant which handles the special case when the Lp norm is a supremum over absolute values. The Integer variant gives us a performance boost when p is an integer.

You should avoid matching directly against this enum as it is likely to grow.

Variants

Infinity

The L-infinity norm (supremum)

Integer(i32)

The Lp norm where p is an integer

Float(T)

The Lp norm where p is a float

Trait Implementations

Formats the value using the given formatter. Read more
Computes the matrix norm.
Computes the vector norm.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Computes the metric distance between two vectors.