libnabo 1.0.1
Public Types | Protected Attributes
Nabo::OpenCLSearch< T > Struct Template Reference

OpenCL support for nearest neighbour search. More...

#include <nabo_private.h>

Inheritance diagram for Nabo::OpenCLSearch< T >:
Nabo::NearestNeighbourSearch< T > Nabo::BruteForceSearchOpenCL< T > Nabo::KDTreeBalancedPtInLeavesStackOpenCL< T > Nabo::KDTreeBalancedPtInNodesStackOpenCL< T >

List of all members.

Public Types

typedef NearestNeighbourSearch
< T >::Vector 
Vector
 an Eigen vector of type T, to hold the coordinates of a point
typedef NearestNeighbourSearch
< T >::Matrix 
Matrix
 a column-major Eigen matrix in which each column is a point; this matrix has dim rows
typedef NearestNeighbourSearch
< T >::Index 
Index
 an index to a Vector or a Matrix, for refering to data points
typedef NearestNeighbourSearch
< T >::IndexVector 
IndexVector
 a vector of indices to data points
typedef NearestNeighbourSearch
< T >::IndexMatrix 
IndexMatrix
 a matrix of indices to data points

Protected Attributes

const cl_device_type deviceType
 the type of device to run CL code on (CL_DEVICE_TYPE_CPU or CL_DEVICE_TYPE_GPU)
cl::Context & context
 the CL context
cl::Kernel knnKernel
 the kernel to perform knnSearch, mutable because it is stateful, but conceptually const
cl::CommandQueue queue
 the command queue
cl::Buffer cloudCL
 the buffer for the input data
 OpenCLSearch (const Matrix &cloud, const Index dim, const unsigned creationOptionFlags, const cl_device_type deviceType)
 constructor, calls NearestNeighbourSearch<T>(cloud)
void initOpenCL (const char *clFileName, const char *kernelName, const std::string &additionalDefines="")
 Initialize CL support.
virtual unsigned long knn (const Matrix &query, IndexMatrix &indices, Matrix &dists2, const Index k, const T epsilon, const unsigned optionFlags, const T maxRadius) const
 Find the k nearest neighbours for each point of query.

Detailed Description

template<typename T>
struct Nabo::OpenCLSearch< T >

OpenCL support for nearest neighbour search.


Member Function Documentation

template<typename T >
void Nabo::OpenCLSearch< T >::initOpenCL ( const char *  clFileName,
const char *  kernelName,
const std::string &  additionalDefines = "" 
) [protected]

Initialize CL support.

Parameters:
clFileNamename of file containing CL code
kernelNamename of the CL kernel function
additionalDefinesadditional CL code to pass to compiler
template<typename T >
unsigned long Nabo::OpenCLSearch< T >::knn ( const Matrix query,
IndexMatrix indices,
Matrix dists2,
const Index  k,
const T  epsilon,
const unsigned  optionFlags,
const T  maxRadius 
) const [virtual]

Find the k nearest neighbours for each point of query.

If the search finds less than k points, the empty entries in dists2 will be filled with infinity and the indices with 0.

Parameters:
queryquery points
indicesindices of nearest neighbours, must be of size k x query.cols()
dists2squared distances to nearest neighbours, must be of size k x query.cols()
knumber of nearest neighbour requested
epsilonmaximal percentage of error for approximate search, 0 for exact search
optionFlagssearch options, a bitwise OR of elements of SearchOptionFlags
maxRadiusmaximum radius in which to search, can be used to prune search, is not affected by epsilon
Returns:
if creationOptionFlags contains TOUCH_STATISTICS, return the number of point touched, otherwise return 0

Implements Nabo::NearestNeighbourSearch< T >.


The documentation for this struct was generated from the following files: