Package elki.distance.subspace
Class SubspaceLPNormDistance
- java.lang.Object
-
- elki.distance.subspace.AbstractDimensionsSelectingDistance<NumberVector>
-
- elki.distance.subspace.SubspaceLPNormDistance
-
- All Implemented Interfaces:
Distance<NumberVector>
,Norm<NumberVector>
,NumberVectorDistance<NumberVector>
,PrimitiveDistance<NumberVector>
,SpatialPrimitiveDistance<NumberVector>
,DimensionSelectingSubspaceDistance<NumberVector>
- Direct Known Subclasses:
SubspaceEuclideanDistance
,SubspaceManhattanDistance
,SubspaceMaximumDistance
public class SubspaceLPNormDistance extends AbstractDimensionsSelectingDistance<NumberVector> implements SpatialPrimitiveDistance<NumberVector>, Norm<NumberVector>, NumberVectorDistance<NumberVector>
Lp-Norm distance function betweenNumberVector
s only in specified dimensions.- Since:
- 0.1
- Author:
- Elke Achtert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SubspaceLPNormDistance.Par
Parameterization class.
-
Field Summary
Fields Modifier and Type Field Description private double
p
Value of p-
Fields inherited from class elki.distance.subspace.AbstractDimensionsSelectingDistance
dimensions
-
-
Constructor Summary
Constructors Constructor Description SubspaceLPNormDistance(double p, long[] dimensions)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete 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)
VectorFieldTypeInformation<? super NumberVector>
getInputTypeRestriction()
Get the input data type of the function.double
getP()
Get the value of p.int
hashCode()
<T extends NumberVector>
SpatialPrimitiveDistanceQuery<T>instantiate(Relation<T> database)
Instantiate with a database to get the actual distance query.boolean
isMetric()
Is this distance function metric (satisfy the triangle inequality)double
minDist(SpatialComparable mbr1, SpatialComparable mbr2)
Computes the distance between the two given MBRs according to this distance function.protected double
minDistObject(SpatialComparable mbr, NumberVector v)
double
norm(NumberVector obj)
Compute the norm of object obj.-
Methods inherited from class elki.distance.subspace.AbstractDimensionsSelectingDistance
getSelectedDimensions, setSelectedDimensions
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface elki.distance.Distance
isSquared, isSymmetric
-
-
-
-
Method Detail
-
getP
public double getP()
Get the value of p.- Returns:
- p
-
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 interfaceNumberVectorDistance<NumberVector>
- Specified by:
distance
in interfacePrimitiveDistance<NumberVector>
- Overrides:
distance
in classAbstractDimensionsSelectingDistance<NumberVector>
- Parameters:
v1
- first DatabaseObjectv2
- second DatabaseObject- Returns:
- the distance between two given DatabaseObjects according to this distance function
-
minDistObject
protected double minDistObject(SpatialComparable mbr, NumberVector v)
-
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 interfaceSpatialPrimitiveDistance<NumberVector>
- Parameters:
mbr1
- the first MBR objectmbr2
- the second MBR object- Returns:
- the distance between the two given MBRs according to this distance function
-
norm
public double norm(NumberVector obj)
Description copied from interface:Norm
Compute the norm of object obj.- Specified by:
norm
in interfaceNorm<NumberVector>
- Parameters:
obj
- Object- Returns:
- Norm
-
instantiate
public <T extends NumberVector> SpatialPrimitiveDistanceQuery<T> instantiate(Relation<T> database)
Description copied from interface:Distance
Instantiate with a database to get the actual distance query.- Specified by:
instantiate
in interfaceDistance<NumberVector>
- Specified by:
instantiate
in interfacePrimitiveDistance<NumberVector>
- Specified by:
instantiate
in interfaceSpatialPrimitiveDistance<NumberVector>
- Parameters:
database
- The representation to use- Returns:
- Actual distance query.
-
getInputTypeRestriction
public VectorFieldTypeInformation<? super NumberVector> getInputTypeRestriction()
Description copied from interface:Distance
Get the input data type of the function.- Specified by:
getInputTypeRestriction
in interfaceDistance<NumberVector>
- Specified by:
getInputTypeRestriction
in interfacePrimitiveDistance<NumberVector>
- Returns:
- Type restriction
-
isMetric
public boolean isMetric()
Description copied from interface:Distance
Is this distance function metric (satisfy the triangle inequality)- Specified by:
isMetric
in interfaceDistance<NumberVector>
- Returns:
true
when metric.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classAbstractDimensionsSelectingDistance<NumberVector>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classAbstractDimensionsSelectingDistance<NumberVector>
-
-