Class EuclideanDistance
- java.lang.Object
-
- org.apache.commons.math4.legacy.ml.distance.EuclideanDistance
-
- All Implemented Interfaces:
DistanceMeasure
public class EuclideanDistance extends Object implements DistanceMeasure
Calculates the L2 (Euclidean) distance between two points.- Since:
- 3.2
-
-
Constructor Summary
Constructors Constructor Description EuclideanDistance()
-
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
-
EuclideanDistance
public EuclideanDistance()
-
-
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
-
-