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 betweenNumberVectors only in specified dimensions.- Since:
- 0.1
- Author:
- Elke Achtert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSubspaceLPNormDistance.ParParameterization class.
-
Field Summary
Fields Modifier and Type Field Description private doublepValue 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 doubledistance(NumberVector v1, NumberVector v2)Computes the distance between two given DatabaseObjects according to this distance function.booleanequals(java.lang.Object obj)VectorFieldTypeInformation<? super NumberVector>getInputTypeRestriction()Get the input data type of the function.doublegetP()Get the value of p.inthashCode()<T extends NumberVector>
SpatialPrimitiveDistanceQuery<T>instantiate(Relation<T> database)Instantiate with a database to get the actual distance query.booleanisMetric()Is this distance function metric (satisfy the triangle inequality)doubleminDist(SpatialComparable mbr1, SpatialComparable mbr2)Computes the distance between the two given MBRs according to this distance function.protected doubleminDistObject(SpatialComparable mbr, NumberVector v)doublenorm(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:PrimitiveDistanceComputes the distance between two given DatabaseObjects according to this distance function.- Specified by:
distancein interfaceNumberVectorDistance<NumberVector>- Specified by:
distancein interfacePrimitiveDistance<NumberVector>- Overrides:
distancein 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:SpatialPrimitiveDistanceComputes the distance between the two given MBRs according to this distance function.- Specified by:
minDistin 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:NormCompute the norm of object obj.- Specified by:
normin interfaceNorm<NumberVector>- Parameters:
obj- Object- Returns:
- Norm
-
instantiate
public <T extends NumberVector> SpatialPrimitiveDistanceQuery<T> instantiate(Relation<T> database)
Description copied from interface:DistanceInstantiate with a database to get the actual distance query.- Specified by:
instantiatein interfaceDistance<NumberVector>- Specified by:
instantiatein interfacePrimitiveDistance<NumberVector>- Specified by:
instantiatein interfaceSpatialPrimitiveDistance<NumberVector>- Parameters:
database- The representation to use- Returns:
- Actual distance query.
-
getInputTypeRestriction
public VectorFieldTypeInformation<? super NumberVector> getInputTypeRestriction()
Description copied from interface:DistanceGet the input data type of the function.- Specified by:
getInputTypeRestrictionin interfaceDistance<NumberVector>- Specified by:
getInputTypeRestrictionin interfacePrimitiveDistance<NumberVector>- Returns:
- Type restriction
-
isMetric
public boolean isMetric()
Description copied from interface:DistanceIs this distance function metric (satisfy the triangle inequality)- Specified by:
isMetricin interfaceDistance<NumberVector>- Returns:
truewhen metric.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classAbstractDimensionsSelectingDistance<NumberVector>
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractDimensionsSelectingDistance<NumberVector>
-
-