[−][src]Trait maths_traits::analysis::metric::Metric
A real-valued function on a set X
that quantifies the "distance" between objects
This is rigorously defined as a function d:X⨯X -> R
such that
d(x,y) > 0
for allx != y
d(x,x) = 0
for allx
d(x,z) <= d(x,y) + d(y,z)
for allx
,y
, andz
Implementation Note
Due to the fact that there are often many metrics for any given space and that a given
kind of metric often applies to a whole family of spaces, this trait has been written
with the intent of being implemented on type other than the set X
to which it applies.
This way, a construction can implemented only once while still having access to all applicable
metrics.
A good example of this would a struct implementing all Lp norms for a single implementation of a given ℝ3 or similar