ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType > Class Template Reference

#include <coresoftware/blob/master/offline/packages/PHTpcTracker/externals/nanoflann.hpp>

+ Collaboration diagram for nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >:

Classes

struct  Interval
 
struct  Node
 

Public Types

typedef Distance::ElementType ElementType
 
typedef Distance::DistanceType DistanceType
 
typedef Distance::ElementType ElementType
 
typedef Distance::DistanceType DistanceType
 

Public Member Functions

 KDTreeSingleIndexAdaptor (const int dimensionality, const DatasetAdaptor &inputData, const KDTreeSingleIndexAdaptorParams &params=KDTreeSingleIndexAdaptorParams())
 
 ~KDTreeSingleIndexAdaptor ()
 
void freeIndex ()
 
void buildIndex ()
 
size_t size () const
 
size_t veclen () const
 
size_t usedMemory () const
 
void saveIndex (FILE *stream)
 
void loadIndex (FILE *stream)
 
 KDTreeSingleIndexAdaptor (const int dimensionality, const DatasetAdaptor &inputData, const KDTreeSingleIndexAdaptorParams &params=KDTreeSingleIndexAdaptorParams())
 
 ~KDTreeSingleIndexAdaptor ()
 
void freeIndex ()
 
void buildIndex ()
 
size_t size () const
 
size_t veclen () const
 
size_t usedMemory () const
 
void saveIndex (FILE *stream)
 
void loadIndex (FILE *stream)
 
Query methods
template<typename RESULTSET >
bool findNeighbors (RESULTSET &result, const ElementType *vec, const SearchParams &searchParams) const
 
size_t knnSearch (const ElementType *query_point, const size_t num_closest, IndexType *out_indices, DistanceType *out_distances_sq, const int=10) const
 
size_t radiusSearch (const ElementType *query_point, const DistanceType &radius, std::vector< std::pair< IndexType, DistanceType > > &IndicesDists, const SearchParams &searchParams) const
 
template<class SEARCH_CALLBACK >
size_t radiusSearchCustomCallback (const ElementType *query_point, SEARCH_CALLBACK &resultSet, const SearchParams &searchParams=SearchParams()) const
 
template<typename RESULTSET >
bool findNeighbors (RESULTSET &result, const ElementType *vec, const SearchParams &searchParams) const
 
size_t knnSearch (const ElementType *query_point, const size_t num_closest, IndexType *out_indices, DistanceType *out_distances_sq, const int=10) const
 
size_t radiusSearch (const ElementType *query_point, const DistanceType &radius, std::vector< std::pair< IndexType, DistanceType > > &IndicesDists, const SearchParams &searchParams) const
 
template<class SEARCH_CALLBACK >
size_t radiusSearchCustomCallback (const ElementType *query_point, SEARCH_CALLBACK &resultSet, const SearchParams &searchParams=SearchParams()) const
 

Public Attributes

Distance distance
 

Protected Types

typedef NodeNodePtr
 
typedef
array_or_vector_selector< DIM,
Interval >::container_t 
BoundingBox
 
typedef
array_or_vector_selector< DIM,
DistanceType >::container_t 
distance_vector_t
 
typedef NodeNodePtr
 
typedef
array_or_vector_selector< DIM,
Interval >::container_t 
BoundingBox
 
typedef
array_or_vector_selector< DIM,
DistanceType >::container_t 
distance_vector_t
 

Protected Attributes

std::vector< IndexType > vind
 
size_t m_leaf_max_size
 
const DatasetAdaptor & dataset
 The source of our data.
 
const
KDTreeSingleIndexAdaptorParams 
index_params
 
size_t m_size
 Number of current poins in the dataset.
 
size_t m_size_at_index_build
 Number of points in the dataset when the index was built.
 
int dim
 Dimensionality of each data point.
 
NodePtr root_node
 
BoundingBox root_bbox
 
PooledAllocator pool
 

Private Member Functions

 KDTreeSingleIndexAdaptor (const KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType > &)
 
void init_vind ()
 
ElementType dataset_get (size_t idx, int component) const
 Helper accessor to the dataset points:
 
void save_tree (FILE *stream, NodePtr tree)
 
void load_tree (FILE *stream, NodePtr &tree)
 
