Package elki.distance.subspace
Class OnedimensionalDistance
- java.lang.Object
-
- elki.distance.AbstractNumberVectorDistance
-
- elki.distance.subspace.OnedimensionalDistance
-
- All Implemented Interfaces:
Distance<NumberVector>,Norm<NumberVector>,NumberVectorDistance<NumberVector>,PrimitiveDistance<NumberVector>,SpatialPrimitiveDistance<NumberVector>,DimensionSelectingSubspaceDistance<NumberVector>
public class OnedimensionalDistance extends AbstractNumberVectorDistance implements SpatialPrimitiveDistance<NumberVector>, DimensionSelectingSubspaceDistance<NumberVector>, Norm<NumberVector>
Distance function that computes the distance between feature vectors as the absolute difference of their values in a specified dimension only.- Since:
- 0.1
- Author:
- Elke Achtert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOnedimensionalDistance.ParParameterization class.
-
Field Summary
Fields Modifier and Type Field Description private intdimThe dimension to be considered for distance computation.
-
Constructor Summary
Constructors Constructor Description OnedimensionalDistance(int dim)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated 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)VectorTypeInformation<? super NumberVector>getInputTypeRestriction()Get the input data type of the function.intgetSelectedDimension()Returns the selected dimension.long[]getSelectedDimensions()Deprecated.inthashCode()doubleminDist(SpatialComparable mbr1, SpatialComparable mbr2)Computes the distance between the two given MBRs according to this distance function.doublenorm(NumberVector obj)Compute the norm of object obj.voidsetSelectedDimensions(long[] dimensions)Deprecated.-
Methods inherited from class elki.distance.AbstractNumberVectorDistance
dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, dimensionality
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface elki.distance.Distance
isMetric, isSquared, isSymmetric
-
Methods inherited from interface elki.distance.SpatialPrimitiveDistance
instantiate
-
-
-
-
Method Detail
-
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>- Parameters:
v1- first DatabaseObjectv2- second DatabaseObject- Returns:
- the distance between two given DatabaseObjects according to this distance function
-
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
-
getSelectedDimension
public int getSelectedDimension()
Returns the selected dimension.- Returns:
- the selected dimension
-
getSelectedDimensions
@Deprecated public long[] getSelectedDimensions()
Deprecated.Description copied from interface:DimensionSelectingSubspaceDistanceReturns a bit set representing the selected dimensions.Warning: no defensive copy is performed.
- Specified by:
getSelectedDimensionsin interfaceDimensionSelectingSubspaceDistance<NumberVector>- Returns:
- a bit set representing the selected dimensions
-
setSelectedDimensions
@Deprecated public void setSelectedDimensions(long[] dimensions)
Deprecated.Description copied from interface:DimensionSelectingSubspaceDistanceSets the selected dimensions according to the set bits in the given BitSet.Warning: no defensive copy is performed.
- Specified by:
setSelectedDimensionsin interfaceDimensionSelectingSubspaceDistance<NumberVector>- Parameters:
dimensions- a bit set designating the new selected dimensions
-
getInputTypeRestriction
public VectorTypeInformation<? 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>- Overrides:
getInputTypeRestrictionin classAbstractNumberVectorDistance- Returns:
- Type restriction
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-