Trait runa::math::MetricSpace
source · [−]pub trait MetricSpace {
type Item: Copy + Display;
type Cost: Ord + Add<Output = Self::Cost> + Copy + Debug;
const ZEROCOST: Self::Cost;
const INFCOST: Self::Cost;
const GAP: Self::Item;
const DEL: Self::Cost;
const INS: Self::Cost;
fn sub(a: Self::Item, b: Self::Item) -> Self::Cost;
}
Expand description
A structure meant to be passed as a generic parameter to other functions. it is meant to ensapsulate all the information related to
- the types used (notice that the types might be anything, you could for example have sequences of strings, all you have to do is to define a MetricSpace and the rest of the code is guaranteed to work),
- the distance constants
- the usual values for zero and infinity. This makes it possible to use multiple MetricSpaces at once in the same program and makes the distance functions reusable with a large variety of sequence types.