Class EuclideanDistance

• All Implemented Interfaces:
Distance<NumberVector>, Norm<NumberVector>, NumberVectorDistance<NumberVector>, PrimitiveDistance<NumberVector>, SpatialPrimitiveDistance<NumberVector>

@Priority(300)
@Alias({"euclidean","euclid","l2"})
public class EuclideanDistance
extends LPIntegerNormDistance
Euclidean distance for NumberVectors.

Euclidean distance is defined as: $\text{Euclidean}(\vec{x},\vec{y}) := \sqrt{\sum\nolimits_i (x_i-y_i)^2}$

Since:
0.1
Author:
Arthur Zimek
• Nested Class Summary

Nested Classes
Modifier and Type Class Description
static class  EuclideanDistance.Par
Parameterization class.
• Field Summary

Fields
Modifier and Type Field Description
static EuclideanDistance STATIC
Static instance.
• Fields inherited from class elki.distance.minkowski.LPIntegerNormDistance

intp
• Fields inherited from class elki.distance.minkowski.LPNormDistance

invp, p
• Constructor Summary

Constructors
Constructor Description
EuclideanDistance()
Deprecated.
Use static instance!
• Method Summary

All Methods
Modifier and Type Method Description
double distance​(NumberVector v1, NumberVector v2)
Computes the distance between two given DatabaseObjects according to this distance function.
boolean equals​(java.lang.Object obj)
int hashCode()
boolean isMetric()
Is this distance function metric (satisfy the triangle inequality)
double maxDist​(SpatialComparable mbr1, SpatialComparable mbr2)
Maximum distance of two objects.
double minDist​(SpatialComparable mbr1, SpatialComparable mbr2)
Computes the distance between the two given MBRs according to this distance function.
double norm​(NumberVector v)
Compute the norm of object obj.
private double preDistance​(NumberVector v1, NumberVector v2, int start, int end)
private double preDistanceMBR​(SpatialComparable mbr1, SpatialComparable mbr2, int start, int end)
private double preDistanceVM​(NumberVector v, SpatialComparable mbr, int start, int end)
private double preNorm​(NumberVector v, int start, int end)
private double preNormMBR​(SpatialComparable mbr, int start, int end)
java.lang.String toString()
• Methods inherited from class elki.distance.minkowski.LPNormDistance

getInputTypeRestriction, getInvP, getP
• Methods inherited from class java.lang.Object

clone, finalize, getClass, notify, notifyAll, wait, wait, wait
• Methods inherited from interface elki.distance.Distance

isSquared, isSymmetric
• Methods inherited from interface elki.distance.SpatialPrimitiveDistance

instantiate
• Field Detail

• STATIC

public static final EuclideanDistance STATIC
Static instance. Use this!
• Constructor Detail

• EuclideanDistance

@Deprecated
public EuclideanDistance()
Deprecated.
Use static instance!
Constructor - use STATIC instead.
• Method Detail

• preDistance

private double preDistance​(NumberVector v1,
NumberVector v2,
int start,
int end)
• preDistanceVM

private double preDistanceVM​(NumberVector v,
SpatialComparable mbr,
int start,
int end)
• preDistanceMBR

private double preDistanceMBR​(SpatialComparable mbr1,
SpatialComparable mbr2,
int start,
int end)
• preNorm

private double preNorm​(NumberVector v,
int start,
int end)
• preNormMBR

private double preNormMBR​(SpatialComparable mbr,
int start,
int end)
• distance

public double distance​(NumberVector v1,
NumberVector v2)
Description copied from interface: PrimitiveDistance
Computes the distance between two given DatabaseObjects according to this distance function.
Specified by:
distance in interface NumberVectorDistance<NumberVector>
Specified by:
distance in interface PrimitiveDistance<NumberVector>
Overrides:
distance in class LPIntegerNormDistance
Parameters:
v1 - first DatabaseObject
v2 - second DatabaseObject
Returns:
the distance between two given DatabaseObjects according to this distance function
• norm

public double norm​(NumberVector v)
Description copied from interface: Norm
Compute the norm of object obj.
Specified by:
norm in interface Norm<NumberVector>
Overrides:
norm in class LPIntegerNormDistance
Parameters:
v - Object
Returns:
Norm
• minDist

public double minDist​(SpatialComparable mbr1,
SpatialComparable mbr2)
Description copied from interface: SpatialPrimitiveDistance
Computes the distance between the two given MBRs according to this distance function.
Specified by:
minDist in interface SpatialPrimitiveDistance<NumberVector>
Overrides:
minDist in class LPIntegerNormDistance
Parameters:
mbr1 - the first MBR object
mbr2 - the second MBR object
Returns:
the distance between the two given MBRs according to this distance function
• maxDist

public double maxDist​(SpatialComparable mbr1,
SpatialComparable mbr2)
Maximum distance of two objects.
Parameters:
mbr1 - First object
mbr2 - Second object
• isMetric

public boolean isMetric()
Description copied from interface: Distance
Is this distance function metric (satisfy the triangle inequality)
Specified by:
isMetric in interface Distance<NumberVector>
Overrides:
isMetric in class LPNormDistance
Returns:
true when metric.
• toString

public java.lang.String toString()
Overrides:
toString in class LPNormDistance
• equals

public boolean equals​(java.lang.Object obj)
Overrides:
equals in class LPIntegerNormDistance
• hashCode

public int hashCode()
Overrides:
hashCode in class LPIntegerNormDistance