pub trait Norm<D> {
type Output: Num;
// Required method
fn norm(&self, desc: D) -> Self::Output;
}Expand description
The Norm trait is the core of the norman crate.
It provides a norm function which calculates a specific
norm of the vector.
The type D is the norm descriptor, which specifies the exact kind of norm; e.g.
a supremum norm or a euclidean norm. See the desc module
for several different norm descriptors.
Required Associated Types§
Required Methods§
Sourcefn norm(&self, desc: D) -> Self::Output
fn norm(&self, desc: D) -> Self::Output
Calculates the norm of self, specified by the descriptor desc.
§Panics
An implementation of norm should never panic.
An exception may be made for types like the noisy_float
floating point types that already have a special panicking behaviour
to ensure that no invalid values occur.
§Example
use num_complex::Complex;
use norman::Norm;
use norman::desc::Abs;
assert_eq!(Norm::norm(&Complex::new(3.0, 4.0), Abs::new()), 5.0);