Go to the documentation of this file.
32 #ifndef __INDEX_HEAP_H
33 #define __INDEX_HEAP_H
51 template<
typename IT,
typename VT>
73 typedef typename Eigen::Matrix<Index, Eigen::Dynamic, 1>
IndexVector;
75 typedef typename Eigen::Matrix<Value, Eigen::Dynamic, 1>
ValueVector;
96 data.push_back(
Entry(invalidIndex<IT>(), invalidValue<VT>()));
119 push_heap(
data.begin(),
data.end());
125 sort_heap (
data.begin(),
data.end());
131 template<
typename DI,
typename DV>
132 inline void getData(
const Eigen::MatrixBase<DI>& indices,
const Eigen::MatrixBase<DV> & values)
const
139 for (; i <
data.size(); ++i)
141 const_cast<Eigen::MatrixBase<DI>&
>(indices).coeffRef(i) =
data[i].index;
142 const_cast<Eigen::MatrixBase<DV>&
>(values).coeffRef(i) =
data[i].value;
146 const_cast<Eigen::MatrixBase<DI>&
>(indices).coeffRef(i) = invalidIndex<IT>();
147 const_cast<Eigen::MatrixBase<DV>&
>(values).coeffRef(i) = invalidValue<VT>();
158 for (; i <
data.size(); ++i)
159 indexes.coeffRef(i) =
data[i].index;
160 for (; i <
data.capacity(); ++i)
161 indexes.coeffRef(i) = 0;
171 template<
typename IT,
typename VT>
172 struct IndexHeapBruteForceVector
191 typedef std::vector<Entry>
Entries;
193 typedef typename Eigen::Matrix<Index, Eigen::Dynamic, 1>
IndexVector;
205 data(size, Entry(0,
std::numeric_limits<VT>::infinity())),
214 for (
typename Entries::iterator it(
data.begin()); it !=
data.end(); ++it)
216 it->value = std::numeric_limits<VT>::infinity();
233 if (
data[i + 1].value > value)
238 data[i].value = value;
239 data[i].index = index;
253 for (
size_t i = 0; i <
data.size(); ++i)
263 template<
typename IT,
typename VT>
285 typedef typename Eigen::Matrix<Index, Eigen::Dynamic, 1>
IndexVector;
287 typedef typename Eigen::Matrix<Value, Eigen::Dynamic, 1>
ValueVector;
308 for (
typename Entries::iterator it(
data.begin()); it !=
data.end(); ++it)
310 it->value = invalidValue<VT>();
311 it->index = invalidIndex<IT>();
327 if (
data[i-1].value > value)
332 data[i].value = value;
333 data[i].index = index;
345 template<
typename DI,
typename DV>
346 inline void getData(
const Eigen::MatrixBase<DI>& indices,
const Eigen::MatrixBase<DV> & values)
const
352 for (
size_t i = 0; i <
data.size(); ++i)
354 const_cast<Eigen::MatrixBase<DI>&
>(indices).coeffRef(i) =
data[i].index;
355 const_cast<Eigen::MatrixBase<DV>&
>(values).coeffRef(i) =
data[i].value;
364 for (
size_t i = 0; i <
data.size(); ++i)
365 indexes.coeffRef(i) =
data[i].index;
372 #endif // __INDEX_HEAP_H
an entry of the heap vector
const VT & headValue() const
get the largest value of the heap
Eigen::Matrix< Value, Eigen::Dynamic, 1 > ValueVector
vector of values
friend bool operator<(const Entry &e0, const Entry &e1)
return true if e0 is smaller than e1, false otherwise
constexpr IndexType invalidIndex()
void sort()
sort the entries, from the smallest to the largest
Entries data
storage for the tree
const size_t sizeMinusOne
pre-competed size minus one, to optimise access speed
Entry(const IT index, const VT value)
create a new entry
Eigen::Matrix< Value, Eigen::Dynamic, 1 > ValueVector
vector of values
void replaceHead(const Index index, const Value value)
put value into heap, replace the largest value if full
std::vector< Entry > Entries
vector of entry, type for the storage of the tree
brute-force implementation of heap
Eigen::Matrix< Index, Eigen::Dynamic, 1 > IndexVector
vector of indices
Entries data
storage for the tree
IndexHeapSTL(const size_t size)
Constructor.
const VT & headValue() const
get the largest value of the heap
const VT & headValueRef
reference to the largest value in the tree, to optimise access speed
VT value
distance for this point
Entry(const IT index, const VT value)
create a new entry
const size_t nbNeighbours
number of neighbours requested
Eigen::Matrix< Index, Eigen::Dynamic, 1 > IndexVector
vector of indices
std::vector< Entry > Entries
vector of entry, type for the storage of the tree
balanced-tree implementation of heap
VT value
distance for this point
friend bool operator<(const Entry &e0, const Entry &e1)
return true if e0 is of lower value than e1, false otherwise
void getData(const Eigen::MatrixBase< DI > &indices, const Eigen::MatrixBase< DV > &values) const
get the data from the heap
void reset()
reset to the empty heap
void reset()
reset to the empty heap
an entry of the heap tree
IndexHeapBruteForceVector(const size_t size)
Constructor.
constexpr ValueType invalidValue()
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
void getData(const Eigen::MatrixBase< DI > &indices, const Eigen::MatrixBase< DV > &values) const
get the data from the heap
libnabo
Author(s): Stéphane Magnenat
autogenerated on Fri Aug 2 2024 08:39:11