MultiIndex
Public Member Functions | Private Member Functions | Private Attributes
MultiSearcher< Record, MetaInfo > Class Template Reference

#include <searcher.h>

Collaboration diagram for MultiSearcher< Record, MetaInfo >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 MultiSearcher ()
void Init (const string &index_files_prefix, const string &coarse_vocabs_filename, const string &fine_vocabs_filename, const RerankMode &mode, const int subspace_centroids_to_consider, bool do_rerank)
void GetNearestNeighbours (const Point &point, int k, vector< pair< Distance, MetaInfo > > *neighbours) const
PerfTesterGetPerfTester ()

Private Member Functions

void DeserializeData (const string &index_files_prefix, const string &coarse_vocabs_filename, const string &fine_vocabs_filename)
void GetNearestSubspacesCentroids (const Point &point, const int subspace_centroins_count, vector< NearestSubspaceCentroids > *subspaces_short_lists) const
bool TraverseNextMultiIndexCell (const Point &point, vector< pair< Distance, MetaInfo > > *nearest_subpoints) const
void GetCellEdgesInMultiIndexArray (const vector< int > &cell_coordinates, int *cell_start, int *cell_finish) const
void InitBlasStructures ()

Private Attributes

vector< Centroidscoarse_vocabs_
vector< Centroidsfine_vocabs_
OrderedListsMerger< Distance,
ClusterId
merger_
bool do_rerank_
PerfTester perf_tester_
string index_files_prefix_
MultiIndex< Record > multiindex_
RerankMode rerank_mode_
vector< float * > coarse_vocabs_matrices_
vector< vector< float > > coarse_centroids_norms_
Coordproducts_
vector< Coordquery_norms_
float * residual_
int subspace_centroids_to_consider_
int found_neghbours_count_

Detailed Description

template<class Record, class MetaInfo>
class MultiSearcher< Record, MetaInfo >

This is the main class for nearest neighbour search using multiindex


Constructor & Destructor Documentation

template<class Record , class MetaInfo >
MultiSearcher< Record, MetaInfo >::MultiSearcher ( )

Default constructor


Member Function Documentation

template<class Record , class MetaInfo >
void MultiSearcher< Record, MetaInfo >::DeserializeData ( const string &  index_files_prefix,
const string &  coarse_vocabs_filename,
const string &  fine_vocabs_filename 
) [private]

This functions deserializes all structures for search

Parameters:
index_files_prefixprefix of multiindex files providing the search
coarse_vocabs_filenamefile with coarse vocabs
fine_vocabs_filenamefile with fine vocabs for reranking
template<class Record , class MetaInfo >
void MultiSearcher< Record, MetaInfo >::GetCellEdgesInMultiIndexArray ( const vector< int > &  cell_coordinates,
int *  cell_start,
int *  cell_finish 
) const [inline, private]

This fuctions converts cells coordinates to appropriate range in array

Parameters:
cell_coordinatescoordinates of the cell
cell_startfirst index of range
cell_finishlast index of range
template<class Record , class MetaInfo >
void MultiSearcher< Record, MetaInfo >::GetNearestNeighbours ( const Point point,
int  k,
vector< pair< Distance, MetaInfo > > *  neighbours 
) const

Main interface function

Parameters:
pointquery point
knumber of neighbours to get
subpace_centroids_to_considerit defines the size of working index table
neighboursresult - vector of point identifiers ordered by increasing of distance to query
template<class Record , class MetaInfo >
void MultiSearcher< Record, MetaInfo >::GetNearestSubspacesCentroids ( const Point point,
const int  subspace_centroins_count,
vector< NearestSubspaceCentroids > *  subspaces_short_lists 
) const [private]

Function gets some nearest centroids for each coarse subspace

Parameters:
pointquery point
subspace_centroins_counthow many nearest subcentroids to get
subspaces_short_listsresult
template<class Record , class MetaInfo >
PerfTester & MultiSearcher< Record, MetaInfo >::GetPerfTester ( )

Returns searcher perfomance tester

template<class Record , class MetaInfo >
void MultiSearcher< Record, MetaInfo >::Init ( const string &  index_files_prefix,
const string &  coarse_vocabs_filename,
const string &  fine_vocabs_filename,
const RerankMode mode,
const int  subspace_centroids_to_consider,
bool  do_rerank 
)

Initiation function

Parameters:
index_files_prefixprefix of multiindex files providing the search
coarse_vocabs_filenamefile with coarse vocabs
fine_vocabs_filenamefile with fine vocabs for reranking
modereranking approach
do_rerankshould algorithm rerank short list or not
template<class Record , class MetaInfo >
void MultiSearcher< Record, MetaInfo >::InitBlasStructures ( ) [private]

This fuctions converts complex objects to arrays and pointers for usage in BLAS

template<class Record , class MetaInfo >
bool MultiSearcher< Record, MetaInfo >::TraverseNextMultiIndexCell ( const Point point,
vector< pair< Distance, MetaInfo > > *  nearest_subpoints 
) const [private]

This fuctions traverses another cell of multiindex table

Parameters:
pointquery point
nearest_subpointsvector algorithm adds nearest neighbours in

Member Data Documentation

template<class Record , class MetaInfo >
vector<vector<float> > MultiSearcher< Record, MetaInfo >::coarse_centroids_norms_ [private]

Struct for BLAS

template<class Record , class MetaInfo >
vector<Centroids> MultiSearcher< Record, MetaInfo >::coarse_vocabs_ [private]

Lists of coarse centroids

template<class Record , class MetaInfo >
vector<float*> MultiSearcher< Record, MetaInfo >::coarse_vocabs_matrices_ [private]

Struct for BLAS

template<class Record , class MetaInfo >
bool MultiSearcher< Record, MetaInfo >::do_rerank_ [private]

Should algorithm use reranking or not

template<class Record , class MetaInfo >
vector<Centroids> MultiSearcher< Record, MetaInfo >::fine_vocabs_ [private]

Lists of fine centroids

template<class Record , class MetaInfo >
int MultiSearcher< Record, MetaInfo >::found_neghbours_count_ [mutable, private]

Number of neighbours found to this moment

template<class Record , class MetaInfo >
string MultiSearcher< Record, MetaInfo >::index_files_prefix_ [private]

Common prefix of every index files

template<class Record , class MetaInfo >
OrderedListsMerger<Distance, ClusterId> MultiSearcher< Record, MetaInfo >::merger_ [mutable, private]

Merger for ordered merging subspaces centroids lists

template<class Record , class MetaInfo >
MultiIndex<Record> MultiSearcher< Record, MetaInfo >::multiindex_ [private]

Multiindex data structures

template<class Record , class MetaInfo >
PerfTester MultiSearcher< Record, MetaInfo >::perf_tester_ [mutable, private]

Searcher perfomance tester

template<class Record , class MetaInfo >
Coord* MultiSearcher< Record, MetaInfo >::products_ [mutable, private]

Struct for BLAS

template<class Record , class MetaInfo >
vector<Coord> MultiSearcher< Record, MetaInfo >::query_norms_ [mutable, private]

Struct for BLAS

template<class Record , class MetaInfo >
RerankMode MultiSearcher< Record, MetaInfo >::rerank_mode_ [private]

Reranking approach

template<class Record , class MetaInfo >
float* MultiSearcher< Record, MetaInfo >::residual_ [mutable, private]

Struct for BLAS

template<class Record , class MetaInfo >
int MultiSearcher< Record, MetaInfo >::subspace_centroids_to_consider_ [private]

Number of nearest to query centroids to consider for each dimension


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator