Classes | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
rtflann::AutotunedIndex< Distance > Class Template Reference

#include <autotuned_index.h>

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

List of all members.

Classes

struct  CostData

Public Types

typedef NNIndex< Distance > BaseClass
typedef Distance::ResultType DistanceType
typedef Distance::ElementType ElementType
typedef AutotunedIndex< Distance > IndexType
typedef bool needs_kdtree_distance

Public Member Functions

void addPoints (const Matrix< ElementType > &points, float rebuild_threshold=2)
 Incrementally add points to the index.
 AutotunedIndex (const Matrix< ElementType > &inputData, const IndexParams &params=AutotunedIndexParams(), Distance d=Distance())
 AutotunedIndex (const IndexParams &params=AutotunedIndexParams(), Distance d=Distance())
 AutotunedIndex (const AutotunedIndex &other)
void buildIndex ()
void buildIndex (const Matrix< ElementType > &dataset)
BaseClassclone () const
void findNeighbors (ResultSet< DistanceType > &result, const ElementType *vec, const SearchParams &searchParams) const
IndexParams getParameters () const
FLANN_DEPRECATED SearchParams getSearchParameters () const
FLANN_DEPRECATED float getSpeedup () const
flann_algorithm_t getType () const
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.
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.
void loadIndex (FILE *stream)
AutotunedIndexoperator= (AutotunedIndex other)
int radiusSearch (const Matrix< ElementType > &queries, Matrix< size_t > &indices, Matrix< DistanceType > &dists, DistanceType radius, const SearchParams &params) const
int radiusSearch (const Matrix< ElementType > &queries, std::vector< std::vector< size_t > > &indices, std::vector< std::vector< DistanceType > > &dists, DistanceType radius, const SearchParams &params) const
void removePoint (size_t id)
void saveIndex (FILE *stream)
template<typename Archive >
void serialize (Archive &ar)
size_t size () const
int usedMemory () const
size_t veclen () const
virtual ~AutotunedIndex ()

Protected Member Functions

void buildIndexImpl ()
void freeIndex ()

Private Member Functions

IndexParams estimateBuildParams ()
float estimateSearchParams (SearchParams &searchParams)
void evaluate_kdtree (CostData &cost)
void evaluate_kmeans (CostData &cost)
void optimizeKDTree (std::vector< CostData > &costs)
void optimizeKMeans (std::vector< CostData > &costs)
void swap (AutotunedIndex &other)

Private Attributes

NNIndex< Distance > * bestIndex_
IndexParams bestParams_
SearchParams bestSearchParams_
float build_weight_
Matrix< ElementTypedataset_
Matrix< size_t > gt_matches_
float memory_weight_
float sample_fraction_
Matrix< ElementTypesampledDataset_
float speedup_
float target_precision_
Matrix< ElementTypetestDataset_

Detailed Description

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

Definition at line 73 of file autotuned_index.h.


Member Typedef Documentation

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

Definition at line 79 of file autotuned_index.h.

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

Reimplemented from rtflann::NNIndex< Distance >.

Definition at line 77 of file autotuned_index.h.

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

Reimplemented from rtflann::NNIndex< Distance >.

Definition at line 76 of file autotuned_index.h.

template<typename Distance >
typedef AutotunedIndex<Distance> rtflann::AutotunedIndex< Distance >::IndexType

Definition at line 81 of file autotuned_index.h.

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

Definition at line 83 of file autotuned_index.h.


Constructor & Destructor Documentation

template<typename Distance >
rtflann::AutotunedIndex< Distance >::AutotunedIndex ( const Matrix< ElementType > &  inputData,
const IndexParams params = AutotunedIndexParams(),
Distance  d = Distance() 
) [inline]

Definition at line 85 of file autotuned_index.h.

template<typename Distance >
rtflann::AutotunedIndex< Distance >::AutotunedIndex ( const IndexParams params = AutotunedIndexParams(),
Distance  d = Distance() 
) [inline]

Definition at line 94 of file autotuned_index.h.

template<typename Distance >
rtflann::AutotunedIndex< Distance >::AutotunedIndex ( const AutotunedIndex< Distance > &  other) [inline]

Definition at line 103 of file autotuned_index.h.

template<typename Distance >
virtual rtflann::AutotunedIndex< Distance >::~AutotunedIndex ( ) [inline, virtual]

Definition at line 122 of file autotuned_index.h.


Member Function Documentation

template<typename Distance >
void rtflann::AutotunedIndex< Distance >::addPoints ( const Matrix< ElementType > &  points,
float  rebuild_threshold = 2 
) [inline, virtual]

Incrementally add points to the index.

Parameters:
pointsMatrix with points to be added
rebuild_threshold

Reimplemented from rtflann::NNIndex< Distance >.

Definition at line 164 of file autotuned_index.h.

template<typename Distance >
void rtflann::AutotunedIndex< Distance >::buildIndex ( ) [inline, virtual]

Method responsible with building the index.

Reimplemented from rtflann::NNIndex< Distance >.

