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

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.LPNormDistanceFunction
              extended by de.lmu.ifi.dbs.elki.distance.distancefunction.EuclideanDistanceFunction
All Implemented Interfaces:
DistanceFunction<NumberVector<?,?>,DoubleDistance>, PrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>, PrimitiveDoubleDistanceFunction<NumberVector<?,?>>, SpatialPrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>, SpatialPrimitiveDoubleDistanceFunction<NumberVector<?,?>>, InspectionUtilFrequentlyScanned, Parameterizable

public class EuclideanDistanceFunction
extends LPNormDistanceFunction
implements SpatialPrimitiveDoubleDistanceFunction<NumberVector<?,?>>

Provides the Euclidean distance for FeatureVectors.


Nested Class Summary
static class EuclideanDistanceFunction.Parameterizer
          Parameterization class.
 
Field Summary
static EuclideanDistanceFunction STATIC
          Static instance.
 
Fields inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.LPNormDistanceFunction
P_ID
 
Constructor Summary
EuclideanDistanceFunction()
          Deprecated. Use static instance!
 
Method Summary
 DoubleDistance centerDistance(SpatialComparable mbr1, SpatialComparable mbr2)
          Computes the distance between the centroids of the two given MBRs according to this distance function.
 double doubleCenterDistance(SpatialComparable mbr1, SpatialComparable mbr2)
          Computes the distance between the centroids of the two given MBRs according to this distance function.
 double doubleDistance(NumberVector<?,?> v1, NumberVector<?,?> v2)
          Provides the Euclidean distance between the given two vectors.
 double doubleMinDist(SpatialComparable mbr1, SpatialComparable mbr2)
          Computes the distance between the two given MBRs according to this distance function.
protected  double doubleMinDistObject(SpatialComparable mbr, NumberVector<?,?> v)
           
 boolean equals(Object obj)
           
<T extends NumberVector<?,?>>
SpatialPrimitiveDistanceQuery<T,DoubleDistance>
instantiate(Relation<T> relation)
          Instantiate with a database to get the actual distance query.
 boolean isMetric()
          Is this distance function metric (in particular, does it satisfy the triangle equation?)
 DoubleDistance minDist(SpatialComparable mbr1, SpatialComparable mbr2)
          Computes the distance between the two given MBRs according to this distance function.
 String toString()
           
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.LPNormDistanceFunction
getP
 
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
isSymmetric
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.distance.distancefunction.PrimitiveDistanceFunction
distance, getInputTypeRestriction
 
Methods inherited from interface de.lmu.ifi.dbs.elki.distance.distancefunction.DistanceFunction
getDistanceFactory, isSymmetric
 

Field Detail

STATIC

public static final EuclideanDistanceFunction STATIC
Static instance. Use this!

Constructor Detail

EuclideanDistanceFunction

@Deprecated
public EuclideanDistanceFunction()
Deprecated. Use static instance!

Provides a Euclidean distance function that can compute the Euclidean distance (that is a DoubleDistance) for FeatureVectors.

Method Detail

doubleDistance

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

Specified by:
doubleDistance in interface PrimitiveDoubleDistanceFunction<NumberVector<?,?>>
Overrides:
doubleDistance in class LPNormDistanceFunction
Parameters:
v1 - first FeatureVector
v2 - second FeatureVector
Returns:
the Euclidean distance between the given two vectors as raw double value

doubleMinDistObject

protected double doubleMinDistObject(SpatialComparable mbr,
                                     NumberVector<?,?> v)

doubleMinDist

public double doubleMinDist(SpatialComparable mbr1,
                            SpatialComparable mbr2)
Description copied from interface: SpatialPrimitiveDoubleDistanceFunction
Computes the distance between the two given MBRs according to this distance function.

Specified by:
doubleMinDist in interface SpatialPrimitiveDoubleDistanceFunction<NumberVector<?,?>>
Parameters:
mbr1 - the first MBR object
mbr2 - the second MBR object
Returns:
the distance between the two given MBRs according to this distance function

centerDistance

public DoubleDistance centerDistance(SpatialComparable mbr1,
                                     SpatialComparable mbr2)
Description copied from interface: SpatialPrimitiveDistanceFunction
Computes the distance between the centroids of the two given MBRs according to this distance function.

Specified by:
centerDistance in interface SpatialPrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>
Parameters:
mbr1 - the first MBR object
mbr2 - the second MBR object
Returns:
the distance between the centroids of the two given MBRs according to this distance function

minDist

public DoubleDistance minDist(SpatialComparable mbr1,
                              SpatialComparable mbr2)
Description copied from interface: SpatialPrimitiveDistanceFunction
Computes the distance between the two given MBRs according to this distance function.

Specified by:
minDist in interface SpatialPrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>
Parameters:
mbr1 - the first MBR object
mbr2 - the second MBR object
Returns:
the distance between the two given MBRs according to this distance function

doubleCenterDistance

public double doubleCenterDistance(SpatialComparable mbr1,
                                   SpatialComparable mbr2)
Description copied from interface: SpatialPrimitiveDoubleDistanceFunction
Computes the distance between the centroids of the two given MBRs according to this distance function.

Specified by:
doubleCenterDistance in interface SpatialPrimitiveDoubleDistanceFunction<NumberVector<?,?>>
Parameters:
mbr1 - the first MBR object
mbr2 - the second MBR object
Returns:
the distance between the centroids of the two given MBRs according to this distance function

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 LPNormDistanceFunction
Returns:
true when metric.

instantiate

public <T extends NumberVector<?,?>> SpatialPrimitiveDistanceQuery<T,DoubleDistance> instantiate(Relation<T> relation)
Description copied from class: AbstractPrimitiveDistanceFunction
Instantiate with a database to get the actual distance query.

Specified by:
instantiate in interface DistanceFunction<NumberVector<?,?>,DoubleDistance>
Specified by:
instantiate in interface SpatialPrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>
Overrides:
instantiate in class AbstractPrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>
Parameters:
relation - Representation
Returns:
Actual distance query.

toString

public String toString()
Overrides:
toString in class LPNormDistanceFunction

equals

public boolean equals(Object obj)
Overrides:
equals in class LPNormDistanceFunction

Release 0.4.0 (2011-09-20_1324)