de.lmu.ifi.dbs.elki.distance.distancefunction
Class WeightedSquaredEuclideanDistanceFunction

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractPrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>
      extended by de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractVectorDoubleDistanceFunction
          extended by 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
 
Constructor Summary
WeightedSquaredEuclideanDistanceFunction(double[] weights)
          Constructor.
 
Method Summary
 double doubleDistance(NumberVector<?,?> v1, NumberVector<?,?> v2)
          Provides the squared Euclidean distance between the given two vectors.
 boolean equals(Object obj)
           
 boolean isMetric()
          Is this distance function metric (in particular, does it satisfy the triangle equation?)
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractVectorDoubleDistanceFunction
distance, getDistanceFactory, getInputTypeRestriction
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractPrimitiveDistanceFunction
instantiate, isSymmetric
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.distance.distancefunction.DistanceFunction
instantiate, isSymmetric
 

Field Detail

weights

protected double[] weights
Weight array

Constructor Detail

WeightedSquaredEuclideanDistanceFunction

public WeightedSquaredEuclideanDistanceFunction(double[] weights)
Constructor.

Parameters:
weights -
Method Detail

doubleDistance

public double doubleDistance(NumberVector<?,?> v1,
                             NumberVector<?,?> v2)
Provides the squared Euclidean distance between the given two vectors.

Parameters:
v1 - first Object
v2 - 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

Release 0.4.0 (2011-09-20_1324)