Definition at line 135 of file autotuned_index.h.

template<typename Distance >
void rtflann::AutotunedIndex< Distance >::buildIndex ( const Matrix< ElementType > &  dataset) [inline, virtual]

Builds the index using the specified dataset

Parameters:
datasetthe dataset to use

Reimplemented from rtflann::NNIndex< Distance >.

Definition at line 157 of file autotuned_index.h.

template<typename Distance >
void rtflann::AutotunedIndex< Distance >::buildIndexImpl ( ) [inline, protected, virtual]

Implements rtflann::NNIndex< Distance >.

Definition at line 349 of file autotuned_index.h.

template<typename Distance >
BaseClass* rtflann::AutotunedIndex< Distance >::clone ( ) const [inline, virtual]

Implements rtflann::NNIndex< Distance >.

Definition at line 127 of file autotuned_index.h.

template<typename Distance >
IndexParams rtflann::AutotunedIndex< Distance >::estimateBuildParams ( ) [inline, private]

Chooses the best nearest-neighbor algorithm and estimates the optimal parameters to use when building the index (for a given precision). Returns a dictionary with the optimal parameters.

Definition at line 560 of file autotuned_index.h.

template<typename Distance >
float rtflann::AutotunedIndex< Distance >::estimateSearchParams ( SearchParams searchParams) [inline, private]

Estimates the search time parameters needed to get the desired precision. Precondition: the index is built Postcondition: the searchParams will have the optimum params set, also the speedup obtained over linear search.

Definition at line 647 of file autotuned_index.h.

template<typename Distance >
void rtflann::AutotunedIndex< Distance >::evaluate_kdtree ( CostData cost) [inline, private]

Definition at line 397 of file autotuned_index.h.

template<typename Distance >
void rtflann::AutotunedIndex< Distance >::evaluate_kmeans ( CostData cost) [inline, private]

Definition at line 370 of file autotuned_index.h.

template<typename Distance >
void rtflann::AutotunedIndex< Distance >::findNeighbors ( ResultSet< DistanceType > &  result,
const ElementType vec,
const SearchParams searchParams 
) const [inline, virtual]

Method that searches for nearest-neighbors

Implements rtflann::NNIndex< Distance >.

Definition at line 294 of file autotuned_index.h.

template<typename Distance >
void rtflann::AutotunedIndex< Distance >::freeIndex ( ) [inline, protected, virtual]

Implements rtflann::NNIndex< Distance >.

Definition at line 354 of file autotuned_index.h.

template<typename Distance >
IndexParams rtflann::AutotunedIndex< Distance >::getParameters ( ) const [inline, virtual]

Returns the parameters used by the index.

Returns:
The index parameters

Reimplemented from rtflann::NNIndex< Distance >.

Definition at line 300 of file autotuned_index.h.

template<typename Distance >
FLANN_DEPRECATED SearchParams rtflann::AutotunedIndex< Distance >::getSearchParameters ( ) const [inline]

Definition at line 305 of file autotuned_index.h.

template<typename Distance >
FLANN_DEPRECATED float rtflann::AutotunedIndex< Distance >::getSpeedup ( ) const [inline]

Definition at line 310 of file autotuned_index.h.

template<typename Distance >
flann_algorithm_t rtflann::AutotunedIndex< Distance >::getType ( ) const [inline, virtual]

Algorithm name

Implements rtflann::IndexBase.

Definition at line 343 of file autotuned_index.h.

template<typename Distance >
int rtflann::AutotunedIndex< Distance >::knnSearch ( const Matrix< ElementType > &  queries,
Matrix< size_t > &  indices,
Matrix< DistanceType > &  dists,
size_t  knn,
const SearchParams params 
) const [inline, virtual]

Perform k-nearest neighbor search.

Parameters:
[in]queriesThe query points for which to find the nearest neighbors
[out]indicesThe indices of the nearest neighbors found
[out]distsDistances to the nearest neighbors found
[in]knnNumber of nearest neighbors to return
[in]paramsSearch parameters

Reimplemented from rtflann::NNIndex< Distance >.

Definition at line 232 of file autotuned_index.h.

template<typename Distance >
int rtflann::AutotunedIndex< Distance >::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 [inline]

Perform k-nearest neighbor search.

Parameters:
[in]queriesThe query points for which to find the nearest neighbors
[out]indicesThe indices of the nearest neighbors found
[out]distsDistances to the nearest neighbors found
[in]knnNumber of nearest neighbors to return
[in]paramsSearch parameters

Reimplemented from rtflann::NNIndex< Distance >.

Definition at line 246 of file autotuned_index.h.

template<typename Distance >
void rtflann::AutotunedIndex< Distance >::loadIndex ( FILE *  stream) [inline, virtual]

Implements rtflann::IndexBase.

Definition at line 219 of file autotuned_index.h.

template<typename Distance >
AutotunedIndex& rtflann::AutotunedIndex< Distance >::operator= ( AutotunedIndex< Distance >  other) [inline]

