#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 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... | |
AutotunedIndex (const AutotunedIndex &other) | |
AutotunedIndex (const IndexParams ¶ms=AutotunedIndexParams(), Distance d=Distance()) | |
AutotunedIndex (const Matrix< ElementType > &inputData, const IndexParams ¶ms=AutotunedIndexParams(), Distance d=Distance()) | |
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. More... | |
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... | |
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 () |
Public Member Functions inherited from rtflann::NNIndex< Distance > | |
IndexParams | getParameters () const |
virtual ElementType * | getPoint (size_t id) |
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 |
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 () |
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 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_ |
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_ |
Definition at line 101 of file autotuned_index.h.
typedef NNIndex<Distance> rtflann::AutotunedIndex< Distance >::BaseClass |
Definition at line 107 of file autotuned_index.h.
typedef Distance::ResultType rtflann::AutotunedIndex< Distance >::DistanceType |
Definition at line 105 of file autotuned_index.h.
typedef Distance::ElementType rtflann::AutotunedIndex< Distance >::ElementType |
Definition at line 104 of file autotuned_index.h.
typedef AutotunedIndex<Distance> rtflann::AutotunedIndex< Distance >::IndexType |
Definition at line 109 of file autotuned_index.h.
typedef bool rtflann::AutotunedIndex< Distance >::needs_kdtree_distance |
Definition at line 111 of file autotuned_index.h.
|
inline |
Definition at line 113 of file autotuned_index.h.
|
inline |
Definition at line 122 of file autotuned_index.h.
|
inline |
Definition at line 131 of file autotuned_index.h.
|
inlinevirtual |
Definition at line 150 of file autotuned_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 192 of file autotuned_index.h.
|
inlinevirtual |
Method responsible with building the index.
Reimplemented from rtflann::NNIndex< Distance >.
Definition at line 163 of file autotuned_index.h.
|
inlinevirtual |
Builds the index using the specified dataset
dataset | the dataset to use |
Reimplemented from rtflann::NNIndex< Distance >.
Definition at line 185 of file autotuned_index.h.
|
inlineprotectedvirtual |
Implements rtflann::NNIndex< Distance >.
Definition at line 377 of file autotuned_index.h.
|
inlinevirtual |
Implements rtflann::NNIndex< Distance >.
Definition at line 155 of file autotuned_index.h.
|
inlineprivate |
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 588 of file autotuned_index.h.
|
inlineprivate |
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 675 of file autotuned_index.h.
|
inlineprivate |
Definition at line 425 of file autotuned_index.h.
|
inlineprivate |
Definition at line 398 of file autotuned_index.h.
|
inlinevirtual |
Method that searches for nearest-neighbors
Implements rtflann::NNIndex< Distance >.
Definition at line 322 of file autotuned_index.h.
|
inlineprotectedvirtual |
Implements rtflann::NNIndex< Distance >.
Definition at line 382 of file autotuned_index.h.
|
inlinevirtual |
Implements rtflann::IndexBase.
Definition at line 328 of file autotuned_index.h.
|
inline |
Definition at line 333 of file autotuned_index.h.
|
inline |
Definition at line 338 of file autotuned_index.h.
|
inlinevirtual |
|
inlinevirtual |
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 260 of file autotuned_index.h.
|
inlinevirtual |
Perform k-nearest neighbor search.
queries | |
indices | |
dists | |
knn | |
params |
[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 274 of file autotuned_index.h.
|
inlinevirtual |
Implements rtflann::IndexBase.
Definition at line 247 of file autotuned_index.h.
|
inline |
Definition at line 144 of file autotuned_index.h.
|
inlineprivate |
Definition at line 546 of file autotuned_index.h.
|
inlineprivate |
Definition at line 498 of file autotuned_index.h.
|
inline |
Definition at line 289 of file autotuned_index.h.
|
inline |
Definition at line 303 of file autotuned_index.h.
|
inlinevirtual |
Remove point from the index
index | Index of point to be removed |
Reimplemented from rtflann::NNIndex< Distance >.
Definition at line 199 of file autotuned_index.h.
|
inlinevirtual |
Implements rtflann::IndexBase.
Definition at line 237 of file autotuned_index.h.
|
inline |
Definition at line 208 of file autotuned_index.h.
|
inlinevirtual |
Number of features in this index.
Implements rtflann::IndexBase.
Definition at line 347 of file autotuned_index.h.
|
inlineprivate |
Definition at line 748 of file autotuned_index.h.
|
inlinevirtual |
The amount of memory (in bytes) this index uses.
Implements rtflann::IndexBase.
Definition at line 363 of file autotuned_index.h.
|
inlinevirtual |
The length of each vector in this index.
Implements rtflann::IndexBase.
Definition at line 355 of file autotuned_index.h.
|
private |
Definition at line 763 of file autotuned_index.h.
|
private |
Definition at line 765 of file autotuned_index.h.
|
private |
Definition at line 766 of file autotuned_index.h.
|
private |
Definition at line 783 of file autotuned_index.h.
|
private |
The dataset used by this index
Definition at line 777 of file autotuned_index.h.
|
private |
Definition at line 770 of file autotuned_index.h.
|
private |
Definition at line 784 of file autotuned_index.h.
|
private |
Definition at line 785 of file autotuned_index.h.
|
private |
Definition at line 768 of file autotuned_index.h.
|
private |
Definition at line 772 of file autotuned_index.h.
|
private |
Index parameters
Definition at line 782 of file autotuned_index.h.
|
private |
Definition at line 769 of file autotuned_index.h.