Package elki.distance.external
Class DiskCacheBasedDoubleDistance
- java.lang.Object
-
- elki.distance.AbstractDatabaseDistance<DBID>
-
- elki.distance.AbstractDBIDRangeDistance
-
- elki.distance.external.DiskCacheBasedDoubleDistance
-
- All Implemented Interfaces:
DBIDDistance
,DBIDRangeDistance
,Distance<DBID>
public class DiskCacheBasedDoubleDistance extends AbstractDBIDRangeDistance
Distance function that is based on double distances given by a distance matrix of an external binary matrix file.- Since:
- 0.2
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DiskCacheBasedDoubleDistance.Par
Parameterization class.-
Nested classes/interfaces inherited from class elki.distance.AbstractDatabaseDistance
AbstractDatabaseDistance.Instance<O>
-
-
Field Summary
Fields Modifier and Type Field Description private OnDiskUpperTriangleMatrix
cache
The distance matrixstatic int
DOUBLE_CACHE_MAGIC
Magic to identify double cache matricesprivate static Logging
LOG
Class logger.
-
Constructor Summary
Constructors Constructor Description DiskCacheBasedDoubleDistance(OnDiskUpperTriangleMatrix cache)
Constructor.DiskCacheBasedDoubleDistance(java.nio.file.Path matrixfile)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkRange(DBIDRange range)
Validate the range of DBIDs to use.double
distance(int i1, int i2)
Compute the distance for two integer offsets.boolean
equals(java.lang.Object obj)
-
Methods inherited from class elki.distance.AbstractDBIDRangeDistance
distance, getInputTypeRestriction, instantiate
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface elki.distance.Distance
isMetric, isSquared, isSymmetric
-
-
-
-
Field Detail
-
LOG
private static final Logging LOG
Class logger.
-
DOUBLE_CACHE_MAGIC
public static final int DOUBLE_CACHE_MAGIC
Magic to identify double cache matrices- See Also:
- Constant Field Values
-
cache
private OnDiskUpperTriangleMatrix cache
The distance matrix
-
-
Constructor Detail
-
DiskCacheBasedDoubleDistance
public DiskCacheBasedDoubleDistance(OnDiskUpperTriangleMatrix cache)
Constructor.- Parameters:
cache
- Distance matrix
-
DiskCacheBasedDoubleDistance
public DiskCacheBasedDoubleDistance(java.nio.file.Path matrixfile) throws java.io.IOException
Constructor.- Parameters:
matrixfile
- File name- Throws:
java.io.IOException
-
-
Method Detail
-
distance
public double distance(int i1, int i2)
Description copied from interface:DBIDRangeDistance
Compute the distance for two integer offsets.- Parameters:
i1
- First offseti2
- Second offset- Returns:
- Distance
-
checkRange
public void checkRange(DBIDRange range)
Description copied from interface:DBIDRangeDistance
Validate the range of DBIDs to use. This will log a warning if an obvious mismatch was found.- Parameters:
range
- DBID range
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-