Definition at line 116 of file autotuned_index.h.

template<typename Distance >
void rtflann::AutotunedIndex< Distance >::optimizeKDTree ( std::vector< CostData > &  costs) [inline, private]

Definition at line 518 of file autotuned_index.h.

template<typename Distance >
void rtflann::AutotunedIndex< Distance >::optimizeKMeans ( std::vector< CostData > &  costs) [inline, private]

Definition at line 470 of file autotuned_index.h.

template<typename Distance >
int rtflann::AutotunedIndex< Distance >::radiusSearch ( const Matrix< ElementType > &  queries,
Matrix< size_t > &  indices,
Matrix< DistanceType > &  dists,
DistanceType  radius,
const SearchParams params 
) const [inline]

Definition at line 261 of file autotuned_index.h.

template<typename Distance >
int rtflann::AutotunedIndex< Distance >::radiusSearch ( const Matrix< ElementType > &  queries,
std::vector< std::vector< size_t > > &  indices,
std::vector< std::vector< DistanceType > > &  dists,
DistanceType  radius,
const SearchParams params 
) const [inline]

Definition at line 275 of file autotuned_index.h.

template<typename Distance >
void rtflann::AutotunedIndex< Distance >::removePoint ( size_t  id) [inline, virtual]

Remove point from the index

Parameters:
indexIndex of point to be removed

Reimplemented from rtflann::NNIndex< Distance >.

Definition at line 171 of file autotuned_index.h.

template<typename Distance >
void rtflann::AutotunedIndex< Distance >::saveIndex ( FILE *  stream) [inline, virtual]

Implements rtflann::IndexBase.

Definition at line 209 of file autotuned_index.h.

template<typename Distance >
template<typename Archive >
void rtflann::AutotunedIndex< Distance >::serialize ( Archive &  ar) [inline]

Reimplemented from rtflann::NNIndex< Distance >.

Definition at line 180 of file autotuned_index.h.

template<typename Distance >
size_t rtflann::AutotunedIndex< Distance >::size ( ) const [inline, virtual]

Number of features in this index.

Reimplemented from rtflann::NNIndex< Distance >.

Definition at line 319 of file autotuned_index.h.

template<typename Distance >
void rtflann::AutotunedIndex< Distance >::swap ( AutotunedIndex< Distance > &  other) [inline, private]

Definition at line 720 of file autotuned_index.h.

template<typename Distance >
int rtflann::AutotunedIndex< Distance >::usedMemory ( ) const [inline, virtual]

The amount of memory (in bytes) this index uses.

Implements rtflann::IndexBase.

Definition at line 335 of file autotuned_index.h.

template<typename Distance >
size_t rtflann::AutotunedIndex< Distance >::veclen ( ) const [inline, virtual]

The length of each vector in this index.

Reimplemented from rtflann::NNIndex< Distance >.

Definition at line 327 of file autotuned_index.h.


Member Data Documentation

template<typename Distance >
NNIndex<Distance>* rtflann::AutotunedIndex< Distance >::bestIndex_ [private]

Definition at line 735 of file autotuned_index.h.

template<typename Distance >
IndexParams rtflann::AutotunedIndex< Distance >::bestParams_ [private]

Definition at line 737 of file autotuned_index.h.

template<typename Distance >
SearchParams rtflann::AutotunedIndex< Distance >::bestSearchParams_ [private]

Definition at line 738 of file autotuned_index.h.

template<typename Distance >
float rtflann::AutotunedIndex< Distance >::build_weight_ [private]

Definition at line 755 of file autotuned_index.h.

template<typename Distance >
Matrix<ElementType> rtflann::AutotunedIndex< Distance >::dataset_ [private]

The dataset used by this index

Definition at line 749 of file autotuned_index.h.

template<typename Distance >
Matrix<size_t> rtflann::AutotunedIndex< Distance >::gt_matches_ [private]

Definition at line 742 of file autotuned_index.h.

template<typename Distance >
float rtflann::AutotunedIndex< Distance >::memory_weight_ [private]

Definition at line 756 of file autotuned_index.h.

template<typename Distance >
float rtflann::AutotunedIndex< Distance >::sample_fraction_ [private]

Definition at line 757 of file autotuned_index.h.

template<typename Distance >
Matrix<ElementType> rtflann::AutotunedIndex< Distance >::sampledDataset_ [private]

Definition at line 740 of file autotuned_index.h.

template<typename Distance >
float rtflann::AutotunedIndex< Distance >::speedup_ [private]

Definition at line 744 of file autotuned_index.h.

template<typename Distance >
float rtflann::AutotunedIndex< Distance >::target_precision_ [private]

Index parameters

Definition at line 754 of file autotuned_index.h.

template<typename Distance >
Matrix<ElementType> rtflann::AutotunedIndex< Distance >::testDataset_ [private]

Definition at line 741 of file autotuned_index.h.


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


rtabmap
Author(s): Mathieu Labbe
autogenerated on Sat Jul 23 2016 11:44:32