Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
rtflann::CompositeIndex< Distance > Class Template Reference

#include <composite_index.h>

Inheritance diagram for rtflann::CompositeIndex< Distance >:
Inheritance graph
[legend]

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...
 
BaseClassclone () const
 
 CompositeIndex (const IndexParams &params=CompositeIndexParams(), Distance d=Distance())
 
 CompositeIndex (const Matrix< ElementType > &inputData, const IndexParams &params=CompositeIndexParams(), Distance d=Distance())
 
 CompositeIndex (const CompositeIndex &other)
 
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...
 
CompositeIndexoperator= (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 ElementTypegetPoint (size_t id)
 
virtual int knnSearch (const Matrix< ElementType > &queries, Matrix< size_t > &indices, Matrix< DistanceType > &dists, size_t knn, const SearchParams &params) const
 Perform k-nearest neighbor search. More...
 
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 &params) 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 &params) const
 
 NNIndex (Distance d)
 
 NNIndex (const IndexParams &params, Distance d)
 
 NNIndex (const NNIndex &other)
 
virtual int radiusSearch (const Matrix< ElementType > &queries, Matrix< size_t > &indices, Matrix< DistanceType > &dists, float radius, const SearchParams &params) const
 Perform radius search. More...
 
int radiusSearch (const Matrix< ElementType > &queries, Matrix< int > &indices, Matrix< DistanceType > &dists, float radius, const SearchParams &params) 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 &params) 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 &params) const
 
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 >
ElementTypedata_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_
 

Detailed Description

template<typename Distance>
class rtflann::CompositeIndex< Distance >

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 71 of file composite_index.h.

Member Typedef Documentation

template<typename Distance >
typedef NNIndex<Distance> rtflann::CompositeIndex< Distance >::BaseClass

Definition at line 77 of file composite_index.h.

template<typename Distance >
typedef Distance::ResultType rtflann::CompositeIndex< Distance >::DistanceType

Definition at line 75 of file composite_index.h.

template<typename Distance >
typedef Distance::ElementType rtflann::CompositeIndex< Distance >::ElementType

Definition at line 74 of file composite_index.h.

template<typename Distance >
typedef bool rtflann::CompositeIndex< Distance >::needs_kdtree_distance

Definition at line 79 of file composite_index.h.

Constructor & Destructor Documentation

template<typename Distance >
rtflann::CompositeIndex< Distance >::CompositeIndex ( const IndexParams params = CompositeIndexParams(),
Distance  d = Distance() 
)
inline

Index constructor

Parameters
inputDatadataset containing the points to index
paramsIndex parameters
dDistance functor
Returns

Definition at line 88 of file composite_index.h.

template<typename Distance >
rtflann::CompositeIndex< Distance >::CompositeIndex ( const Matrix< ElementType > &  inputData,
const IndexParams params = CompositeIndexParams(),
Distance  d = Distance() 
)
inline

Definition at line 96 of file composite_index.h.

template<typename Distance >
rtflann::CompositeIndex< Distance >::CompositeIndex ( const CompositeIndex< Distance > &  other)
inline

Definition at line 103 of file composite_index.h.

template<typename Distance >
virtual rtflann::CompositeIndex< Distance >::~CompositeIndex ( )
inlinevirtual

Definition at line 114 of file composite_index.h.

Member Function Documentation

template<typename Distance >
void rtflann::CompositeIndex< Distance >::addPoints ( const Matrix< ElementType > &  points,
float  rebuild_threshold = 2 
)
inlinevirtual

Incrementally add points to the index.

Parameters
pointsMatrix with points to be added
rebuild_threshold

Reimplemented from rtflann::NNIndex< Distance >.

Definition at line 169 of file composite_index.h.

template<typename Distance >
void rtflann::CompositeIndex< Distance >::buildIndex ( )
inlinevirtual

Builds the index.

Reimplemented from rtflann::NNIndex< Distance >.

Definition at line 161 of file composite_index.h.

template<typename Distance >
void rtflann::CompositeIndex< Distance >::buildIndexImpl ( )
inlineprotectedvirtual

Implements rtflann::NNIndex< Distance >.

Definition at line 218 of file composite_index.h.

template<typename Distance >
BaseClass* rtflann::CompositeIndex< Distance >::clone ( ) const
inlinevirtual

Implements rtflann::NNIndex< Distance >.

Definition at line 120 of file composite_index.h.

template<typename Distance >
void rtflann::CompositeIndex< Distance >::findNeighbors ( ResultSet< DistanceType > &  result,
const ElementType vec,
const SearchParams searchParams 
) const
inlinevirtual

Method that searches for nearest-neighbours.

Implements rtflann::NNIndex< Distance >.

Definition at line 205 of file composite_index.h.

template<typename Distance >
void rtflann::CompositeIndex< Distance >::freeIndex ( )
inlineprotectedvirtual

Implements rtflann::NNIndex< Distance >.

Definition at line 223 of file composite_index.h.

template<typename Distance >
flann_algorithm_t rtflann::CompositeIndex< Distance >::getType ( ) const
inlinevirtual
Returns
The index type

Implements rtflann::IndexBase.

Definition at line 128 of file composite_index.h.

template<typename Distance >
void rtflann::CompositeIndex< Distance >::loadIndex ( FILE *  stream)
inlinevirtual

Loads the index from a stream.

Parameters
streamThe stream from which the index is loaded

Implements rtflann::IndexBase.

Definition at line 196 of file composite_index.h.

template<typename Distance >
CompositeIndex& rtflann::CompositeIndex< Distance >::operator= ( CompositeIndex< Distance >  other)
inline

Definition at line 108 of file composite_index.h.

template<typename Distance >
void rtflann::CompositeIndex< Distance >::removePoint ( size_t  id)
inlinevirtual

Remove point from the index

Parameters
indexIndex of point to be removed

Reimplemented from rtflann::NNIndex< Distance >.

Definition at line 175 of file composite_index.h.

template<typename Distance >
void rtflann::CompositeIndex< Distance >::saveIndex ( FILE *  stream)
inlinevirtual

Saves the index to a stream.

Parameters
streamThe stream to save the index to

Implements rtflann::IndexBase.

Definition at line 186 of file composite_index.h.

template<typename Distance >
size_t rtflann::CompositeIndex< Distance >::size ( ) const
inlinevirtual
Returns
Size of the index

Implements rtflann::IndexBase.

Definition at line 136 of file composite_index.h.

template<typename Distance >
void rtflann::CompositeIndex< Distance >::swap ( CompositeIndex< Distance > &  other)
inlineprotected

Definition at line 212 of file composite_index.h.

template<typename Distance >
int rtflann::CompositeIndex< Distance >::usedMemory ( ) const
inlinevirtual
Returns
The amount of memory (in bytes) used by the index.

Implements rtflann::IndexBase.

Definition at line 152 of file composite_index.h.

template<typename Distance >
size_t rtflann::CompositeIndex< Distance >::veclen ( ) const
inlinevirtual
Returns
The dimensionality of the features in this index.

Implements rtflann::IndexBase.

Definition at line 144 of file composite_index.h.

Member Data Documentation

template<typename Distance >
KDTreeIndex<Distance>* rtflann::CompositeIndex< Distance >::kdtree_index_
private

The kd-tree index

Definition at line 234 of file composite_index.h.

template<typename Distance >
KMeansIndex<Distance>* rtflann::CompositeIndex< Distance >::kmeans_index_
private

The k-means index

Definition at line 231 of file composite_index.h.


The documentation for this class was generated from the following file:


rtabmap
Author(s): Mathieu Labbe
autogenerated on Mon Dec 14 2020 03:37:09