@Alias(value={"squaredeuclidean","de.lmu.ifi.dbs.elki.distance.distancefunction.SquaredEuclideanDistanceFunction"}) public class SquaredEuclideanDistanceFunction extends AbstractNumberVectorDistanceFunction implements SpatialPrimitiveDistanceFunction<NumberVector>, Norm<NumberVector>
SparseNumberVectors. This
results in the same rankings as regular Euclidean distance, but saves
computing the square root.
Squared Euclidean is defined as: \[ \text{Euclidean}^2(\vec{x},\vec{y}) := \sum_i (x_i-y_i)^2 \]
| Modifier and Type | Class and Description |
|---|---|
static class |
SquaredEuclideanDistanceFunction.Parameterizer
Parameterization class.
|
| Modifier and Type | Field and Description |
|---|---|
static SquaredEuclideanDistanceFunction |
STATIC
Static instance.
|
| Constructor and Description |
|---|
SquaredEuclideanDistanceFunction()
Deprecated.
Use static instance!
|
| Modifier and Type | Method and Description |
|---|---|
double |
distance(double[] v1,
double[] v2)
Special version for double arrays.
|
double |
distance(NumberVector v1,
NumberVector v2)
Computes the distance between two given DatabaseObjects according to this
distance function.
|
boolean |
equals(java.lang.Object obj) |
SimpleTypeInformation<? super NumberVector> |
getInputTypeRestriction()
Get the input data type of the function.
|
int |
hashCode() |
boolean |
isSquared()
Squared distances, that would become metric after square root.
|
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(double[] v1,
double[] v2,
int start,
int end) |
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(double[] v,
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() |
dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, dimensionalityclone, finalize, getClass, notify, notifyAll, wait, wait, waitinstantiateisMetric, isSymmetricpublic static final SquaredEuclideanDistanceFunction STATIC
@Deprecated public SquaredEuclideanDistanceFunction()
STATIC instead.private double preDistance(double[] v1,
double[] v2,
int start,
int end)
private double preDistance(NumberVector v1, NumberVector v2, int start, int end)
private double preDistanceVM(NumberVector v, SpatialComparable mbr, int start, int end)
private double preDistanceMBR(SpatialComparable mbr1, SpatialComparable mbr2, int start, int end)
private double preNorm(NumberVector v, int start, int end)
private double preNorm(double[] v,
int start,
int end)
private double preNormMBR(SpatialComparable mbr, int start, int end)
public double distance(NumberVector v1, NumberVector v2)
PrimitiveDistanceFunctiondistance in interface NumberVectorDistanceFunction<NumberVector>distance in interface PrimitiveDistanceFunction<NumberVector>v1 - first DatabaseObjectv2 - second DatabaseObjectpublic double distance(double[] v1,
double[] v2)
public double norm(NumberVector v)
Normnorm in interface Norm<NumberVector>v - Objectpublic double minDist(SpatialComparable mbr1, SpatialComparable mbr2)
SpatialPrimitiveDistanceFunctionminDist in interface SpatialPrimitiveDistanceFunction<NumberVector>mbr1 - the first MBR objectmbr2 - the second MBR objectpublic boolean isSquared()
DistanceFunctionisSquared in interface DistanceFunction<NumberVector>true when squared.public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic SimpleTypeInformation<? super NumberVector> getInputTypeRestriction()
DistanceFunctiongetInputTypeRestriction in interface DistanceFunction<NumberVector>getInputTypeRestriction in interface PrimitiveDistanceFunction<NumberVector>getInputTypeRestriction in class AbstractNumberVectorDistanceFunctionCopyright © 2019 ELKI Development Team. License information.