libnabo 1.0.1
Classes | Public Types | Public Member Functions | Public Attributes
Nabo::IndexHeapBruteForceVector< IT, VT > Struct Template Reference

brute-force implementation of heap More...

#include <index_heap.h>

List of all members.

Classes

struct  Entry
 an entry of the heap vector More...

Public Types

typedef IT Index
 type of an index
typedef VT Value
 type of a value
typedef std::vector< EntryEntries
 vector of entry, type for the storage of the tree
typedef Eigen::Matrix< Index,
Eigen::Dynamic, 1 > 
IndexVector
 vector of indices
typedef Eigen::Matrix< Value,
Eigen::Dynamic, 1 > 
ValueVector
 vector of values

Public Member Functions

 IndexHeapBruteForceVector (const size_t size)
 Constructor.
void reset ()
 reset to the empty heap
const VT & headValue () const
 get the largest value of the heap
void replaceHead (const Index index, const Value value)
 replace the largest value of the heap
void sort ()
 sort the entries, from the smallest to the largest
template<typename DI , typename DV >
void getData (const Eigen::MatrixBase< DI > &indices, const Eigen::MatrixBase< DV > &values) const
 get the data from the heap

Public Attributes

Entries data
 storage for the tree
const VT & headValueRef
 reference to the largest value in the tree, to optimise access speed
const size_t sizeMinusOne
 pre-competed size minus one, to optimise access speed

Detailed Description

template<typename IT, typename VT>
struct Nabo::IndexHeapBruteForceVector< IT, VT >

brute-force implementation of heap

It uses a vector and linear search, which provides replacement in O(n), but with a very low constant overhead.


Constructor & Destructor Documentation

template<typename IT , typename VT >
Nabo::IndexHeapBruteForceVector< IT, VT >::IndexHeapBruteForceVector ( const size_t  size) [inline]

Constructor.

Parameters:
sizenumber of elements in the heap

Member Function Documentation

template<typename IT , typename VT >
template<typename DI , typename DV >
void Nabo::IndexHeapBruteForceVector< IT, VT >::getData ( const Eigen::MatrixBase< DI > &  indices,
const Eigen::MatrixBase< DV > &  values 
) const [inline]

get the data from the heap

Parameters:
indicesindex vector
valuesvalue vector
template<typename IT , typename VT >
const VT& Nabo::IndexHeapBruteForceVector< IT, VT >::headValue ( ) const [inline]

get the largest value of the heap

Returns:
the smallest value in the heap
template<typename IT , typename VT >
void Nabo::IndexHeapBruteForceVector< IT, VT >::replaceHead ( const Index  index,
const Value  value 
) [inline]

replace the largest value of the heap

Parameters:
indexnew point index
valuenew distance value

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