Expand description

The norm module

This module contains implementations of various linear algebra norms. The implementations are contained within the VectorNorm and MatrixNorm traits. This module also contains VectorMetric and MatrixMetric traits which are used to compute the metric distance.

These traits can be used directly by importing implementors from this module. In most cases it will be easier to use the norm and metric functions which exist for both vectors and matrices. These functions take generic arguments for the norm to be used.

In general you should use the least generic norm that fits your purpose. For example you would choose to use a Euclidean norm instead of an Lp(2.0) norm - despite them being mathematically equivalent.

Defining your own norm

Note that these traits enforce no requirements on the norm. It is up to the user to ensure that they define a norm correctly.

To define your own norm you need to implement the MatrixNorm and/or the VectorNorm on your own struct. When you have defined a norm you get the induced metric for free. This means that any object which implements the VectorNorm or MatrixNorm will automatically implement the VectorMetric and MatrixMetric traits respectively. This induced metric will compute the norm of the difference between the vectors or matrices.

Structs

The Euclidean norm

Enums

The Lp norm

Traits

Trait for matrix metrics.
Trait for matrix norms.
Trait for vector metrics.
Trait for vector norms