void computeBoundingBox (BoundingBox &bbox)
 
NodePtr divideTree (const IndexType left, const IndexType right, BoundingBox &bbox)
 
void computeMinMax (IndexType *ind, IndexType count, int element, ElementType &min_elem, ElementType &max_elem)
 
void middleSplit_ (IndexType *ind, IndexType count, IndexType &index, int &cutfeat, DistanceType &cutval, const BoundingBox &bbox)
 
void planeSplit (IndexType *ind, const IndexType count, int cutfeat, DistanceType &cutval, IndexType &lim1, IndexType &lim2)
 
DistanceType computeInitialDistances (const ElementType *vec, distance_vector_t &dists) const
 
template<class RESULTSET >
void searchLevel (RESULTSET &result_set, const ElementType *vec, const NodePtr node, DistanceType mindistsq, distance_vector_t &dists, const float epsError) const
 
 KDTreeSingleIndexAdaptor (const KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType > &)
 
void init_vind ()
 
ElementType dataset_get (size_t idx, int component) const
 Helper accessor to the dataset points:
 
void save_tree (FILE *stream, NodePtr tree)
 
void load_tree (FILE *stream, NodePtr &tree)
 
void computeBoundingBox (BoundingBox &bbox)
 
NodePtr divideTree (const IndexType left, const IndexType right, BoundingBox &bbox)
 
void computeMinMax (IndexType *ind, IndexType count, int element, ElementType &min_elem, ElementType &max_elem)
 
void middleSplit_ (IndexType *ind, IndexType count, IndexType &index, int &cutfeat, DistanceType &cutval, const BoundingBox &bbox)
 
void planeSplit (IndexType *ind, const IndexType count, int cutfeat, DistanceType &cutval, IndexType &lim1, IndexType &lim2)
 
DistanceType computeInitialDistances (const ElementType *vec, distance_vector_t &dists) const
 
template<class RESULTSET >
void searchLevel (RESULTSET &result_set, const ElementType *vec, const NodePtr node, DistanceType mindistsq, distance_vector_t &dists, const float epsError) const
 

Detailed Description

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
class nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >

kd-tree index

Contains the k-d trees and other information for indexing a set of points for nearest-neighbor matching.

The class "DatasetAdaptor" must provide the following interface (can be non-virtual, inlined methods):

// Must return the number of data poins
inline size_t kdtree_get_point_count() const { ... }
// [Only if using the metric_L2_Simple type] Must return the Euclidean (L2) distance between the vector "p1[0:size-1]" and the data point with index "idx_p2" stored in the class:
inline DistanceType kdtree_distance(const T *p1, const size_t idx_p2,size_t size) const { ... }
// Must return the dim'th component of the idx'th point in the class:
inline T kdtree_get_pt(const size_t idx, int dim) const { ... }
// Optional bounding-box computation: return false to default to a standard bbox computation loop.
// Return true if the BBOX was already computed by the class and returned in "bb" so it can be avoided to redo it again.
// Look at bb.size() to find out the expected dimensionality (e.g. 2 or 3 for point clouds)
template <class BBOX>
bool kdtree_get_bbox(BBOX &bb) const
{
bb[0].low = ...; bb[0].high = ...; // 0th dimension limits
bb[1].low = ...; bb[1].high = ...; // 1st dimension limits
...
return true;
}
Template Parameters
DatasetAdaptorThe user-provided adaptor (see comments above).
DistanceThe distance metric to use: nanoflann::metric_L1, nanoflann::metric_L2, nanoflann::metric_L2_Simple, etc.
DIMDimensionality of data points (e.g. 3 for 3D points)
IndexTypeWill be typically size_t or int

Definition at line 816 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 816 of file nanoflann.hpp

Member Typedef Documentation

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
typedef array_or_vector_selector<DIM, Interval>::container_t nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::BoundingBox
protected

Define "BoundingBox" as a fixed-size or variable-size container depending on "DIM"

Definition at line 870 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 870 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
typedef array_or_vector_selector<DIM, Interval>::container_t nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::BoundingBox
protected

Define "BoundingBox" as a fixed-size or variable-size container depending on "DIM"

Definition at line 870 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 870 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
typedef array_or_vector_selector<DIM, DistanceType>::container_t nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::distance_vector_t
protected

