ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
knncpp::MultiIndexHashing< Scalar > Class Template Reference

#include <knncpp.h>

Public Types

typedef Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic > Matrix
 
typedef Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > Vector
 
typedef knncpp::Matrixi Matrixi
 

Public Member Functions

 MultiIndexHashing ()
 
 MultiIndexHashing (const Matrix &data, const bool copy=false)
 
void setMaxDistance (const Scalar maxDist)
 
void setSorted (const bool sorted)
 
void setThreads (const unsigned int threads)
 
void setSubstringLength (const Index len)
 
void setData (const Matrix &data, const bool copy=false)
 
void build ()
 
template<typename Derived >
void query (const Eigen::MatrixBase< Derived > &queryPoints, const size_t knn, Matrixi &indices, Matrix &distances) const
 
Index size () const
 
Index dimension () const
 
void clear ()
 

Detailed Description

template<typename Scalar>
class knncpp::MultiIndexHashing< Scalar >

Class for performing KNN search in hamming space by multi-index hashing.

Definition at line 1118 of file knncpp.h.

Member Typedef Documentation

◆ Matrix

template<typename Scalar >
typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> knncpp::MultiIndexHashing< Scalar >::Matrix

Definition at line 1123 of file knncpp.h.

◆ Matrixi

template<typename Scalar >
typedef knncpp::Matrixi knncpp::MultiIndexHashing< Scalar >::Matrixi

Definition at line 1125 of file knncpp.h.

◆ Vector

template<typename Scalar >
typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 1> knncpp::MultiIndexHashing< Scalar >::Vector

Definition at line 1124 of file knncpp.h.

Constructor & Destructor Documentation

◆ MultiIndexHashing() [1/2]

template<typename Scalar >
knncpp::MultiIndexHashing< Scalar >::MultiIndexHashing ( )
inline

Definition at line 1160 of file knncpp.h.

◆ MultiIndexHashing() [2/2]

template<typename Scalar >
knncpp::MultiIndexHashing< Scalar >::MultiIndexHashing ( const Matrix data,
const bool  copy = false 
)
inline

Constructs an index with the given data. This does not build the the index.

Parameters
dataNxM matrix, M points of dimension N
copyif true copies the data, otherwise assumes static data

Definition at line 1173 of file knncpp.h.

References copy, and knncpp::MultiIndexHashing< Scalar >::setData().

Member Function Documentation

◆ build()

template<typename Scalar >
void knncpp::MultiIndexHashing< Scalar >::build ( )
inline

Definition at line 1212 of file knncpp.h.

References offset.

◆ clear()

template<typename Scalar >
void knncpp::MultiIndexHashing< Scalar >::clear ( void  )
inline

Definition at line 1317 of file knncpp.h.

Referenced by knncpp::MultiIndexHashing< Scalar >::setData().

◆ dimension()

template<typename Scalar >
Index knncpp::MultiIndexHashing< Scalar >::dimension ( ) const
inline

Returns the dimension of the data points in the search index.

Returns
dimension of data points

Definition at line 1315 of file knncpp.h.

Referenced by knncpp::MultiIndexHashing< Scalar >::query().

◆ query()

template<typename Scalar >
template<typename Derived >
void knncpp::MultiIndexHashing< Scalar >::query ( const Eigen::MatrixBase< Derived > &  queryPoints,
const size_t  knn,
Matrixi indices,
Matrix distances 
) const
inline

◆ setData()

template<typename Scalar >
void knncpp::MultiIndexHashing< Scalar >::setData ( const Matrix data,
const bool  copy = false 
)
inline

Set the data points used for the KNN search.

Parameters
dataNxM matrix, M points of dimension N
copyif true data is copied, assumes static data otherwise

Definition at line 1202 of file knncpp.h.

References knncpp::MultiIndexHashing< Scalar >::clear(), and copy.

Referenced by knncpp::MultiIndexHashing< Scalar >::MultiIndexHashing().

◆ setMaxDistance()

template<typename Scalar >
void knncpp::MultiIndexHashing< Scalar >::setMaxDistance ( const Scalar  maxDist)
inline

Set the maximum distance for querying the index. Note that if no maximum distance is used, this algorithm performs basically a brute force search.

Parameters
maxDistmaximum distance, <= 0 for no limit

Definition at line 1182 of file knncpp.h.

◆ setSorted()

template<typename Scalar >
void knncpp::MultiIndexHashing< Scalar >::setSorted ( const bool  sorted)
inline

Set if the points returned by the queries should be sorted according to their distance to the query points.

Parameters
sortedsort query results

Definition at line 1187 of file knncpp.h.

◆ setSubstringLength()

template<typename Scalar >
void knncpp::MultiIndexHashing< Scalar >::setSubstringLength ( const Index  len)
inline

Set the length of substrings (in bytes) used for multi index hashing.

Parameters
lenlentth of bucket substrings in bytes

Definition at line 1197 of file knncpp.h.

◆ setThreads()

template<typename Scalar >
void knncpp::MultiIndexHashing< Scalar >::setThreads ( const unsigned int  threads)
inline

Set the amount of threads that should be used for building and querying the tree. OpenMP has to be enabled for this to work.

Parameters
threadsamount of threads, 0 for optimal choice

Definition at line 1193 of file knncpp.h.

◆ size()

template<typename Scalar >
Index knncpp::MultiIndexHashing< Scalar >::size ( void  ) const
inline

Returns the amount of data points stored in the search index.

Returns
number of data points

Definition at line 1311 of file knncpp.h.


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