ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
flann::KDTreeCuda3dIndex< Distance > Class Template Reference

#include <kdtree_cuda_3d_index.h>

Inheritance diagram for flann::KDTreeCuda3dIndex< Distance >:
Collaboration diagram for flann::KDTreeCuda3dIndex< Distance >:

Public Types

typedef Distance::ElementType ElementType
 
typedef Distance::ResultType DistanceType
 
typedef NNIndex< DistanceBaseClass
 
typedef bool needs_kdtree_distance
 
- Public Types inherited from flann::NNIndex< Distance >
typedef Distance::ElementType ElementType
 
typedef Distance::ResultType DistanceType
 

Public Member Functions

 KDTreeCuda3dIndex (const Matrix< ElementType > &inputData, const IndexParams &params=KDTreeCuda3dIndexParams(), Distance d=Distance())
 
 KDTreeCuda3dIndex (const KDTreeCuda3dIndex &other)
 
KDTreeCuda3dIndex operator= (KDTreeCuda3dIndex other)
 
 ~KDTreeCuda3dIndex ()
 
BaseClassclone () const
 
void buildIndex ()
 
flann_algorithm_t getType () const
 
void removePoint (size_t index)
 
ElementTypegetPoint (size_t id)
 
void saveIndex (FILE *stream)
 
void loadIndex (FILE *stream)
 
size_t veclen () const
 
int usedMemory () const
 
int knnSearch (const Matrix< ElementType > &queries, Matrix< int > &indices, Matrix< DistanceType > &dists, size_t knn, const SearchParams &params) const
 Perform k-nearest neighbor search. More...
 
int knnSearch (const Matrix< ElementType > &queries, std::vector< std::vector< int > > &indices, std::vector< std::vector< DistanceType > > &dists, size_t knn, const SearchParams &params) const
 Perform k-nearest neighbor search. More...
 
void knnSearchGpu (const Matrix< ElementType > &queries, Matrix< int > &indices, Matrix< DistanceType > &dists, size_t knn, const SearchParams &params) const
 Perform k-nearest neighbor search. More...
 
int knnSearchGpu (const Matrix< ElementType > &queries, std::vector< std::vector< int > > &indices, std::vector< std::vector< DistanceType > > &dists, size_t knn, const SearchParams &params) const
 
int radiusSearch (const Matrix< ElementType > &queries, Matrix< int > &indices, Matrix< DistanceType > &dists, float radius, const SearchParams &params) const
 
int radiusSearch (const Matrix< ElementType > &queries, std::vector< std::vector< int > > &indices, std::vector< std::vector< DistanceType > > &dists, float radius, const SearchParams &params) const
 
int radiusSearchGpu (const Matrix< ElementType > &queries, Matrix< int > &indices, Matrix< DistanceType > &dists, float radius, const SearchParams &params) const
 
int radiusSearchGpu (const Matrix< ElementType > &queries, std::vector< std::vector< int > > &indices, std::vector< std::vector< DistanceType > > &dists, float radius, const SearchParams &params) const
 
void findNeighbors (ResultSet< DistanceType > &result, const ElementType *vec, const SearchParams &searchParams) const
 
- Public Member Functions inherited from flann::NNIndex< Distance >
 NNIndex (Distance d)
 
 NNIndex (const IndexParams &params, Distance d)
 
 NNIndex (const NNIndex &other)
 
virtual ~NNIndex ()
 
virtual void buildIndex (const Matrix< ElementType > &dataset)
 
virtual void addPoints (const Matrix< ElementType > &points, float rebuild_threshold=2)
 Incrementally add points to the index. More...
 
size_t size () const
 
size_t veclen () const
 
IndexParams getParameters () const
 
template<typename Archive >
void serialize (Archive &ar)
 
virtual int knnSearch (const Matrix< ElementType > &queries, Matrix< size_t > &indices, Matrix< DistanceType > &dists, size_t knn, const SearchParams &params) const
 Perform k-nearest neighbor search. More...
 
int knnSearch (const Matrix< ElementType > &queries, Matrix< int > &indices, Matrix< DistanceType > &dists, size_t knn, const SearchParams &params) const
 
int knnSearch (const Matrix< ElementType > &queries, std::vector< std::vector< size_t > > &indices, std::vector< std::vector< DistanceType > > &dists, size_t knn, const SearchParams &params) const
 Perform k-nearest neighbor search. More...
 
int knnSearch (const Matrix< ElementType > &queries, std::vector< std::vector< int > > &indices, std::vector< std::vector< DistanceType > > &dists, size_t knn, const SearchParams &params) const
 
int radiusSearch (const Matrix< ElementType > &queries, Matrix< size_t > &indices, Matrix< DistanceType > &dists, float radius, const SearchParams &params) const
 Perform radius search. More...
 
int radiusSearch (const Matrix< ElementType > &queries, Matrix< int > &indices, Matrix< DistanceType > &dists, float radius, const SearchParams &params) const
 
int radiusSearch (const Matrix< ElementType > &queries, std::vector< std::vector< size_t > > &indices, std::vector< std::vector< DistanceType > > &dists, float radius, const SearchParams &params) 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 &params) const
 
- Public Member Functions inherited from flann::IndexBase
virtual ~IndexBase ()
 

Public Attributes

int visited_leafs
 

Protected Member Functions

void buildIndexImpl ()
 
void freeIndex ()
 
- Protected Member Functions inherited from flann::NNIndex< Distance >
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 extendDataset (const Matrix< ElementType > &new_points)
 
void cleanRemovedPoints ()
 
void swap (NNIndex &other)
 

Additional Inherited Members

- Protected Attributes inherited from flann::NNIndex< Distance >
Distance distance_
 
size_t last_id_
 
size_t size_
 
size_t size_at_build_
 
size_t veclen_
 
IndexParams index_params_
 
bool removed_
 
DynamicBitset removed_points_
 
size_t removed_count_
 
std::vector< size_t > ids_
 
std::vector< ElementType * > points_
 
ElementTypedata_ptr_
 

Detailed Description

template<typename Distance>
class flann::KDTreeCuda3dIndex< Distance >

Cuda KD Tree. Tree is built with GPU assistance and search is performed on the GPU, too.

Usually faster than the CPU search for data (and query) sets larger than 250000-300000 points, depending on your CPU and GPU.

Definition at line 70 of file kdtree_cuda_3d_index.h.

Member Typedef Documentation

◆ BaseClass

template<typename Distance >
typedef NNIndex<Distance> flann::KDTreeCuda3dIndex< Distance >::BaseClass

Definition at line 76 of file kdtree_cuda_3d_index.h.

◆ DistanceType

template<typename Distance >
typedef Distance::ResultType flann::KDTreeCuda3dIndex< Distance >::DistanceType

Definition at line 74 of file kdtree_cuda_3d_index.h.

◆ ElementType

template<typename Distance >
typedef Distance::ElementType flann::KDTreeCuda3dIndex< Distance >::ElementType

Definition at line 73 of file kdtree_cuda_3d_index.h.

◆ needs_kdtree_distance

template<typename Distance >
typedef bool flann::KDTreeCuda3dIndex< Distance >::needs_kdtree_distance

Definition at line 80 of file kdtree_cuda_3d_index.h.

Constructor & Destructor Documentation

◆ KDTreeCuda3dIndex() [1/2]

template<typename Distance >
flann::KDTreeCuda3dIndex< Distance >::KDTreeCuda3dIndex ( const Matrix< ElementType > &  inputData,
const IndexParams params = KDTreeCuda3dIndexParams(),
Distance  d = Distance() 
)
inline

KDTree constructor

Params: inputData = dataset with the input features params = parameters passed to the kdtree algorithm

Definition at line 89 of file kdtree_cuda_3d_index.h.

References flann::Matrix_::cols, flann::get_param(), params, flann::Matrix_::rows, and flann::NNIndex< Distance >::size_.

◆ KDTreeCuda3dIndex() [2/2]

template<typename Distance >
flann::KDTreeCuda3dIndex< Distance >::KDTreeCuda3dIndex ( const KDTreeCuda3dIndex< Distance > &  other)

◆ ~KDTreeCuda3dIndex()

template<typename Distance >
flann::KDTreeCuda3dIndex< Distance >::~KDTreeCuda3dIndex ( )
inline

Standard destructor

Definition at line 108 of file kdtree_cuda_3d_index.h.

References flann::Matrix< T >::ptr().

Member Function Documentation

◆ buildIndex()

template<typename Distance >
void flann::KDTreeCuda3dIndex< Distance >::buildIndex ( )
inlinevirtual

Builds the index

Reimplemented from flann::NNIndex< Distance >.

Definition at line 122 of file kdtree_cuda_3d_index.h.

References flann::Matrix< T >::ptr(), and flann::NNIndex< Distance >::size_.

◆ buildIndexImpl()

template<typename Distance >
void flann::KDTreeCuda3dIndex< Distance >::buildIndexImpl ( )
inlineprotectedvirtual

Implements flann::NNIndex< Distance >.

Definition at line 277 of file kdtree_cuda_3d_index.h.

◆ clone()

template<typename Distance >
BaseClass* flann::KDTreeCuda3dIndex< Distance >::clone ( ) const
inlinevirtual

Implements flann::NNIndex< Distance >.

Definition at line 114 of file kdtree_cuda_3d_index.h.

◆ findNeighbors()

template<typename Distance >
void flann::KDTreeCuda3dIndex< Distance >::findNeighbors ( ResultSet< DistanceType > &  result,
const ElementType vec,
const SearchParams searchParams 
) const
inlinevirtual

Not implemented, since it is only used by single-element searches. (but is needed b/c it is abstract in the base class)

Implements flann::NNIndex< Distance >.

Definition at line 272 of file kdtree_cuda_3d_index.h.

◆ freeIndex()

template<typename Distance >
void flann::KDTreeCuda3dIndex< Distance >::freeIndex ( )
inlineprotectedvirtual

Implements flann::NNIndex< Distance >.

Definition at line 282 of file kdtree_cuda_3d_index.h.

◆ getPoint()

template<typename Distance >
ElementType* flann::KDTreeCuda3dIndex< Distance >::getPoint ( size_t  id)
inlinevirtual

Get point with specific id

Parameters
id
Returns

Reimplemented from flann::NNIndex< Distance >.

Definition at line 152 of file kdtree_cuda_3d_index.h.

◆ getType()

template<typename Distance >
flann_algorithm_t flann::KDTreeCuda3dIndex< Distance >::getType ( ) const
inlinevirtual

Implements flann::IndexBase.

Definition at line 141 of file kdtree_cuda_3d_index.h.

References FLANN_INDEX_KDTREE_SINGLE.

◆ knnSearch() [1/2]

template<typename Distance >
int flann::KDTreeCuda3dIndex< Distance >::knnSearch ( const Matrix< ElementType > &  queries,
Matrix< int > &  indices,
Matrix< DistanceType > &  dists,
size_t  knn,
const SearchParams params 
) const
inline

Perform k-nearest neighbor search.

Parameters
[in]queriesThe query points for which to find the nearest neighbors
[out]indicesThe indices of the nearest neighbors found
[out]distsDistances to the nearest neighbors found
[in]knnNumber of nearest neighbors to return
[in]paramsSearch parameters

Definition at line 194 of file kdtree_cuda_3d_index.h.

References flann::KDTreeCuda3dIndex< Distance >::knnSearchGpu(), params, and flann::Matrix_::rows.

◆ knnSearch() [2/2]

template<typename Distance >
int flann::KDTreeCuda3dIndex< Distance >::knnSearch ( const Matrix< ElementType > &  queries,
std::vector< std::vector< int > > &  indices,
std::vector< std::vector< DistanceType > > &  dists,
size_t  knn,
const SearchParams params 
) const
inline

Perform k-nearest neighbor search.

Parameters
[in]queriesThe query points for which to find the nearest neighbors
[out]indicesThe indices of the nearest neighbors found
[out]distsDistances to the nearest neighbors found
[in]knnNumber of nearest neighbors to return
[in]paramsSearch parameters

Definition at line 208 of file kdtree_cuda_3d_index.h.

References flann::KDTreeCuda3dIndex< Distance >::knnSearchGpu(), params, and flann::Matrix_::rows.

◆ knnSearchGpu() [1/2]

template<typename Distance >
void flann::KDTreeCuda3dIndex< Distance >::knnSearchGpu ( const Matrix< ElementType > &  queries,
Matrix< int > &  indices,
Matrix< DistanceType > &  dists,
size_t  knn,
const SearchParams params 
) const

Perform k-nearest neighbor search.

Parameters
[in]queriesThe query points for which to find the nearest neighbors
[out]indicesThe indices of the nearest neighbors found
[out]distsDistances to the nearest neighbors found
[in]knnNumber of nearest neighbors to return
[in]paramsSearch parameters

Referenced by flann::KDTreeCuda3dIndex< Distance >::knnSearch(), and flann::KDTreeCuda3dIndex< Distance >::knnSearchGpu().

◆ knnSearchGpu() [2/2]

template<typename Distance >
int flann::KDTreeCuda3dIndex< Distance >::knnSearchGpu ( const Matrix< ElementType > &  queries,
std::vector< std::vector< int > > &  indices,
std::vector< std::vector< DistanceType > > &  dists,
size_t  knn,
const SearchParams params 
) const
inline

◆ loadIndex()

template<typename Distance >
void flann::KDTreeCuda3dIndex< Distance >::loadIndex ( FILE *  stream)
inlinevirtual

Implements flann::IndexBase.

Definition at line 164 of file kdtree_cuda_3d_index.h.

◆ operator=()

template<typename Distance >
KDTreeCuda3dIndex flann::KDTreeCuda3dIndex< Distance >::operator= ( KDTreeCuda3dIndex< Distance other)

◆ radiusSearch() [1/2]

template<typename Distance >
int flann::KDTreeCuda3dIndex< Distance >::radiusSearch ( const Matrix< ElementType > &  queries,
Matrix< int > &  indices,
Matrix< DistanceType > &  dists,
float  radius,
const SearchParams params 
) const
inline

◆ radiusSearch() [2/2]

template<typename Distance >
int flann::KDTreeCuda3dIndex< Distance >::radiusSearch ( const Matrix< ElementType > &  queries,
std::vector< std::vector< int > > &  indices,
std::vector< std::vector< DistanceType > > &  dists,
float  radius,
const SearchParams params 
) const
inline

◆ radiusSearchGpu() [1/2]

template<typename Distance >
int flann::KDTreeCuda3dIndex< Distance >::radiusSearchGpu ( const Matrix< ElementType > &  queries,
Matrix< int > &  indices,
Matrix< DistanceType > &  dists,
float  radius,
const SearchParams params 
) const

◆ radiusSearchGpu() [2/2]

template<typename Distance >
int flann::KDTreeCuda3dIndex< Distance >::radiusSearchGpu ( const Matrix< ElementType > &  queries,
std::vector< std::vector< int > > &  indices,
std::vector< std::vector< DistanceType > > &  dists,
float  radius,
const SearchParams params 
) const

◆ removePoint()

template<typename Distance >
void flann::KDTreeCuda3dIndex< Distance >::removePoint ( size_t  id)
inlinevirtual

Remove point from the index

Parameters
indexIndex of point to be removed

Reimplemented from flann::NNIndex< Distance >.

Definition at line 147 of file kdtree_cuda_3d_index.h.

◆ saveIndex()

template<typename Distance >
void flann::KDTreeCuda3dIndex< Distance >::saveIndex ( FILE *  stream)
inlinevirtual

Implements flann::IndexBase.

Definition at line 157 of file kdtree_cuda_3d_index.h.

◆ usedMemory()

template<typename Distance >
int flann::KDTreeCuda3dIndex< Distance >::usedMemory ( ) const
inlinevirtual

Computes the inde memory usage Returns: memory used by the index TODO: return system or gpu RAM or both?

Implements flann::IndexBase.

Definition at line 179 of file kdtree_cuda_3d_index.h.

◆ veclen()

template<typename Distance >
size_t flann::KDTreeCuda3dIndex< Distance >::veclen ( ) const
inlinevirtual

Implements flann::IndexBase.

Definition at line 169 of file kdtree_cuda_3d_index.h.

Member Data Documentation

◆ visited_leafs

template<typename Distance >
int flann::KDTreeCuda3dIndex< Distance >::visited_leafs

Definition at line 78 of file kdtree_cuda_3d_index.h.


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