de.lmu.ifi.dbs.elki.distance.distancefunction.external
Class DiskCacheBasedDoubleDistanceFunction<V extends DatabaseObject>
java.lang.Object
de.lmu.ifi.dbs.elki.logging.AbstractLoggable
de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
de.lmu.ifi.dbs.elki.distance.AbstractMeasurementFunction<O,D>
de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractDistanceFunction<O,DoubleDistance>
de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractDoubleDistanceFunction<V>
de.lmu.ifi.dbs.elki.distance.distancefunction.external.DiskCacheBasedDoubleDistanceFunction<V>
- Type Parameters:
V
- object type
- All Implemented Interfaces:
- DistanceFunction<V,DoubleDistance>, MeasurementFunction<V,DoubleDistance>, Parameterizable
public class DiskCacheBasedDoubleDistanceFunction<V extends DatabaseObject>
- extends AbstractDoubleDistanceFunction<V>
Provides a DistanceFunction that is based on double distances given by a
distance matrix of an external file.
- Author:
- Erich Schubert
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DOUBLE_CACHE_MAGIC
public static final int DOUBLE_CACHE_MAGIC
- Magic to identify double cache matrices
- See Also:
- Constant Field Values
MATRIX_ID
public static final OptionID MATRIX_ID
- OptionID for
MATRIX_PARAM
MATRIX_PARAM
private final FileParameter MATRIX_PARAM
- Parameter that specifies the name of the directory to be re-parsed.
Key: -distance.matrix
DOUBLE_SIZE
private static final int DOUBLE_SIZE
- Storage required for a double value.
- See Also:
- Constant Field Values
cache
private OnDiskUpperTriangleMatrix cache
DiskCacheBasedDoubleDistanceFunction
public DiskCacheBasedDoubleDistanceFunction()
- Default constructor.
distance
public DoubleDistance distance(V o1,
V o2)
- Computes the distance between two given DatabaseObjects according to this
distance function.
- Parameters:
o1
- first DatabaseObjecto2
- second DatabaseObject
- Returns:
- the distance between two given DatabaseObject according to this
distance function
distance
public DoubleDistance distance(Integer id1,
V o2)
- Returns the distance between the two specified objects.
- Specified by:
distance
in interface DistanceFunction<V extends DatabaseObject,DoubleDistance>
- Overrides:
distance
in class AbstractDistanceFunction<V extends DatabaseObject,DoubleDistance>
- Parameters:
id1
- first object ido2
- second DatabaseObject
- Returns:
- the distance between the two objects specified by their objects ids
distance
public DoubleDistance distance(Integer id1,
Integer id2)
- Returns the distance between the two objects specified by their objects
ids. If a cache is used, the distance value is looked up in the cache. If
the distance does not yet exists in cache, it will be computed an put to
cache. If no cache is used, the distance is computed.
- Specified by:
distance
in interface DistanceFunction<V extends DatabaseObject,DoubleDistance>
- Overrides:
distance
in class AbstractDistanceFunction<V extends DatabaseObject,DoubleDistance>
- Parameters:
id1
- first object idid2
- second object id
- Returns:
- the distance between the two objects specified by their objects ids
setParameters
public List<String> setParameters(List<String> args)
throws ParameterException
- Description copied from class:
AbstractParameterizable
- Grabs all specified options from the option handler. Any extending class
should call this method first and return the returned array without further
changes, but after setting further required parameters. An example for
overwriting this method taking advantage from the previously (in
superclasses) defined options would be:
{
List remainingParameters = super.setParameters(args);
// set parameters for your class
// for example like this:
if(isSet(MY_PARAM_VALUE_PARAM))
{
myParamValue = getParameterValue(MY_PARAM_VALUE_PARAM);
}
.
.
.
return remainingParameters;
// or in case of attributes requesting parameters themselves
// return parameterizableAttribbute.setParameters(remainingParameters);
}
- Specified by:
setParameters
in interface Parameterizable
- Overrides:
setParameters
in class AbstractParameterizable
- Parameters:
args
- parameters to set the attributes accordingly to
- Returns:
- a list containing the unused parameters
- Throws:
ParameterException
- in case of wrong parameter-setting