Class CanberraDistance
- java.lang.Object
-
- org.hipparchus.clustering.distance.CanberraDistance
-
- All Implemented Interfaces:
Serializable
,DistanceMeasure
public class CanberraDistance extends Object implements DistanceMeasure
Calculates the Canberra distance between two points.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CanberraDistance()
Empty constructor.
-
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.
-
-
-
Method Detail
-
compute
public double compute(double[] a, double[] b) throws MathIllegalArgumentException
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
- Throws:
MathIllegalArgumentException
- if the array lengths differ.
-
-