#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 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. 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 (Distance d) | |
NNIndex (const IndexParams ¶ms, Distance d) | |
NNIndex (const NNIndex &other) | |
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, Matrix< int > &indices, Matrix< 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... | |
int | radiusSearch (const Matrix< ElementType > &queries, std::vector< std::vector< int > > &indices, std::vector< std::vector< DistanceType > > &dists, float radius, const SearchParams ¶ms) 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 () |
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 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 |
Definition at line 77 of file autotuned_index.h.
typedef Distance::ElementType rtflann::AutotunedIndex< Distance >::ElementType |
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.
|
inline |
Definition at line 85 of file autotuned_index.h.
|
inline |
Definition at line 94 of file autotuned_index.h.
|
inline |
Definition at line 103 of file autotuned_index.h.
|
inlinevirtual |
Definition at line 122 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 164 of file autotuned_index.h.
|
inlinevirtual |
Method responsible with building the index.
Reimplemented from rtflann::NNIndex< Distance >.
Definition at line 135 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 157 of file autotuned_index.h.
|
inlineprotectedvirtual |
Implements rtflann::NNIndex< Distance >.
Definition at line 349 of file autotuned_index.h.
|
inlinevirtual |
Implements rtflann::NNIndex< Distance >.
Definition at line 127 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 560 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 647 of file autotuned_index.h.
|
inlineprivate |
Definition at line 397 of file autotuned_index.h.
|
inlineprivate |
Definition at line 370 of file autotuned_index.h.
|
inlinevirtual |
Method that searches for nearest-neighbors
Implements rtflann::NNIndex< Distance >.
Definition at line 294 of file autotuned_index.h.
|
inlineprotectedvirtual |
Implements rtflann::NNIndex< Distance >.
Definition at line 354 of file autotuned_index.h.
|
inlinevirtual |
Implements rtflann::IndexBase.
Definition at line 300 of file autotuned_index.h.
|
inline |
Definition at line 305 of file autotuned_index.h.
|
inline |
Definition at line 310 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 232 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 246 of file autotuned_index.h.
|
inlinevirtual |
Implements rtflann::IndexBase.
Definition at line 219 of file autotuned_index.h.
|
inline |
Definition at line 116 of file autotuned_index.h.
|
inlineprivate |
Definition at line 518 of file autotuned_index.h.
|
inlineprivate |
Definition at line 470 of file autotuned_index.h.
|
inline |
Definition at line 261 of file autotuned_index.h.
|
inline |
Definition at line 275 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 171 of file autotuned_index.h.
|
inlinevirtual |
Implements rtflann::IndexBase.
Definition at line 209 of file autotuned_index.h.
|
inline |
Definition at line 180 of file autotuned_index.h.
|
inlinevirtual |
Number of features in this index.
Implements rtflann::IndexBase.
Definition at line 319 of file autotuned_index.h.
|
inlineprivate |
Definition at line 720 of file autotuned_index.h.
|
inlinevirtual |
The amount of memory (in bytes) this index uses.
Implements rtflann::IndexBase.
Definition at line 335 of file autotuned_index.h.
|
inlinevirtual |
The length of each vector in this index.
Implements rtflann::IndexBase.
Definition at line 327 of file autotuned_index.h.
|
private |
Definition at line 735 of file autotuned_index.h.
|
private |
Definition at line 737 of file autotuned_index.h.
|
private |
Definition at line 738 of file autotuned_index.h.
|
private |
Definition at line 755 of file autotuned_index.h.
|
private |
The dataset used by this index
Definition at line 749 of file autotuned_index.h.
|
private |
Definition at line 742 of file autotuned_index.h.
|
private |
Definition at line 756 of file autotuned_index.h.
|
private |
Definition at line 757 of file autotuned_index.h.
|
private |
Definition at line 740 of file autotuned_index.h.
|
private |
Definition at line 744 of file autotuned_index.h.
|
private |
Index parameters
Definition at line 754 of file autotuned_index.h.
|
private |
Definition at line 741 of file autotuned_index.h.