Class Minkowski
Inheritance
Implements
Inherited Members
Namespace: Mars.Numerics.Distances
Assembly: Mars.Numerics.dll
Syntax
[Serializable]
public class Minkowski : IMetric<double[]>, IDistance<double[]>, IDistance<double[], double[]>, IMetric<int[]>, IDistance<int[]>, IDistance<int[], int[]>, ICloneable
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 possible to bypass this mechanism by using the named constructors such as Nonmetric(Double) to create distances implementing the IMetric<T> interface that are not really metrics. Use at your own risk.
Constructors
| Improve this Doc View SourceMinkowski(Double)
Declaration
public Minkowski(double p)
Parameters
Type | Name | Description |
---|---|---|
System.Double | p | The Minkowski order p . |
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 possible to bypass this mechanism by using the named constructors such as Nonmetric(Double) to create distances implementing the IMetric<T> interface that are not really metrics. Use at your own risk.
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | The Minkowski distance is not a metric for p < 1. |
Fields
| Improve this Doc View SourceEuclidean
Declaration
public static readonly Minkowski Euclidean
Field Value
Type | Description |
---|---|
Minkowski |
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 possible to bypass this mechanism by using the named constructors such as Nonmetric(Double) to create distances implementing the IMetric<T> interface that are not really metrics. Use at your own risk.
Manhattan
Declaration
public static readonly Minkowski Manhattan
Field Value
Type | Description |
---|---|
Minkowski |
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 possible to bypass this mechanism by using the named constructors such as Nonmetric(Double) to create distances implementing the IMetric<T> interface that are not really metrics. Use at your own risk.
Properties
| Improve this Doc View SourceOrder
p
of this Minkowski distance.
Declaration
public double Order { get; }
Property Value
Type | Description |
---|---|
System.Double |
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 possible to bypass this mechanism by using the named constructors such as Nonmetric(Double) to create distances implementing the IMetric<T> interface that are not really metrics. Use at your own risk.
Methods
| Improve this Doc View SourceClone()
Declaration
public object Clone()
Returns
Type | Description |
---|---|
System.Object | A new object that is a copy of this instance. |
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 possible to bypass this mechanism by using the named constructors such as Nonmetric(Double) to create distances implementing the IMetric<T> interface that are not really metrics. Use at your own risk.
Distance(Double[], Double[])
d(x,y)
between points
x
and y
.
Declaration
public double Distance(double[] x, double[] y)
Parameters
Type | Name | Description |
---|---|---|
System.Double[] | x | The first point x . |
System.Double[] | 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 possible to bypass this mechanism by using the named constructors such as Nonmetric(Double) to create distances implementing the IMetric<T> interface that are not really metrics. Use at your own risk.
Distance(Int32[], Int32[])
d(x,y)
between points
x
and y
.
Declaration
public double Distance(int[] x, int[] y)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | x | The first point x . |
System.Int32[] | 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 possible to bypass this mechanism by using the named constructors such as Nonmetric(Double) to create distances implementing the IMetric<T> interface that are not really metrics. Use at your own risk.
Nonmetric(Double)
Declaration
public static Minkowski Nonmetric(double p)
Parameters
Type | Name | Description |
---|---|---|
System.Double | p | The Minkowski order p . |
Returns
Type | Description |
---|---|
Minkowski | A Minkowski object implementing a Minkowski distance that is not necessarily a metric. Use at your own risk. |
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 possible to bypass this mechanism by using the named constructors such as Nonmetric(Double) to create distances implementing the IMetric<T> interface that are not really metrics. Use at your own risk.