@Title(value="File based float distance for database objects.") @Description(value="Loads float distance values from an external text file.") public class FileBasedFloatDistanceFunction extends AbstractDBIDRangeDistanceFunction
AsciiDistanceParser
for the default input format.
TODO: use a float[]
instead of the hash map.Modifier and Type | Class and Description |
---|---|
static class |
FileBasedFloatDistanceFunction.Parameterizer
Parameterization class.
|
AbstractDatabaseDistanceFunction.Instance<O>
Modifier and Type | Field and Description |
---|---|
private TLongFloatMap |
cache
The distance cache
|
private File |
matrixfile
Input file of distance matrix
|
private DistanceParser |
parser
Distance parser
|
Constructor and Description |
---|
FileBasedFloatDistanceFunction(DistanceParser parser,
File matrixfile)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
double |
distance(int i1,
int i2)
Compute the distance for two integer offsets.
|
boolean |
equals(Object obj) |
<O extends DBID> |
instantiate(Relation<O> database)
Instantiate with a database to get the actual distance query.
|
private void |
loadCache(DistanceParser parser,
File matrixfile) |
protected static long |
makeKey(int i1,
int i2)
Combine two integer ids into a long value.
|
distance, getInputTypeRestriction
isMetric, isSymmetric
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isMetric, isSymmetric
private TLongFloatMap cache
private DistanceParser parser
private File matrixfile
public FileBasedFloatDistanceFunction(DistanceParser parser, File matrixfile)
parser
- Parsermatrixfile
- input filepublic <O extends DBID> DistanceQuery<O> instantiate(Relation<O> database)
DistanceFunction
instantiate
in interface DistanceFunction<DBID>
instantiate
in class AbstractDBIDRangeDistanceFunction
database
- The representation to usepublic double distance(int i1, int i2)
DBIDRangeDistanceFunction
i1
- First offseti2
- Second offsetprivate void loadCache(DistanceParser parser, File matrixfile) throws IOException
IOException
protected static final long makeKey(int i1, int i2)
i1
- First idi2
- Second idCopyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.