de.lmu.ifi.dbs.elki.distance.distancefunction
Class WeightedSquaredEuclideanDistanceFunction
java.lang.Object
de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractPrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>
de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractVectorDoubleDistanceFunction
de.lmu.ifi.dbs.elki.distance.distancefunction.WeightedSquaredEuclideanDistanceFunction
- All Implemented Interfaces:
- DistanceFunction<NumberVector<?,?>,DoubleDistance>, PrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>, PrimitiveDoubleDistanceFunction<NumberVector<?,?>>, InspectionUtilFrequentlyScanned, Parameterizable
public class WeightedSquaredEuclideanDistanceFunction
- extends AbstractVectorDoubleDistanceFunction
Provides the squared Euclidean distance for FeatureVectors. This results in
the same rankings, but saves computing the square root as often.
Field Summary |
protected double[] |
weights
Weight array |
weights
protected double[] weights
- Weight array
WeightedSquaredEuclideanDistanceFunction
public WeightedSquaredEuclideanDistanceFunction(double[] weights)
- Constructor.
- Parameters:
weights
-
doubleDistance
public double doubleDistance(NumberVector<?,?> v1,
NumberVector<?,?> v2)
- Provides the squared Euclidean distance between the given two vectors.
- Parameters:
v1
- first Objectv2
- second Object
- Returns:
- the squared Euclidean distance between the given two vectors as raw
double value
isMetric
public boolean isMetric()
- Description copied from interface:
DistanceFunction
- Is this distance function metric (in particular, does it satisfy the
triangle equation?)
- Specified by:
isMetric
in interface DistanceFunction<NumberVector<?,?>,DoubleDistance>
- Overrides:
isMetric
in class AbstractPrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>
- Returns:
true
when metric.
equals
public boolean equals(Object obj)
- Overrides:
equals
in class Object