Click or drag to resize
Accord.NET (logo)

Minkowski Structure

The Minkowski distance is a metric in a normed vector space which can be considered as a generalization of both the Euclidean distance and the Manhattan distance.

Namespace:  Accord.Math.Distances
Assembly:  Accord.Math (in Accord.Math.dll) Version: 3.8.0
Syntax
[SerializableAttribute]
public struct Minkowski : IMetric<double[]>, 
	IDistance<double[]>, IDistance<double[], double[]>, 
	IMetric<int[]>, IDistance<int[]>, IDistance<int[], int[]>
Request Example View Source

The Minkowski type exposes the following members.

Constructors
  NameDescription
Public methodMinkowski
Initializes a new instance of the Minkowski class.
Top
Properties
  NameDescription
Public propertyOrder
Gets the order p of this Minkowski distance.
Top
Methods
  NameDescription
Public methodDistance(Double, Double)
Computes the distance d(x,y) between points x and y.
Public methodDistance(Int32, Int32)
Computes the distance d(x,y) between points x and y.
Public methodEquals
Indicates whether this instance and a specified object are equal.
(Inherited from ValueType.)
Public methodGetHashCode
Returns the hash code for this instance.
(Inherited from ValueType.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic memberNonmetric
Creates a non-metric Minkowski distance, bypassing argument checking. Use at your own risk.
Public methodToString
Returns the fully qualified type name of this instance.
(Inherited from ValueType.)
Top
Fields
  NameDescription
Public fieldStatic memberEuclidean
Gets the Euclidean distance as a special case of the Minkowski distance.
Public fieldStatic memberManhattan
Gets the Manhattan distance as a special case of the Minkowski distance.
Top
Extension Methods
  NameDescription
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodTo(Type)Overloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Public Extension MethodToTOverloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
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 possible to bypass this mechanism by using the named constructors such as Nonmetric(Double) to create distances implementing the IMetricT interface that are not really metrics. Use at your own risk.

See Also