CoastalME (Coastal Modelling Environment)
Simulates the long-term behaviour of complex coastlines
Loading...
Searching...
No Matches
nanoflann::KDTreeEigenMatrixAdaptor< MatrixType, DIM, Distance, row_major > Struct Template Reference

#include <nanoflann.hpp>

Public Types

using self_t
 
using num_t = typename MatrixType::Scalar
 
using IndexType = typename MatrixType::Index
 
using metric_t
 
using index_t
 
using Offset = typename index_t::Offset
 
using Size = typename index_t::Size
 
using Dimension = typename index_t::Dimension
 

Public Member Functions

 KDTreeEigenMatrixAdaptor (const Dimension dimensionality, const std::reference_wrapper< const MatrixType > &mat, const int leaf_max_size=10, const unsigned int n_thread_build=1)
 Constructor: takes a const ref to the matrix object with the data points.
 
 KDTreeEigenMatrixAdaptor (const self_t &)=delete
 
 ~KDTreeEigenMatrixAdaptor ()
 
void query (const num_t *query_point, const Size num_closest, IndexType *out_indices, num_t *out_distances) const
 
Interface expected by KDTreeSingleIndexAdaptor
const self_tderived () const
 
self_tderived ()
 
Size kdtree_get_point_count () const
 
num_t kdtree_get_pt (const IndexType idx, size_t dim) const
 
template<class BBOX>
bool kdtree_get_bbox (BBOX &) const
 

Data Fields

index_tindex_
 
const std::reference_wrapper< const MatrixType > m_data_matrix
 

Detailed Description

template<class MatrixType, int32_t DIM = -1, class Distance = nanoflann::metric_L2, bool row_major = true>
struct nanoflann::KDTreeEigenMatrixAdaptor< MatrixType, DIM, Distance, row_major >

An L2-metric KD-tree adaptor for working with data directly stored in an Eigen Matrix, without duplicating the data storage. You can select whether a row or column in the matrix represents a point in the state space.

Example of usage:

Eigen::Matrix<num_t,Eigen::Dynamic,Eigen::Dynamic> mat;
// Fill out "mat"...
Eigen::Matrix<num_t,Dynamic,Dynamic>>;
const int max_leaf = 10;
my_kd_tree_t mat_index(mat, max_leaf);
mat_index.index->...
Template Parameters
DIMIf set to >0, it specifies a compile-time fixed dimensionality for the points in the data set, allowing more compiler optimizations.
DistanceThe distance metric to use: nanoflann::metric_L1, nanoflann::metric_L2, nanoflann::metric_L2_Simple, etc.
row_majorIf set to true the rows of the matrix are used as the points, if set to false the columns of the matrix are used as the points.

Definition at line 2629 of file nanoflann.hpp.

Member Typedef Documentation

◆ Dimension

template<class MatrixType, int32_t DIM = -1, class Distance = nanoflann::metric_L2, bool row_major = true>
using nanoflann::KDTreeEigenMatrixAdaptor< MatrixType, DIM, Distance, row_major >::Dimension = typename index_t::Dimension

Definition at line 2649 of file nanoflann.hpp.

◆ index_t

template<class MatrixType, int32_t DIM = -1, class Distance = nanoflann::metric_L2, bool row_major = true>
using nanoflann::KDTreeEigenMatrixAdaptor< MatrixType, DIM, Distance, row_major >::index_t
Initial value:
row_major ? MatrixType::ColsAtCompileTime
: MatrixType::RowsAtCompileTime,
typename Distance::template traits< num_t, self_t, IndexType >::distance_t metric_t
KDTreeEigenMatrixAdaptor< MatrixType, DIM, Distance, row_major > self_t
typename MatrixType::Index IndexType

Definition at line 2638 of file nanoflann.hpp.

◆ IndexType

template<class MatrixType, int32_t DIM = -1, class Distance = nanoflann::metric_L2, bool row_major = true>
using nanoflann::KDTreeEigenMatrixAdaptor< MatrixType, DIM, Distance, row_major >::IndexType = typename MatrixType::Index

Definition at line 2634 of file nanoflann.hpp.

◆ metric_t

template<class MatrixType, int32_t DIM = -1, class Distance = nanoflann::metric_L2, bool row_major = true>
using nanoflann::KDTreeEigenMatrixAdaptor< MatrixType, DIM, Distance, row_major >::metric_t
Initial value:
typename Distance::template traits<
num_t, self_t, IndexType>::distance_t
typename MatrixType::Scalar num_t

Definition at line 2635 of file nanoflann.hpp.

◆ num_t

template<class MatrixType, int32_t DIM = -1, class Distance = nanoflann::metric_L2, bool row_major = true>
using nanoflann::KDTreeEigenMatrixAdaptor< MatrixType, DIM, Distance, row_major >::num_t = typename MatrixType::Scalar

Definition at line 2633 of file nanoflann.hpp.

◆ Offset

template<class MatrixType, int32_t DIM = -1, class Distance = nanoflann::metric_L2, bool row_major = true>
using nanoflann::KDTreeEigenMatrixAdaptor< MatrixType, DIM, Distance, row_major >::Offset = typename index_t::Offset

The kd-tree index for the user to call its methods as usual with any other FLANN index.

Definition at line 2647 of file nanoflann.hpp.

◆ self_t