Define "distance_vector_t" as a fixed-size or variable-size container depending on "DIM"

Definition at line 873 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 873 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
typedef array_or_vector_selector<DIM, DistanceType>::container_t nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::distance_vector_t
protected

Define "distance_vector_t" as a fixed-size or variable-size container depending on "DIM"

Definition at line 873 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 873 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
typedef Distance::DistanceType nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::DistanceType

Definition at line 824 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 824 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
typedef Distance::DistanceType nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::DistanceType

Definition at line 824 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 824 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
typedef Distance::ElementType nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::ElementType

Definition at line 823 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 823 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
typedef Distance::ElementType nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::ElementType

Definition at line 823 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 823 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
typedef Node* nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::NodePtr
protected

Definition at line 862 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 862 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
typedef Node* nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::NodePtr
protected

Definition at line 862 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 862 of file nanoflann.hpp

Constructor & Destructor Documentation

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::KDTreeSingleIndexAdaptor ( const KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType > &  )
private

Hidden copy constructor, to disallow copying indices (Not implemented)

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::KDTreeSingleIndexAdaptor ( const int  dimensionality,
const DatasetAdaptor &  inputData,
const KDTreeSingleIndexAdaptorParams params = KDTreeSingleIndexAdaptorParams() 
)
inline

KDTree constructor

Refer to docs in README.md or online in https://github.com/jlblancoc/nanoflann

The KD-Tree point dimension (the length of each point in the datase, e.g. 3 for 3D points) is determined by means of:

  • The DIM template parameter if >0 (highest priority)
  • Otherwise, the dimensionality parameter of this constructor.
Parameters
inputDataDataset with the input features
paramsBasically, the maximum leaf node size

Definition at line 904 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 904 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::~KDTreeSingleIndexAdaptor ( )
inline

Standard destructor

Definition at line 921 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 921 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::KDTreeSingleIndexAdaptor ( const KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType > &  )
private

Hidden copy constructor, to disallow copying indices (Not implemented)

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::KDTreeSingleIndexAdaptor ( const int  dimensionality,
const DatasetAdaptor &  inputData,
const KDTreeSingleIndexAdaptorParams params = KDTreeSingleIndexAdaptorParams() 
)
inline

KDTree constructor

Refer to docs in README.md or online in https://github.com/jlblancoc/nanoflann

The KD-Tree point dimension (the length of each point in the datase, e.g. 3 for 3D points) is determined by means of:

  • The DIM template parameter if >0 (highest priority)
  • Otherwise, the dimensionality parameter of this constructor.
Parameters
inputDataDataset with the input features
paramsBasically, the maximum leaf node size

Definition at line 904 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 904 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::~KDTreeSingleIndexAdaptor ( )
inline

Standard destructor

Definition at line 921 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 921 of file nanoflann.hpp

Member Function Documentation

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::buildIndex ( )
inline

Builds the index

Definition at line 934 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 934 of file nanoflann.hpp

Referenced by kdfinder::find_tracks(), and PHTpcLookup::init().

+ Here is the caller graph for this function:

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::buildIndex ( )
inline

Builds the index

Definition at line 934 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 934 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::computeBoundingBox ( BoundingBox bbox)
inlineprivate

Definition at line 1088 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1088 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::computeBoundingBox ( BoundingBox bbox)
inlineprivate

Definition at line 1088 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1088 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
DistanceType nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::computeInitialDistances ( const ElementType vec,
distance_vector_t dists 
) const
inlineprivate

Definition at line 1283 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1283 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
DistanceType nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::computeInitialDistances ( const ElementType vec,
distance_vector_t dists 
) const
inlineprivate

Definition at line 1283 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1283 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::computeMinMax ( IndexType *  ind,
IndexType  count,
int  element,
ElementType min_elem,
ElementType max_elem 
)
inlineprivate

Definition at line 1178 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1178 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::computeMinMax ( IndexType *  ind,
IndexType  count,
int  element,
ElementType min_elem,
ElementType max_elem 
)
inlineprivate

Definition at line 1178 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1178 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
ElementType nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::dataset_get ( size_t  idx,
int  component 
) const
inlineprivate

Helper accessor to the dataset points:

