Interface IDistance<TFirst, TSecond>
Namespace: Mars.Numerics.Distances.Base
Assembly: Mars.Numerics.dll
Syntax
public interface IDistance<in TFirst, in TSecond>
Type Parameters
Name | Description |
---|---|
TFirst | The type of the first element to be compared. |
TSecond | The type of the second element to be compared. |
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 method, to create distances implementing the IMetric<T> interface that are not really metrics. Use at your own risk.
Methods
| Improve this Doc View SourceDistance(TFirst, TSecond)
d(x,y)
between points
x
and y
.
Declaration
double Distance(TFirst x, TSecond y)
Parameters
Type | Name | Description |
---|---|---|
TFirst | x | The first point x . |
TSecond | y | The second point y . |
Returns
Type | Description |
---|---|
System.Double |
A double-precision value representing the distance d(x,y)
between x and y according
to the distance function implemented by this class.
|
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 method, to create distances implementing the IMetric<T> interface that are not really metrics. Use at your own risk.