ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
knncpp::QueryHeap< Scalar > Class Template Reference

#include <knncpp.h>

Public Member Functions

 QueryHeap (Index *indices, Scalar *distances, const size_t maxSize)
 
void push (const Index idx, const Scalar dist)
 
void pop ()
 
Scalar front () const
 
bool full () const
 
bool empty () const
 
size_t size () const
 
void clear ()
 
void sort ()
 

Detailed Description

template<typename Scalar>
class knncpp::QueryHeap< Scalar >

Efficient heap structure to query nearest neighbours.

Definition at line 252 of file knncpp.h.

Constructor & Destructor Documentation

◆ QueryHeap()

template<typename Scalar >
knncpp::QueryHeap< Scalar >::QueryHeap ( Index indices,
Scalar *  distances,
const size_t  maxSize 
)
inline

Creates a query heap with the given index and distance memory regions.

Definition at line 262 of file knncpp.h.

Member Function Documentation

◆ clear()

template<typename Scalar >
void knncpp::QueryHeap< Scalar >::clear ( void  )
inline

Clears the query heap.

Definition at line 341 of file knncpp.h.

References size_.

◆ empty()

template<typename Scalar >
bool knncpp::QueryHeap< Scalar >::empty ( ) const
inline

Determines if this query heap is empty.

Returns
true if the heap contains no elements, else false

Definition at line 334 of file knncpp.h.

References size_.

Referenced by knncpp::QueryHeap< Scalar >::front(), and knncpp::QueryHeap< Scalar >::pop().

◆ front()

template<typename Scalar >
Scalar knncpp::QueryHeap< Scalar >::front ( ) const
inline

Returns the distance of the element in front of the heap.

Definition at line 321 of file knncpp.h.

References knncpp::QueryHeap< Scalar >::empty().

Referenced by knncpp::BruteForce< Scalar, Distance >::query(), and knncpp::MultiIndexHashing< Scalar >::query().

◆ full()

template<typename Scalar >
bool knncpp::QueryHeap< Scalar >::full ( ) const
inline

Determines if this query heap is full. The heap is considered full if its number of elements has reached its max size.

Returns
true if the heap is full, else false

Definition at line 330 of file knncpp.h.

References size_.

Referenced by knncpp::QueryHeap< Scalar >::push(), knncpp::BruteForce< Scalar, Distance >::query(), and knncpp::MultiIndexHashing< Scalar >::query().

◆ pop()

template<typename Scalar >
void knncpp::QueryHeap< Scalar >::pop ( )
inline

Removes the element at the front of the heap and restores the heap order.

Definition at line 294 of file knncpp.h.

References dist(), knncpp::QueryHeap< Scalar >::empty(), and size_.

Referenced by knncpp::BruteForce< Scalar, Distance >::query(), knncpp::MultiIndexHashing< Scalar >::query(), and knncpp::QueryHeap< Scalar >::sort().

◆ push()

template<typename Scalar >
void knncpp::QueryHeap< Scalar >::push ( const Index  idx,
const Scalar  dist 
)
inline

Pushes a new query data set into the heap with the given index and distance. The index identifies the point for which the given distance was computed.

Parameters
idxindex / ID of the query point
distdistance that was computed for the query point

Definition at line 271 of file knncpp.h.

References dist(), knncpp::QueryHeap< Scalar >::full(), and size_.

Referenced by knncpp::BruteForce< Scalar, Distance >::query(), and knncpp::MultiIndexHashing< Scalar >::query().

◆ size()

template<typename Scalar >
size_t knncpp::QueryHeap< Scalar >::size ( void  ) const
inline

Returns the number of elements within the query heap.

Returns
number of elements in the heap

Definition at line 338 of file knncpp.h.

References size_.

◆ sort()

template<typename Scalar >
void knncpp::QueryHeap< Scalar >::sort ( )
inline

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