Click or drag to resize
Accord.NET (logo)

IDistanceT, U Interface

Common interface for distance functions (not necessarily metrics).

Namespace:  Accord.Math.Distances
Assembly:  Accord.Math (in Accord.Math.dll) Version: 3.8.0
Syntax
public interface IDistance<in T, in U>

Type Parameters

T
The type of the first element to be compared.
U
The type of the second element to be compared.

The IDistanceT, U type exposes the following members.

Methods
  NameDescription
Public methodDistance
Computes the distance d(x,y) between points x and y.
Top
Remarks

The framework distinguishes between metrics and distances by using different types for them. This makes it possible to let the compiler figure out logic problems such as the specification of a non-metric for a method that requires a proper metric (i.e. that respects the triangle inequality).

The objective of this technique is to make it harder to make some mistakes. However, it is generally possible to bypass this mechanism by using named constructors available at each of the classes, such as Minkowski's Nonmetric(Double) method, to create distances implementing the IMetricT interface that are not really metrics. Use at your own risk.

See Also