Catalano.Math.Distances
Class MinkowskiDistance
- java.lang.Object
-
- Catalano.Math.Distances.MinkowskiDistance
-
- All Implemented Interfaces:
- IDistance<double[]>, IDivergence<double[]>, java.io.Serializable
public class MinkowskiDistance extends java.lang.Object implements IDistance<double[]>
Minkowski distance. 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.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description MinkowskiDistance()Initializes a new instance of the MinkowskiDistance class.MinkowskiDistance(double p)Initializes a new instance of the MinkowskiDistance class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doubleCompute(double[] u, double[] v)Compute the distance between the vectors.doublegetOrder()Get the order of the distance.voidsetOrder(double p)Set the order of the distance.
-
-
-
Constructor Detail
-
MinkowskiDistance
public MinkowskiDistance()
Initializes a new instance of the MinkowskiDistance class. p = 1 (default).
-
MinkowskiDistance
public MinkowskiDistance(double p)
Initializes a new instance of the MinkowskiDistance class.- Parameters:
p- Order.
-
-
Method Detail
-
getOrder
public double getOrder()
Get the order of the distance.- Returns:
- Order.
-
setOrder
public void setOrder(double p)
Set the order of the distance.- Parameters:
p- Order.
-
Compute
public double Compute(double[] u, double[] v)Description copied from interface:IDivergenceCompute the distance between the vectors.- Specified by:
Computein interfaceIDistance<double[]>- Specified by:
Computein interfaceIDivergence<double[]>- Parameters:
u- Vector.v- Vector.- Returns:
- Distance.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG