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.

Member Typedef Documentation

◆ Matrix

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

◆ Matrixi

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

◆ Vector

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

Constructor & Destructor Documentation

◆ MultiIndexHashing() [1/2]

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

◆ 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

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

Member Function Documentation

◆ build()

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

References data, and offset.

◆ clear()

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

◆ 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

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

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

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

◆ 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

◆ 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

◆ 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

◆ size()

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

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

Returns
number of data points

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