Class DistanceMeasure.ApacheDistanceMeasure<T extends org.apache.commons.math3.ml.clustering.Clusterable>
java.lang.Object
org.moeaframework.util.clustering.DistanceMeasure.ApacheDistanceMeasure<T>
- Type Parameters:
T
- the type, which must beClusterable
- All Implemented Interfaces:
Serializable
,org.apache.commons.math3.ml.distance.DistanceMeasure
,DistanceMeasure<T>
- Enclosing interface:
- DistanceMeasure<T>
public static class DistanceMeasure.ApacheDistanceMeasure<T extends org.apache.commons.math3.ml.clustering.Clusterable>
extends Object
implements DistanceMeasure<T>, org.apache.commons.math3.ml.distance.DistanceMeasure
Wraps one of the Apache Commons Math distance measures to be compatible with our generic distance measure.
Computed distances are also cached / memoized.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.moeaframework.util.clustering.DistanceMeasure
DistanceMeasure.ApacheDistanceMeasure<T extends org.apache.commons.math3.ml.clustering.Clusterable>
-
Constructor Summary
ConstructorDescriptionApacheDistanceMeasure
(org.apache.commons.math3.ml.distance.DistanceMeasure measure) Constructs a new distance measure implemented by Apache Commons Math. -
Method Summary
-
Constructor Details
-
ApacheDistanceMeasure
public ApacheDistanceMeasure(org.apache.commons.math3.ml.distance.DistanceMeasure measure) Constructs a new distance measure implemented by Apache Commons Math.- Parameters:
measure
- the underlying distance measure
-
-
Method Details
-
compute
public double compute(double[] first, double[] second) - Specified by:
compute
in interfaceorg.apache.commons.math3.ml.distance.DistanceMeasure
-
compute
Description copied from interface:DistanceMeasure
Returns the distance between the two objects.- Specified by:
compute
in interfaceDistanceMeasure<T extends org.apache.commons.math3.ml.clustering.Clusterable>
- Parameters:
first
- the first objectsecond
- the second object- Returns:
- the distance
-