OpenLB 1.7
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
nanoflann::L2_Adaptor< T, DataSource, _DistanceType > Struct Template Reference

Squared Euclidean distance functor (generic version, optimized for high-dimensionality data sets). More...

#include <nanoflann.hpp>

+ Collaboration diagram for nanoflann::L2_Adaptor< T, DataSource, _DistanceType >:

Public Types

typedef T ElementType
 
typedef _DistanceType DistanceType
 

Public Member Functions

 L2_Adaptor (const DataSource &_data_source)
 
DistanceType operator() (const T *a, const size_t b_idx, size_t size, DistanceType worst_dist=-1) const
 
template<typename U , typename V >
DistanceType accum_dist (const U a, const V b, int) const
 

Public Attributes

const DataSource & data_source
 

Detailed Description

template<class T, class DataSource, typename _DistanceType = T>
struct nanoflann::L2_Adaptor< T, DataSource, _DistanceType >

Squared Euclidean distance functor (generic version, optimized for high-dimensionality data sets).

Corresponding distance traits: nanoflann::metric_L2

Template Parameters
TType of the elements (e.g. double, float, uint8_t)
DistanceTypeType of distance variables (must be signed) (e.g. float, double, int64_t)

Definition at line 374 of file nanoflann.hpp.

Member Typedef Documentation

◆ DistanceType

template<class T , class DataSource , typename _DistanceType = T>
typedef _DistanceType nanoflann::L2_Adaptor< T, DataSource, _DistanceType >::DistanceType

Definition at line 376 of file nanoflann.hpp.

◆ ElementType

template<class T , class DataSource , typename _DistanceType = T>
typedef T nanoflann::L2_Adaptor< T, DataSource, _DistanceType >::ElementType

Definition at line 375 of file nanoflann.hpp.

Constructor & Destructor Documentation

◆ L2_Adaptor()

template<class T , class DataSource , typename _DistanceType = T>
nanoflann::L2_Adaptor< T, DataSource, _DistanceType >::L2_Adaptor ( const DataSource & _data_source)
inline

Definition at line 380 of file nanoflann.hpp.

381 : data_source(_data_source) {
382 }
const DataSource & data_source

Member Function Documentation

◆ accum_dist()

template<class T , class DataSource , typename _DistanceType = T>
template<typename U , typename V >
DistanceType nanoflann::L2_Adaptor< T, DataSource, _DistanceType >::accum_dist ( const U a,
const V b,
int  ) const
inline

Definition at line 412 of file nanoflann.hpp.

412 {
413 return (a - b) * (a - b);
414 }

◆ operator()()

template<class T , class DataSource , typename _DistanceType = T>
DistanceType nanoflann::L2_Adaptor< T, DataSource, _DistanceType >::operator() ( const T * a,
const size_t b_idx,
size_t size,
DistanceType worst_dist = -1 ) const
inline

Definition at line 384 of file nanoflann.hpp.

385 {
386 DistanceType result = DistanceType();
387 const T* last = a + size;
388 const T* lastgroup = last - 3;
389 size_t d = 0;
390
391 /* Process 4 items with each loop for efficiency. */
392 while (a < lastgroup) {
393 const DistanceType diff0 = a[0] - data_source.kdtree_get_pt(b_idx, d++);
394 const DistanceType diff1 = a[1] - data_source.kdtree_get_pt(b_idx, d++);
395 const DistanceType diff2 = a[2] - data_source.kdtree_get_pt(b_idx, d++);
396 const DistanceType diff3 = a[3] - data_source.kdtree_get_pt(b_idx, d++);
397 result += diff0 * diff0 + diff1 * diff1 + diff2 * diff2 + diff3 * diff3;
398 a += 4;
399 if ((worst_dist > 0) && (result > worst_dist)) {
400 return result;
401 }
402 }
403 /* Process last 0-3 components. Not needed for standard vector lengths. */
404 while (a < last) {
405 const DistanceType diff0 = *a++ - data_source.kdtree_get_pt(b_idx, d++);
406 result += diff0 * diff0;
407 }
408 return result;
409 }
constexpr int d() any_platform
_DistanceType DistanceType

Member Data Documentation

◆ data_source

template<class T , class DataSource , typename _DistanceType = T>
const DataSource& nanoflann::L2_Adaptor< T, DataSource, _DistanceType >::data_source

Definition at line 378 of file nanoflann.hpp.


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