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 CompositeIndex &other)
 
 CompositeIndex (const IndexParams &params=CompositeIndexParams(), Distance d=Distance())
 
 CompositeIndex (const Matrix< ElementType > &inputData, const IndexParams &params=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...
 
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...
 
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
 
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...
 
 NNIndex (const IndexParams &params, 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 &params) const
 
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, std::vector< std::vector< int > > &indices, std::vector< std::vector< 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...
 
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_tids_
 
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 99 of file composite_index.h.

Member Typedef Documentation

◆ BaseClass

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

Definition at line 105 of file composite_index.h.

◆ DistanceType

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

Definition at line 103 of file composite_index.h.

◆ ElementType

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

Definition at line 102 of file composite_index.h.

◆ needs_kdtree_distance

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

Definition at line 107 of file composite_index.h.

Constructor & Destructor Documentation

◆ CompositeIndex() [1/3]

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

◆ CompositeIndex() [2/3]

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

Definition at line 124 of file composite_index.h.

◆ CompositeIndex() [3/3]

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

Definition at line 131 of file composite_index.h.

◆ ~CompositeIndex()

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

Definition at line 142 of file composite_index.h.

Member Function Documentation

◆ addPoints()

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

◆ buildIndex()

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

Builds the index.

Reimplemented from rtflann::NNIndex< Distance >.

Definition at line 189 of file composite_index.h.

◆ buildIndexImpl()

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

Implements rtflann::NNIndex< Distance >.

Definition at line 246 of file composite_index.h.

◆ clone()

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

Implements rtflann::NNIndex< Distance >.

Definition at line 148 of file composite_index.h.

◆ findNeighbors()

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

◆ freeIndex()

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

Implements rtflann::NNIndex< Distance >.

Definition at line 251 of file composite_index.h.

◆ getType()

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

Implements rtflann::IndexBase.

Definition at line 156 of file composite_index.h.

◆ loadIndex()

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

◆ operator=()

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

Definition at line 136 of file composite_index.h.

◆ removePoint()

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

◆ saveIndex()

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

◆ size()

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

Implements rtflann::IndexBase.

Definition at line 164 of file composite_index.h.

◆ swap()

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

Definition at line 240 of file composite_index.h.

◆ usedMemory()

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

◆ veclen()

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

Member Data Documentation

◆ kdtree_index_

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

The kd-tree index

Definition at line 262 of file composite_index.h.

◆ kmeans_index_

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

The k-means index

Definition at line 259 of file composite_index.h.


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


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:28