O
- Vector type@Reference(authors="J. L. Bentley", title="Multidimensional binary search trees used for associative searching", booktitle="Communications of the ACM, Vol. 18 Issue 9, Sept. 1975", url="http://dx.doi.org/10.1145/361002.361007") public class SmallMemoryKDTree<O extends NumberVector> extends AbstractIndex<O> implements KNNIndex<O>, RangeIndex<O>
ModifiableDoubleDBIDList
to sort the data in a
serialized tree and store the current attribute value.
It needs about 3 times as much memory as MinimalisticMemoryKDTree
but
it is also considerably faster because it does not need to lookup this value
from the vectors.
Reference:
J. L. Bentley
Multidimensional binary search trees used for associative searching
Communications of the ACM, Vol. 18 Issue 9, Sept. 1975
Modifier and Type | Class and Description |
---|---|
static class |
SmallMemoryKDTree.Factory<O extends NumberVector>
Factory class
|
class |
SmallMemoryKDTree.KDTreeKNNQuery
kNN query for the k-d-tree.
|
class |
SmallMemoryKDTree.KDTreeRangeQuery
kNN query for the k-d-tree.
|
Modifier and Type | Field and Description |
---|---|
(package private) int |
dims
The number of dimensions.
|
(package private) Counter |
distcalc
Counter for distance computations.
|
(package private) int |
leafsize
Maximum size of leaf nodes.
|
private static Logging |
LOG
Class logger
|
(package private) Counter |
objaccess
Counter for comparisons.
|
(package private) ModifiableDoubleDBIDList |
sorted
The actual "tree" as a sorted array.
|
relation
Constructor and Description |
---|
SmallMemoryKDTree(Relation<O> relation,
int leafsize)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private void |
buildTree(int left,
int right,
int axis,
DoubleDBIDListMIter iter)
Recursively build the tree by partial sorting.
|
protected void |
countDistanceComputation()
Count a distance computation.
|
protected void |
countObjectAccess()
Count a single object access.
|
KNNQuery<O> |
getKNNQuery(DistanceQuery<O> distanceQuery,
Object... hints)
Get a KNN query object for the given distance query and k.
|
String |
getLongName()
A "pretty" name for the result, for use in titles, captions and menus.
|
RangeQuery<O> |
getRangeQuery(DistanceQuery<O> distanceQuery,
Object... hints)
Get a range query object for the given distance query and k.
|
String |
getShortName()
A short name for the result, useful for file names.
|
void |
initialize()
Initialize the index.
|
void |
logStatistics()
Send statistics to the logger, if enabled.
|
private static final Logging LOG
ModifiableDoubleDBIDList sorted
int dims
int leafsize
final Counter objaccess
final Counter distcalc
public void initialize()
Index
initialize
in interface Index
private void buildTree(int left, int right, int axis, DoubleDBIDListMIter iter)
left
- Interval minimumright
- Interval maximumaxis
- Current splitting axisiter
- Iteratorpublic String getLongName()
Result
getLongName
in interface Result
getLongName
in class AbstractIndex<O extends NumberVector>
public String getShortName()
Result
getShortName
in interface Result
getShortName
in class AbstractIndex<O extends NumberVector>
public void logStatistics()
Index
logStatistics
in interface Index
protected void countObjectAccess()
protected void countDistanceComputation()
public KNNQuery<O> getKNNQuery(DistanceQuery<O> distanceQuery, Object... hints)
KNNIndex
getKNNQuery
in interface KNNIndex<O extends NumberVector>
distanceQuery
- Distance queryhints
- Hints for the optimizernull
public RangeQuery<O> getRangeQuery(DistanceQuery<O> distanceQuery, Object... hints)
RangeIndex
getRangeQuery
in interface RangeIndex<O extends NumberVector>
distanceQuery
- Distance queryhints
- Hints for the optimizernull
Copyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.