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

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

#include <nanoflann.hpp>

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

Public Types

typedef T ElementType
 
typedef _DistanceType DistanceType
 

Public Member Functions

 L1_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::L1_Adaptor< T, DataSource, _DistanceType >

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

Corresponding distance traits: nanoflann::metric_L1

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 322 of file nanoflann.hpp.

Member Typedef Documentation

◆ DistanceType

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

Definition at line 324 of file nanoflann.hpp.

◆ ElementType

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

Definition at line 323 of file nanoflann.hpp.

Constructor & Destructor Documentation

◆ L1_Adaptor()

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

Definition at line 328 of file nanoflann.hpp.

329 : data_source(_data_source) {
330 }
const DataSource & data_source

Member Function Documentation

◆ accum_dist()

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

Definition at line 363 of file nanoflann.hpp.

363 {
364 return nanoflann::abs(a - b);
365 }
T abs(T x)

References nanoflann::abs().

+ Here is the call graph for this function:

◆ operator()()

template<class T , class DataSource , typename _DistanceType = T>
DistanceType nanoflann::L1_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 332 of file nanoflann.hpp.

333 {
334 DistanceType result = DistanceType();
335 const T* last = a + size;
336 const T* lastgroup = last - 3;
337 size_t d = 0;
338
339 /* Process 4 items with each loop for efficiency. */
340 while (a < lastgroup) {
341 const DistanceType diff0 = nanoflann::abs(
342 a[0] - data_source.kdtree_get_pt(b_idx, d++));
343 const DistanceType diff1 = nanoflann::abs(
344 a[1] - data_source.kdtree_get_pt(b_idx, d++));
345 const DistanceType diff2 = nanoflann::abs(
346 a[2] - data_source.kdtree_get_pt(b_idx, d++));
347 const DistanceType diff3 = nanoflann::abs(
348 a[3] - data_source.kdtree_get_pt(b_idx, d++));
349 result += diff0 + diff1 + diff2 + diff3;
350 a += 4;
351 if ((worst_dist > 0) && (result > worst_dist)) {
352 return result;
353 }
354 }
355 /* Process last 0-3 components. Not needed for standard vector lengths. */
356 while (a < last) {
357 result += nanoflann::abs(*a++ - data_source.kdtree_get_pt(b_idx, d++));
358 }
359 return result;
360 }
constexpr int d() any_platform
_DistanceType DistanceType

References nanoflann::abs().

+ Here is the call graph for this function:

Member Data Documentation

◆ data_source

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

Definition at line 326 of file nanoflann.hpp.


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