Definition at line 1056 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1056 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
ElementType nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::dataset_get ( size_t  idx,
int  component 
) const
inlineprivate

Helper accessor to the dataset points:

Definition at line 1056 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1056 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
NodePtr nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::divideTree ( const IndexType  left,
const IndexType  right,
BoundingBox bbox 
)
inlineprivate

Create a tree node that subdivides the list of vecs from vind[first] to vind[last]. The routine is called recursively on each sublist.

Parameters
leftindex of the first vector
rightindex of the last vector

Definition at line 1122 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1122 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
NodePtr nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::divideTree ( const IndexType  left,
const IndexType  right,
BoundingBox bbox 
)
inlineprivate

Create a tree node that subdivides the list of vecs from vind[first] to vind[last]. The routine is called recursively on each sublist.

Parameters
leftindex of the first vector
rightindex of the last vector

Definition at line 1122 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1122 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
template<typename RESULTSET >
bool nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::findNeighbors ( RESULTSET &  result,
const ElementType vec,
const SearchParams searchParams 
) const
inline

Find set of nearest neighbors to vec[0:dim-1]. Their indices are stored inside the result object.

Params: result = the result object in which the indices of the nearest-neighbors are stored vec = the vector for which to search the nearest neighbors

Template Parameters
RESULTSETShould be any ResultSet<DistanceType>
Returns
True if the requested neighbors could be found.
See Also
knnSearch, radiusSearch

Definition at line 978 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 978 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
template<typename RESULTSET >
bool nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::findNeighbors ( RESULTSET &  result,
const ElementType vec,
const SearchParams searchParams 
) const
inline

Find set of nearest neighbors to vec[0:dim-1]. Their indices are stored inside the result object.

Params: result = the result object in which the indices of the nearest-neighbors are stored vec = the vector for which to search the nearest neighbors

Template Parameters
RESULTSETShould be any ResultSet<DistanceType>
Returns
True if the requested neighbors could be found.
See Also
knnSearch, radiusSearch

Definition at line 978 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 978 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::freeIndex ( )
inline

Frees the previously-built index. Automatically called within buildIndex().

Definition at line 924 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 924 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::freeIndex ( )
inline

Frees the previously-built index. Automatically called within buildIndex().

Definition at line 924 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 924 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::init_vind ( )
inlineprivate

Make sure the auxiliary list vind has the same size than the current dataset, and re-generate if size has changed.

Definition at line 1047 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1047 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::init_vind ( )
inlineprivate

Make sure the auxiliary list vind has the same size than the current dataset, and re-generate if size has changed.

Definition at line 1047 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1047 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
size_t nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::knnSearch ( const ElementType query_point,
const size_t  num_closest,
IndexType *  out_indices,
DistanceType out_distances_sq,
const int  = 10 
) const
inline

Find the "num_closest" nearest neighbors to the query_point[0:dim-1]. Their indices are stored inside the result object.

See Also
radiusSearch, findNeighbors
Note
nChecks_IGNORED is ignored but kept for compatibility with the original FLANN interface.
Returns
Number N of valid points in the result set. Only the first N entries in out_indices and out_distances_sq will be valid. Return may be less than num_closest only if the number of elements in the tree is less than num_closest.

Definition at line 1002 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1002 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
size_t nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::knnSearch ( const ElementType query_point,
const size_t  num_closest,
IndexType *  out_indices,
DistanceType out_distances_sq,
const int  = 10 
) const
inline

Find the "num_closest" nearest neighbors to the query_point[0:dim-1]. Their indices are stored inside the result object.

See Also
radiusSearch, findNeighbors
Note
nChecks_IGNORED is ignored but kept for compatibility with the original FLANN interface.
Returns
Number N of valid points in the result set. Only the first N entries in out_indices and out_distances_sq will be valid. Return may be less than num_closest only if the number of elements in the tree is less than num_closest.

Definition at line 1002 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1002 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::load_tree ( FILE *  stream,
NodePtr tree 
)
inlineprivate

Definition at line 1074 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1074 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::load_tree ( FILE *  stream,
NodePtr tree 
)
inlineprivate

Definition at line 1074 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1074 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::loadIndex ( FILE *  stream)
inline

