Top Description Fields Constructors Methods
org.apache.commons.math3.ml.distance

public Class CanberraDistance

extends Object
implements DistanceMeasure
Class Inheritance
All Implemented Interfaces
org.apache.commons.math3.ml.distance.DistanceMeasure, java.io.Serializable
Imports
org.apache.commons.math3.exception.DimensionMismatchException, org.apache.commons.math3.util.FastMath, .MathArrays

Calculates the Canberra distance between two points.
Since
3.2

Field Summary

Modifier and TypeField and Description
private static final long
serialVersionUID

Serializable version identifier.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public double
compute(double[]
the first vector
a
,
double[]
the second vector
b
)

Implements org.apache.commons.math3.ml.distance.DistanceMeasure.compute.

Compute the distance between two n-dimensional vectors.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Serializable version identifier.

Constructor Detail

CanberraDistanceback to summary
public CanberraDistance()

Method Detail

computeback to summary
public double compute(double[] a, double[] b) throws DimensionMismatchException

Implements org.apache.commons.math3.ml.distance.DistanceMeasure.compute.

Doc from org.apache.commons.math3.ml.distance.DistanceMeasure.compute.

Compute the distance between two n-dimensional vectors.

The two vectors are required to have the same dimension.

Parameters
a:double[]

the first vector

b:double[]

the second vector

Returns:double

the distance between the two vectors

Exceptions
DimensionMismatchException:
if the array lengths differ.