#include <composite_index.h>
Public Types | |
typedef NNIndex< Distance > | BaseClass |
typedef Distance::ResultType | DistanceType |
typedef Distance::ElementType | ElementType |
typedef bool | needs_kdtree_distance |
Public Types inherited from rtflann::NNIndex< Distance > | |
typedef Distance::ResultType | DistanceType |
typedef Distance::ElementType | ElementType |
Public Member Functions | |
void | addPoints (const Matrix< ElementType > &points, float rebuild_threshold=2) |
Incrementally add points to the index. More... | |
void | buildIndex () |
Builds the index. More... | |
BaseClass * | clone () const |
CompositeIndex (const CompositeIndex &other) | |
CompositeIndex (const IndexParams ¶ms=CompositeIndexParams(), Distance d=Distance()) | |
CompositeIndex (const Matrix< ElementType > &inputData, const IndexParams ¶ms=CompositeIndexParams(), Distance d=Distance()) | |
void | findNeighbors (ResultSet< DistanceType > &result, const ElementType *vec, const SearchParams &searchParams) const |
Method that searches for nearest-neighbours. More... | |
flann_algorithm_t | getType () const |
void | loadIndex (FILE *stream) |
Loads the index from a stream. More... | |
CompositeIndex & | operator= (CompositeIndex other) |
void | removePoint (size_t index) |
void | saveIndex (FILE *stream) |
Saves the index to a stream. More... | |
size_t | size () const |
int | usedMemory () const |
size_t | veclen () const |
virtual | ~CompositeIndex () |
Public Member Functions inherited from rtflann::NNIndex< Distance > | |
virtual void | buildIndex (const Matrix< ElementType > &dataset) |
IndexParams | getParameters () const |
virtual ElementType * | getPoint (size_t id) |
virtual int | knnSearch (const Matrix< ElementType > &queries, Matrix< size_t > &indices, Matrix< DistanceType > &dists, size_t knn, const SearchParams ¶ms) const |
Perform k-nearest neighbor search. More... | |
int | knnSearch (const Matrix< ElementType > &queries, std::vector< std::vector< int > > &indices, std::vector< std::vector< DistanceType > > &dists, size_t knn, const SearchParams ¶ms) const |
virtual int | knnSearch (const Matrix< ElementType > &queries, std::vector< std::vector< size_t > > &indices, std::vector< std::vector< DistanceType > > &dists, size_t knn, const SearchParams ¶ms) const |
Perform k-nearest neighbor search. More... | |
NNIndex (const IndexParams ¶ms, Distance d) | |
NNIndex (const NNIndex &other) | |
NNIndex (Distance d) | |
int | radiusSearch (const Matrix< ElementType > &queries, Matrix< int > &indices, Matrix< DistanceType > &dists, float radius, const SearchParams ¶ms) const |
virtual int | radiusSearch (const Matrix< ElementType > &queries, Matrix< size_t > &indices, Matrix< DistanceType > &dists, float radius, const SearchParams ¶ms) const |
Perform radius search. More... | |
int | radiusSearch (const Matrix< ElementType > &queries, std::vector< std::vector< int > > &indices, std::vector< std::vector< DistanceType > > &dists, float radius, const SearchParams ¶ms) const |
virtual int | radiusSearch (const Matrix< ElementType > &queries, std::vector< std::vector< size_t > > &indices, std::vector< std::vector< DistanceType > > &dists, float radius, const SearchParams ¶ms) const |
Perform radius search. More... | |
size_t | removedCount () const |
template<typename Archive > | |
void | serialize (Archive &ar) |
size_t | size () const |
size_t | sizeAtBuild () const |
size_t | veclen () const |
virtual | ~NNIndex () |
Public Member Functions inherited from rtflann::IndexBase | |
virtual | ~IndexBase () |
Protected Member Functions | |
void | buildIndexImpl () |
void | freeIndex () |
void | swap (CompositeIndex &other) |
Protected Member Functions inherited from rtflann::NNIndex< Distance > | |
void | cleanRemovedPoints () |
void | extendDataset (const Matrix< ElementType > &new_points) |
size_t | id_to_index (size_t id) |
void | indices_to_ids (const size_t *in, size_t *out, size_t size) const |
void | setDataset (const Matrix< ElementType > &dataset) |
void | swap (NNIndex &other) |
Private Attributes | |
KDTreeIndex< Distance > * | kdtree_index_ |
KMeansIndex< Distance > * | kmeans_index_ |
Additional Inherited Members | |
Protected Attributes inherited from rtflann::NNIndex< Distance > | |
ElementType * | data_ptr_ |
Distance | distance_ |
std::vector< size_t > | ids_ |
IndexParams | index_params_ |
size_t | last_id_ |
std::vector< ElementType * > | points_ |
bool | removed_ |
size_t | removed_count_ |
DynamicBitset | removed_points_ |
size_t | size_ |
size_t | size_at_build_ |
size_t | veclen_ |
This index builds a kd-tree index and a k-means index and performs nearest neighbour search both indexes. This gives a slight boost in search performance as some of the neighbours that are missed by one index are found by the other.
Definition at line 99 of file composite_index.h.
typedef NNIndex<Distance> rtflann::CompositeIndex< Distance >::BaseClass |
Definition at line 105 of file composite_index.h.
typedef Distance::ResultType rtflann::CompositeIndex< Distance >::DistanceType |
Definition at line 103 of file composite_index.h.
typedef Distance::ElementType rtflann::CompositeIndex< Distance >::ElementType |
Definition at line 102 of file composite_index.h.
typedef bool rtflann::CompositeIndex< Distance >::needs_kdtree_distance |
Definition at line 107 of file composite_index.h.
|
inline |
Index constructor
inputData | dataset containing the points to index |
params | Index parameters |
d | Distance functor |
Definition at line 116 of file composite_index.h.
|
inline |
Definition at line 124 of file composite_index.h.
|
inline |
Definition at line 131 of file composite_index.h.
|
inlinevirtual |
Definition at line 142 of file composite_index.h.
|
inlinevirtual |
Incrementally add points to the index.
points | Matrix with points to be added |
rebuild_threshold |
Reimplemented from rtflann::NNIndex< Distance >.
Definition at line 197 of file composite_index.h.
|
inlinevirtual |
Builds the index.
Reimplemented from rtflann::NNIndex< Distance >.
Definition at line 189 of file composite_index.h.
|
inlineprotectedvirtual |
Implements rtflann::NNIndex< Distance >.
Definition at line 246 of file composite_index.h.
|
inlinevirtual |
Implements rtflann::NNIndex< Distance >.
Definition at line 148 of file composite_index.h.
|
inlinevirtual |
Method that searches for nearest-neighbours.
Implements rtflann::NNIndex< Distance >.
Definition at line 233 of file composite_index.h.
|
inlineprotectedvirtual |
Implements rtflann::NNIndex< Distance >.
Definition at line 251 of file composite_index.h.
|
inlinevirtual |
Implements rtflann::IndexBase.
Definition at line 156 of file composite_index.h.
|
inlinevirtual |
Loads the index from a stream.
stream | The stream from which the index is loaded |
Implements rtflann::IndexBase.
Definition at line 224 of file composite_index.h.
|
inline |
Definition at line 136 of file composite_index.h.
|
inlinevirtual |
Remove point from the index
index | Index of point to be removed |
Reimplemented from rtflann::NNIndex< Distance >.
Definition at line 203 of file composite_index.h.
|
inlinevirtual |
Saves the index to a stream.
stream | The stream to save the index to |
Implements rtflann::IndexBase.
Definition at line 214 of file composite_index.h.
|
inlinevirtual |
Implements rtflann::IndexBase.
Definition at line 164 of file composite_index.h.
|
inlineprotected |
Definition at line 240 of file composite_index.h.
|
inlinevirtual |
Implements rtflann::IndexBase.
Definition at line 180 of file composite_index.h.
|
inlinevirtual |
Implements rtflann::IndexBase.
Definition at line 172 of file composite_index.h.
|
private |
The kd-tree index
Definition at line 262 of file composite_index.h.
|
private |
The k-means index
Definition at line 259 of file composite_index.h.