Package elki.distance.minkowski
Class SparseEuclideanDistance
- java.lang.Object
-
- elki.distance.minkowski.SparseLPNormDistance
-
- elki.distance.minkowski.SparseEuclideanDistance
-
- All Implemented Interfaces:
Distance<SparseNumberVector>
,Norm<SparseNumberVector>
,PrimitiveDistance<SparseNumberVector>
public class SparseEuclideanDistance extends SparseLPNormDistance
Euclidean distance function, optimized forSparseNumberVector
s.Euclidean distance is defined as: \[ \text{Euclidean}(\vec{x},\vec{y}) := \sqrt{\sum\nolimits_i (x_i-y_i)^2} \]
For sparse vectors, we can skip those i where both vectors are 0.
- Since:
- 0.5.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SparseEuclideanDistance.Par
Parameterizer
-
Field Summary
Fields Modifier and Type Field Description static SparseEuclideanDistance
STATIC
Static instance
-
Constructor Summary
Constructors Constructor Description SparseEuclideanDistance()
Deprecated.Use static instance instead.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
distance(SparseNumberVector v1, SparseNumberVector v2)
Computes the distance between two given DatabaseObjects according to this distance function.double
norm(SparseNumberVector v1)
Compute the norm of object obj.-
Methods inherited from class elki.distance.minkowski.SparseLPNormDistance
getInputTypeRestriction, isMetric
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface elki.distance.Distance
isSquared, isSymmetric
-
Methods inherited from interface elki.distance.PrimitiveDistance
instantiate
-
-
-
-
Field Detail
-
STATIC
public static final SparseEuclideanDistance STATIC
Static instance
-
-
Constructor Detail
-
SparseEuclideanDistance
@Deprecated public SparseEuclideanDistance()
Deprecated.Use static instance instead.Constructor - useSTATIC
instead.
-
-
Method Detail
-
distance
public double distance(SparseNumberVector v1, SparseNumberVector v2)
Description copied from interface:PrimitiveDistance
Computes the distance between two given DatabaseObjects according to this distance function.- Specified by:
distance
in interfacePrimitiveDistance<SparseNumberVector>
- Overrides:
distance
in classSparseLPNormDistance
- Parameters:
v1
- first DatabaseObjectv2
- second DatabaseObject- Returns:
- the distance between two given DatabaseObjects according to this distance function
-
norm
public double norm(SparseNumberVector v1)
Description copied from interface:Norm
Compute the norm of object obj.- Specified by:
norm
in interfaceNorm<SparseNumberVector>
- Overrides:
norm
in classSparseLPNormDistance
- Parameters:
v1
- Object- Returns:
- Norm
-
-