#include <autotuned_index.h>
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 ¶ms=AutotunedIndexParams(), Distance d=Distance()) | |
AutotunedIndex (const IndexParams ¶ms=AutotunedIndexParams(), Distance d=Distance()) | |
AutotunedIndex (const AutotunedIndex &other) | |
void | buildIndex () |
void | buildIndex (const Matrix< ElementType > &dataset) |
BaseClass * | clone () 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 ¶ms) 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 ¶ms) const |
Perform k-nearest neighbor search. | |
void | loadIndex (FILE *stream) |
AutotunedIndex & | operator= (AutotunedIndex other) |
int | radiusSearch (const Matrix< ElementType > &queries, Matrix< size_t > &indices, Matrix< DistanceType > &dists, DistanceType radius, const SearchParams ¶ms) const |
int | radiusSearch (const Matrix< ElementType > &queries, std::vector< std::vector< size_t > > &indices, std::vector< std::vector< DistanceType > > &dists, DistanceType radius, const SearchParams ¶ms) 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< ElementType > | dataset_ |
Matrix< size_t > | gt_matches_ |
float | memory_weight_ |
float | sample_fraction_ |
Matrix< ElementType > | sampledDataset_ |
float | speedup_ |
float | target_precision_ |
Matrix< ElementType > | testDataset_ |
Definition at line 73 of file autotuned_index.h.
typedef NNIndex<Distance> rtflann::AutotunedIndex< Distance >::BaseClass |
Definition at line 79 of file autotuned_index.h.
typedef Distance::ResultType rtflann::AutotunedIndex< Distance >::DistanceType |
Reimplemented from rtflann::NNIndex< Distance >.
Definition at line 77 of file autotuned_index.h.
typedef Distance::ElementType rtflann::AutotunedIndex< Distance >::ElementType |
Reimplemented from rtflann::NNIndex< Distance >.
Definition at line 76 of file autotuned_index.h.
typedef AutotunedIndex<Distance> rtflann::AutotunedIndex< Distance >::IndexType |
Definition at line 81 of file autotuned_index.h.
typedef bool rtflann::AutotunedIndex< Distance >::needs_kdtree_distance |
Definition at line 83 of file autotuned_index.h.
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.
rtflann::AutotunedIndex< Distance >::AutotunedIndex | ( | const IndexParams & | params = AutotunedIndexParams() , |
Distance | d = Distance() |
||
) | [inline] |
Definition at line 94 of file autotuned_index.h.
rtflann::AutotunedIndex< Distance >::AutotunedIndex | ( | const AutotunedIndex< Distance > & | other | ) | [inline] |
Definition at line 103 of file autotuned_index.h.
virtual rtflann::AutotunedIndex< Distance >::~AutotunedIndex | ( | ) | [inline, virtual] |
Definition at line 122 of file autotuned_index.h.
void rtflann::AutotunedIndex< Distance >::addPoints | ( | const Matrix< ElementType > & | points, |
float | rebuild_threshold = 2 |
||
) | [inline, virtual] |
Incrementally add points to the index.
points | Matrix with points to be added |
rebuild_threshold |
Reimplemented from rtflann::NNIndex< Distance >.
Definition at line 164 of file autotuned_index.h.
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.
void rtflann::AutotunedIndex< Distance >::buildIndex | ( | const Matrix< ElementType > & | dataset | ) | [inline, virtual] |
Builds the index using the specified dataset
dataset | the dataset to use |
Reimplemented from rtflann::NNIndex< Distance >.
Definition at line 157 of file autotuned_index.h.
void rtflann::AutotunedIndex< Distance >::buildIndexImpl | ( | ) | [inline, protected, virtual] |
Implements rtflann::NNIndex< Distance >.
Definition at line 349 of file autotuned_index.h.
BaseClass* rtflann::AutotunedIndex< Distance >::clone | ( | ) | const [inline, virtual] |
Implements rtflann::NNIndex< Distance >.
Definition at line 127 of file autotuned_index.h.
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.
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.
void rtflann::AutotunedIndex< Distance >::evaluate_kdtree | ( | CostData & | cost | ) | [inline, private] |
Definition at line 397 of file autotuned_index.h.
void rtflann::AutotunedIndex< Distance >::evaluate_kmeans | ( | CostData & | cost | ) | [inline, private] |
Definition at line 370 of file autotuned_index.h.
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.
void rtflann::AutotunedIndex< Distance >::freeIndex | ( | ) | [inline, protected, virtual] |
Implements rtflann::NNIndex< Distance >.
Definition at line 354 of file autotuned_index.h.
IndexParams rtflann::AutotunedIndex< Distance >::getParameters | ( | ) | const [inline, virtual] |
Returns the parameters used by the index.
Reimplemented from rtflann::NNIndex< Distance >.
Definition at line 300 of file autotuned_index.h.
FLANN_DEPRECATED SearchParams rtflann::AutotunedIndex< Distance >::getSearchParameters | ( | ) | const [inline] |
Definition at line 305 of file autotuned_index.h.
FLANN_DEPRECATED float rtflann::AutotunedIndex< Distance >::getSpeedup | ( | ) | const [inline] |
Definition at line 310 of file autotuned_index.h.
flann_algorithm_t rtflann::AutotunedIndex< Distance >::getType | ( | ) | const [inline, virtual] |
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.
[in] | queries | The query points for which to find the nearest neighbors |
[out] | indices | The indices of the nearest neighbors found |
[out] | dists | Distances to the nearest neighbors found |
[in] | knn | Number of nearest neighbors to return |
[in] | params | Search parameters |
Reimplemented from rtflann::NNIndex< Distance >.
Definition at line 232 of file autotuned_index.h.
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.
[in] | queries | The query points for which to find the nearest neighbors |
[out] | indices | The indices of the nearest neighbors found |
[out] | dists | Distances to the nearest neighbors found |
[in] | knn | Number of nearest neighbors to return |
[in] | params | Search parameters |
Reimplemented from rtflann::NNIndex< Distance >.
Definition at line 246 of file autotuned_index.h.
void rtflann::AutotunedIndex< Distance >::loadIndex | ( | FILE * | stream | ) | [inline, virtual] |
Implements rtflann::IndexBase.
Definition at line 219 of file autotuned_index.h.
AutotunedIndex& rtflann::AutotunedIndex< Distance >::operator= | ( | AutotunedIndex< Distance > | other | ) | [inline] |
Definition at line 116 of file autotuned_index.h.
void rtflann::AutotunedIndex< Distance >::optimizeKDTree | ( | std::vector< CostData > & | costs | ) | [inline, private] |
Definition at line 518 of file autotuned_index.h.
void rtflann::AutotunedIndex< Distance >::optimizeKMeans | ( | std::vector< CostData > & | costs | ) | [inline, private] |
Definition at line 470 of file autotuned_index.h.
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.
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.
void rtflann::AutotunedIndex< Distance >::removePoint | ( | size_t | id | ) | [inline, virtual] |
Remove point from the index
index | Index of point to be removed |
Reimplemented from rtflann::NNIndex< Distance >.
Definition at line 171 of file autotuned_index.h.
void rtflann::AutotunedIndex< Distance >::saveIndex | ( | FILE * | stream | ) | [inline, virtual] |
Implements rtflann::IndexBase.
Definition at line 209 of file autotuned_index.h.
void rtflann::AutotunedIndex< Distance >::serialize | ( | Archive & | ar | ) | [inline] |
Reimplemented from rtflann::NNIndex< Distance >.
Definition at line 180 of file autotuned_index.h.
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.
void rtflann::AutotunedIndex< Distance >::swap | ( | AutotunedIndex< Distance > & | other | ) | [inline, private] |
Definition at line 720 of file autotuned_index.h.
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.
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.
NNIndex<Distance>* rtflann::AutotunedIndex< Distance >::bestIndex_ [private] |
Definition at line 735 of file autotuned_index.h.
IndexParams rtflann::AutotunedIndex< Distance >::bestParams_ [private] |
Definition at line 737 of file autotuned_index.h.
SearchParams rtflann::AutotunedIndex< Distance >::bestSearchParams_ [private] |
Definition at line 738 of file autotuned_index.h.
float rtflann::AutotunedIndex< Distance >::build_weight_ [private] |
Definition at line 755 of file autotuned_index.h.
Matrix<ElementType> rtflann::AutotunedIndex< Distance >::dataset_ [private] |
The dataset used by this index
Definition at line 749 of file autotuned_index.h.
Matrix<size_t> rtflann::AutotunedIndex< Distance >::gt_matches_ [private] |
Definition at line 742 of file autotuned_index.h.
float rtflann::AutotunedIndex< Distance >::memory_weight_ [private] |
Definition at line 756 of file autotuned_index.h.
float rtflann::AutotunedIndex< Distance >::sample_fraction_ [private] |
Definition at line 757 of file autotuned_index.h.
Matrix<ElementType> rtflann::AutotunedIndex< Distance >::sampledDataset_ [private] |
Definition at line 740 of file autotuned_index.h.
float rtflann::AutotunedIndex< Distance >::speedup_ [private] |
Definition at line 744 of file autotuned_index.h.
float rtflann::AutotunedIndex< Distance >::target_precision_ [private] |
Index parameters
Definition at line 754 of file autotuned_index.h.
Matrix<ElementType> rtflann::AutotunedIndex< Distance >::testDataset_ [private] |
Definition at line 741 of file autotuned_index.h.