Loads a previous index from a binary file. IMPORTANT NOTE: The set of data points is NOT stored in the file, so the index object must be constructed associated to the same source of data points used while building the index. See the example: examples/saveload_example.cpp

See Also
loadIndex

Definition at line 1384 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1384 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::loadIndex ( FILE *  stream)
inline

Loads a previous index from a binary file. IMPORTANT NOTE: The set of data points is NOT stored in the file, so the index object must be constructed associated to the same source of data points used while building the index. See the example: examples/saveload_example.cpp

See Also
loadIndex

Definition at line 1384 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1384 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::middleSplit_ ( IndexType *  ind,
IndexType  count,
IndexType &  index,
int cutfeat,
DistanceType cutval,
const BoundingBox bbox 
)
inlineprivate

Definition at line 1190 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1190 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::middleSplit_ ( IndexType *  ind,
IndexType  count,
IndexType &  index,
int cutfeat,
DistanceType cutval,
const BoundingBox bbox 
)
inlineprivate

Definition at line 1190 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1190 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::planeSplit ( IndexType *  ind,
const IndexType  count,
int  cutfeat,
DistanceType cutval,
IndexType &  lim1,
IndexType &  lim2 
)
inlineprivate

Subdivide the list of points by a plane perpendicular on axe corresponding to the 'cutfeat' dimension at 'cutval' position.

On return: dataset[ind[0..lim1-1]][cutfeat]<cutval dataset[ind[lim1..lim2-1]][cutfeat]==cutval dataset[ind[lim2..count]][cutfeat]>cutval

Definition at line 1252 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1252 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::planeSplit ( IndexType *  ind,
const IndexType  count,
int  cutfeat,
DistanceType cutval,
IndexType &  lim1,
IndexType &  lim2 
)
inlineprivate

Subdivide the list of points by a plane perpendicular on axe corresponding to the 'cutfeat' dimension at 'cutval' position.

On return: dataset[ind[0..lim1-1]][cutfeat]<cutval dataset[ind[lim1..lim2-1]][cutfeat]==cutval dataset[ind[lim2..count]][cutfeat]>cutval

Definition at line 1252 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1252 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
size_t nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::radiusSearch ( const ElementType query_point,
const DistanceType radius,
std::vector< std::pair< IndexType, DistanceType > > &  IndicesDists,
const SearchParams searchParams 
) const
inline

Find all the neighbors to query_point[0:dim-1] within a maximum radius. The output is given as a vector of pairs, of which the first element is a point index and the second the corresponding distance. Previous contents of IndicesDists are cleared.

If searchParams.sorted==true, the output list is sorted by ascending distances.

For a better performance, it is advisable to do a .reserve() on the vector if you have any wild guess about the number of expected matches.

See Also
knnSearch, findNeighbors, radiusSearchCustomCallback
Returns
The number of points within the given radius (i.e. indices.size() or dists.size() )

Definition at line 1022 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1022 of file nanoflann.hpp

Referenced by PHTpcLookup::find().

+ Here is the caller graph for this function:

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
size_t nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::radiusSearch ( const ElementType query_point,
const DistanceType radius,
std::vector< std::pair< IndexType, DistanceType > > &  IndicesDists,
const SearchParams searchParams 
) const
inline

Find all the neighbors to query_point[0:dim-1] within a maximum radius. The output is given as a vector of pairs, of which the first element is a point index and the second the corresponding distance. Previous contents of IndicesDists are cleared.

If searchParams.sorted==true, the output list is sorted by ascending distances.

For a better performance, it is advisable to do a .reserve() on the vector if you have any wild guess about the number of expected matches.

See Also
knnSearch, findNeighbors, radiusSearchCustomCallback
Returns
The number of points within the given radius (i.e. indices.size() or dists.size() )

Definition at line 1022 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1022 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
template<class SEARCH_CALLBACK >
size_t nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::radiusSearchCustomCallback ( const ElementType query_point,
SEARCH_CALLBACK &  resultSet,
const SearchParams searchParams = SearchParams() 
) const
inline

Just like radiusSearch() but with a custom callback class for each point found in the radius of the query. See the source of RadiusResultSet<> as a start point for your own classes.

See Also
radiusSearch

