Package elki.distance.external
Class DiskCacheBasedFloatDistance
- java.lang.Object
-
- elki.distance.AbstractDatabaseDistance<DBID>
-
- elki.distance.AbstractDBIDRangeDistance
-
- elki.distance.external.DiskCacheBasedFloatDistance
-
- All Implemented Interfaces:
DBIDDistance
,DBIDRangeDistance
,Distance<DBID>
public class DiskCacheBasedFloatDistance extends AbstractDBIDRangeDistance
Distance function that is based on float 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
DiskCacheBasedFloatDistance.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 cachestatic int
FLOAT_CACHE_MAGIC
Magic to identify double cache matricesprivate static Logging
LOG
Class logger.
-
Constructor Summary
Constructors Constructor Description DiskCacheBasedFloatDistance(OnDiskUpperTriangleMatrix cache)
Constructor.DiskCacheBasedFloatDistance(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.
-
FLOAT_CACHE_MAGIC
public static final int FLOAT_CACHE_MAGIC
Magic to identify double cache matrices- See Also:
- Constant Field Values
-
cache
private OnDiskUpperTriangleMatrix cache
The distance cache
-
-
Constructor Detail
-
DiskCacheBasedFloatDistance
public DiskCacheBasedFloatDistance(OnDiskUpperTriangleMatrix cache)
Constructor.- Parameters:
cache
- Distance matrix
-
DiskCacheBasedFloatDistance
public DiskCacheBasedFloatDistance(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
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
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
-
-