Class CanberraDistance
- java.lang.Object
-
- org.apache.commons.math4.legacy.ml.distance.CanberraDistance
-
- All Implemented Interfaces:
DistanceMeasure
public class CanberraDistance extends Object implements DistanceMeasure
Calculates the Canberra distance between two points.- Since:
- 3.2
-
-
Constructor Summary
Constructors Constructor Description CanberraDistance()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
compute(double[] a, double[] b)
Compute the distance between two n-dimensional vectors.
-
-
-
Constructor Detail
-
CanberraDistance
public CanberraDistance()
-
-
Method Detail
-
compute
public double compute(double[] a, double[] b)
Compute the distance between two n-dimensional vectors.The two vectors are required to have the same dimension.
- Specified by:
compute
in interfaceDistanceMeasure
- Parameters:
a
- the first vectorb
- the second vector- Returns:
- the distance between the two vectors
-
-