@Alias(value={"squaredeuclidean","de.lmu.ifi.dbs.elki.distance.distancefunction.SquaredEuclideanDistanceFunction"}) public class SquaredEuclideanDistanceFunction extends AbstractNumberVectorDistanceFunction implements SpatialPrimitiveDistanceFunction<NumberVector>, Norm<NumberVector>
SparseNumberVector
s. 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, dimensionality
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
instantiate
isMetric, isSymmetric
public 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)
PrimitiveDistanceFunction
distance
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)
Norm
norm
in interface Norm<NumberVector>
v
- Objectpublic double minDist(SpatialComparable mbr1, SpatialComparable mbr2)
SpatialPrimitiveDistanceFunction
minDist
in interface SpatialPrimitiveDistanceFunction<NumberVector>
mbr1
- the first MBR objectmbr2
- the second MBR objectpublic boolean isSquared()
DistanceFunction
isSquared
in interface DistanceFunction<NumberVector>
true
when squared.public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public SimpleTypeInformation<? super NumberVector> getInputTypeRestriction()
DistanceFunction
getInputTypeRestriction
in interface DistanceFunction<NumberVector>
getInputTypeRestriction
in interface PrimitiveDistanceFunction<NumberVector>
getInputTypeRestriction
in class AbstractNumberVectorDistanceFunction
Copyright © 2019 ELKI Development Team. License information.