template<class MatrixType, int32_t DIM = -1, class Distance = nanoflann::metric_L2, bool row_major = true>
using nanoflann::KDTreeEigenMatrixAdaptor< MatrixType, DIM, Distance, row_major >::self_t
Initial value:
KDTreeEigenMatrixAdaptor(const Dimension dimensionality, const std::reference_wrapper< const MatrixType > &mat, const int leaf_max_size=10, const unsigned int n_thread_build=1)
Constructor: takes a const ref to the matrix object with the data points.

Definition at line 2631 of file nanoflann.hpp.

◆ Size

template<class MatrixType, int32_t DIM = -1, class Distance = nanoflann::metric_L2, bool row_major = true>
using nanoflann::KDTreeEigenMatrixAdaptor< MatrixType, DIM, Distance, row_major >::Size = typename index_t::Size

Definition at line 2648 of file nanoflann.hpp.

Constructor & Destructor Documentation

◆ KDTreeEigenMatrixAdaptor() [1/2]

template<class MatrixType, int32_t DIM = -1, class Distance = nanoflann::metric_L2, bool row_major = true>
nanoflann::KDTreeEigenMatrixAdaptor< MatrixType, DIM, Distance, row_major >::KDTreeEigenMatrixAdaptor ( const Dimension dimensionality,
const std::reference_wrapper< const MatrixType > & mat,
const int leaf_max_size = 10,
const unsigned int n_thread_build = 1 )
inlineexplicit

Constructor: takes a const ref to the matrix object with the data points.

Definition at line 2652 of file nanoflann.hpp.

◆ KDTreeEigenMatrixAdaptor() [2/2]

template<class MatrixType, int32_t DIM = -1, class Distance = nanoflann::metric_L2, bool row_major = true>
nanoflann::KDTreeEigenMatrixAdaptor< MatrixType, DIM, Distance, row_major >::KDTreeEigenMatrixAdaptor ( const self_t & )
delete

Deleted copy constructor

◆ ~KDTreeEigenMatrixAdaptor()

template<class MatrixType, int32_t DIM = -1, class Distance = nanoflann::metric_L2, bool row_major = true>
nanoflann::KDTreeEigenMatrixAdaptor< MatrixType, DIM, Distance, row_major >::~KDTreeEigenMatrixAdaptor ( )
inline

Definition at line 2678 of file nanoflann.hpp.

Member Function Documentation

◆ derived() [1/2]

template<class MatrixType, int32_t DIM = -1, class Distance = nanoflann::metric_L2, bool row_major = true>
self_t & nanoflann::KDTreeEigenMatrixAdaptor< MatrixType, DIM, Distance, row_major >::derived ( )
inline

Definition at line 2703 of file nanoflann.hpp.

◆ derived() [2/2]

template<class MatrixType, int32_t DIM = -1, class Distance = nanoflann::metric_L2, bool row_major = true>
const self_t & nanoflann::KDTreeEigenMatrixAdaptor< MatrixType, DIM, Distance, row_major >::derived ( ) const
inline

Definition at line 2702 of file nanoflann.hpp.

◆ kdtree_get_bbox()

template<class MatrixType, int32_t DIM = -1, class Distance = nanoflann::metric_L2, bool row_major = true>
template<class BBOX>
bool nanoflann::KDTreeEigenMatrixAdaptor< MatrixType, DIM, Distance, row_major >::kdtree_get_bbox ( BBOX & ) const
inline

Definition at line 2729 of file nanoflann.hpp.

◆ kdtree_get_point_count()

template<class MatrixType, int32_t DIM = -1, class Distance = nanoflann::metric_L2, bool row_major = true>
Size nanoflann::KDTreeEigenMatrixAdaptor< MatrixType, DIM, Distance, row_major >::kdtree_get_point_count ( ) const
inline

Definition at line 2706 of file nanoflann.hpp.

◆ kdtree_get_pt()

template<class MatrixType, int32_t DIM = -1, class Distance = nanoflann::metric_L2, bool row_major = true>
num_t nanoflann::KDTreeEigenMatrixAdaptor< MatrixType, DIM, Distance, row_major >::kdtree_get_pt ( const IndexType idx,
size_t dim ) const
inline

Definition at line 2715 of file nanoflann.hpp.

◆ query()

template<class MatrixType, int32_t DIM = -1, class Distance = nanoflann::metric_L2, bool row_major = true>
void nanoflann::KDTreeEigenMatrixAdaptor< MatrixType, DIM, Distance, row_major >::query ( const num_t * query_point,
const Size num_closest,
IndexType * out_indices,
num_t * out_distances ) const
inline

Query for the num_closest closest points to a given point (entered as query_point[0:dim-1]). Note that this is a short-cut method for index->findNeighbors(). The user can also call index->... methods as desired.

Note
If L2 norms are used, all returned distances are actually squared distances.

Definition at line 2690 of file nanoflann.hpp.

Field Documentation

◆ index_

template<class MatrixType, int32_t DIM = -1, class Distance = nanoflann::metric_L2, bool row_major = true>
index_t* nanoflann::KDTreeEigenMatrixAdaptor< MatrixType, DIM, Distance, row_major >::index_

Definition at line 2644 of file nanoflann.hpp.

◆ m_data_matrix

template<class MatrixType, int32_t DIM = -1, class Distance = nanoflann::metric_L2, bool row_major = true>
const std::reference_wrapper<const MatrixType> nanoflann::KDTreeEigenMatrixAdaptor< MatrixType, DIM, Distance, row_major >::m_data_matrix

Definition at line 2680 of file nanoflann.hpp.


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