de.lmu.ifi.dbs.elki.distance.distancefunction.subspace
Class DimensionsSelectingEuclideanDistanceFunction

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractPrimitiveDistanceFunction<V,DoubleDistance>
      extended by de.lmu.ifi.dbs.elki.distance.distancefunction.subspace.AbstractDimensionsSelectingDoubleDistanceFunction<NumberVector<?,?>>
          extended by de.lmu.ifi.dbs.elki.distance.distancefunction.subspace.DimensionsSelectingEuclideanDistanceFunction
All Implemented Interfaces:
DistanceFunction<NumberVector<?,?>,DoubleDistance>, PrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>, PrimitiveDoubleDistanceFunction<NumberVector<?,?>>, SpatialPrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>, SpatialPrimitiveDoubleDistanceFunction<NumberVector<?,?>>, InspectionUtilFrequentlyScanned, Parameterizable

public class DimensionsSelectingEuclideanDistanceFunction
extends AbstractDimensionsSelectingDoubleDistanceFunction<NumberVector<?,?>>
implements SpatialPrimitiveDoubleDistanceFunction<NumberVector<?,?>>

Provides a distance function that computes the Euclidean distance between feature vectors only in specified dimensions.


Nested Class Summary
static class DimensionsSelectingEuclideanDistanceFunction.Parameterizer
          Parameterization class.
 
Field Summary
 
Fields inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.subspace.AbstractDimensionsSelectingDoubleDistanceFunction
DIMS_ID
 
Constructor Summary
DimensionsSelectingEuclideanDistanceFunction(BitSet dimensions)
          Constructor.
 
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 two given feature vectors in the selected dimensions.
 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)
           
 VectorFieldTypeInformation<? super NumberVector<?,?>> getInputTypeRestriction()
          Get the input data type of the function.
<T extends NumberVector<?,?>>
SpatialPrimitiveDistanceQuery<T,DoubleDistance>
instantiate(Relation<T> database)
          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.
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.subspace.AbstractDimensionsSelectingDoubleDistanceFunction
distance, equals, getDistanceFactory, getSelectedDimensions, setSelectedDimensions
 
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, toString, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.distance.distancefunction.PrimitiveDistanceFunction
distance
 
Methods inherited from interface de.lmu.ifi.dbs.elki.distance.distancefunction.DistanceFunction
getDistanceFactory, isSymmetric
 

Constructor Detail

DimensionsSelectingEuclideanDistanceFunction

public DimensionsSelectingEuclideanDistanceFunction(BitSet dimensions)
Constructor.

Parameters:
dimensions - Selected dimensions
Method Detail

doubleDistance

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

Specified by:
doubleDistance in interface PrimitiveDoubleDistanceFunction<NumberVector<?,?>>
Parameters:
v1 - first feature vector
v2 - second feature vector
Returns:
the Euclidean distance between two given feature vectors in the selected dimensions

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

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

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

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

getInputTypeRestriction

public VectorFieldTypeInformation<? super NumberVector<?,?>> getInputTypeRestriction()
Description copied from interface: DistanceFunction
Get the input data type of the function.

Specified by:
getInputTypeRestriction in interface DistanceFunction<NumberVector<?,?>,DoubleDistance>
Specified by:
getInputTypeRestriction in interface PrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>
Returns:
Type restriction

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.

instantiate

public <T extends NumberVector<?,?>> SpatialPrimitiveDistanceQuery<T,DoubleDistance> instantiate(Relation<T> database)
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:
database - Representation
Returns:
Actual distance query.

Release 0.4.0 (2011-09-20_1324)