Definition at line 1037 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1037 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
template<class SEARCH_CALLBACK >
size_t nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::radiusSearchCustomCallback ( const ElementType query_point,
SEARCH_CALLBACK &  resultSet,
const SearchParams searchParams = SearchParams() 
) const
inline

Just like radiusSearch() but with a custom callback class for each point found in the radius of the query. See the source of RadiusResultSet<> as a start point for your own classes.

See Also
radiusSearch

Definition at line 1037 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1037 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::save_tree ( FILE *  stream,
NodePtr  tree 
)
inlineprivate

Definition at line 1061 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1061 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::save_tree ( FILE *  stream,
NodePtr  tree 
)
inlineprivate

Definition at line 1061 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1061 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::saveIndex ( FILE *  stream)
inline

Stores the index in a binary file. IMPORTANT NOTE: The set of data points is NOT stored in the file, so when loading the index object it must be constructed associated to the same source of data points used while building it. See the example: examples/saveload_example.cpp

See Also
loadIndex

Definition at line 1370 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1370 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::saveIndex ( FILE *  stream)
inline

Stores the index in a binary file. IMPORTANT NOTE: The set of data points is NOT stored in the file, so when loading the index object it must be constructed associated to the same source of data points used while building it. See the example: examples/saveload_example.cpp

See Also
loadIndex

Definition at line 1370 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1370 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
template<class RESULTSET >
void nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::searchLevel ( RESULTSET &  result_set,
const ElementType vec,
const NodePtr  node,
DistanceType  mindistsq,
distance_vector_t dists,
const float  epsError 
) const
inlineprivate

Performs an exact search in the tree starting from a node.

Template Parameters
RESULTSETShould be any ResultSet<DistanceType>

Definition at line 1310 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1310 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
template<class RESULTSET >
void nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::searchLevel ( RESULTSET &  result_set,
const ElementType vec,
const NodePtr  node,
DistanceType  mindistsq,
distance_vector_t dists,
const float  epsError 
) const
inlineprivate

Performs an exact search in the tree starting from a node.

Template Parameters
RESULTSETShould be any ResultSet<DistanceType>

Definition at line 1310 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 1310 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
size_t nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::size ( void  ) const
inline

Returns number of points in dataset

Definition at line 945 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 945 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
size_t nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::size ( void  ) const
inline

Returns number of points in dataset

Definition at line 945 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 945 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
size_t nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::usedMemory ( ) const
inline

Computes the inde memory usage Returns: memory used by the index

Definition at line 957 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 957 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
size_t nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::usedMemory ( ) const
inline

Computes the inde memory usage Returns: memory used by the index

Definition at line 957 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 957 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
size_t nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::veclen ( ) const
inline

Returns the length of each point in the dataset

Definition at line 948 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 948 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
size_t nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::veclen ( ) const
inline

Returns the length of each point in the dataset

Definition at line 948 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 948 of file nanoflann.hpp

Member Data Documentation

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
const DatasetAdaptor & nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::dataset
protected

The source of our data.

The dataset used by this index

Definition at line 837 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 837 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
int nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::dim
protected

Dimensionality of each data point.

Definition at line 843 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 843 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
Distance nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::distance

Definition at line 889 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 889 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
const KDTreeSingleIndexAdaptorParams nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::index_params
protected

Definition at line 839 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 839 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
size_t nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::m_leaf_max_size
protected

Definition at line 832 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 832 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
size_t nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::m_size
protected

Number of current poins in the dataset.

Definition at line 841 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 841 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
size_t nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::m_size_at_index_build
protected

Number of points in the dataset when the index was built.

Definition at line 842 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 842 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
PooledAllocator nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::pool
protected

Pooled memory allocator.

Using a pooled memory allocator is more efficient than allocating memory directly when there is a large number small of memory allocations.

Definition at line 886 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 886 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
BoundingBox nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::root_bbox
protected

Definition at line 877 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 877 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
NodePtr nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::root_node
protected

The KD-tree used to find neighbours

Definition at line 876 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 876 of file nanoflann.hpp

template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
std::vector< IndexType > nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::vind
protected

Array of indices to vectors in the dataset.

Definition at line 830 of file nanoflann.hpp.

View newest version in sPHENIX GitHub at line 830 of file nanoflann.hpp


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