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 class
OnedimensionalDistance.Par
Parameterization class.
-
Field Summary
Fields Modifier and Type Field Description private int
dim
The 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 double
distance(NumberVector v1, NumberVector v2)
Computes the distance between two given DatabaseObjects according to this distance function.boolean
equals(java.lang.Object obj)
VectorTypeInformation<? super NumberVector>
getInputTypeRestriction()
Get the input data type of the function.int
getSelectedDimension()
Returns the selected dimension.long[]
getSelectedDimensions()
Deprecated.int
hashCode()
double
minDist(SpatialComparable mbr1, SpatialComparable mbr2)
Computes the distance between the two given MBRs according to this distance function.double
norm(NumberVector obj)
Compute the norm of object obj.void
setSelectedDimensions(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: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>
- 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: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
-
getSelectedDimension
public int getSelectedDimension()
Returns the selected dimension.- Returns:
- the selected dimension
-
getSelectedDimensions
@Deprecated public long[] getSelectedDimensions()
Deprecated.Description copied from interface:DimensionSelectingSubspaceDistance
Returns a bit set representing the selected dimensions.Warning: no defensive copy is performed.
- Specified by:
getSelectedDimensions
in interfaceDimensionSelectingSubspaceDistance<NumberVector>
- Returns:
- a bit set representing the selected dimensions
-
setSelectedDimensions
@Deprecated public void setSelectedDimensions(long[] dimensions)
Deprecated.Description copied from interface:DimensionSelectingSubspaceDistance
Sets the selected dimensions according to the set bits in the given BitSet.Warning: no defensive copy is performed.
- Specified by:
setSelectedDimensions
in interfaceDimensionSelectingSubspaceDistance<NumberVector>
- Parameters:
dimensions
- a bit set designating the new selected dimensions
-
getInputTypeRestriction
public VectorTypeInformation<? 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>
- Overrides:
getInputTypeRestriction
in classAbstractNumberVectorDistance
- Returns:
- Type restriction
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-