31#ifndef __FASTJET_MINHEAP__HH__
32#define __FASTJET_MINHEAP__HH__
38#include "fastjet/internal/base.hh"
40FASTJET_BEGIN_NAMESPACE
53 MinHeap (
const std::vector<double> & values,
unsigned int max_size) :
54 _heap(max_size) {initialise(values);}
58 MinHeap (
unsigned int max_size) : _heap(max_size) {}
61 MinHeap (
const std::vector<double> & values) :
62 _heap(values.size()) {initialise(values);}
66 void initialise(
const std::vector<double> & values);
70 return (_heap[0].minloc) - &(_heap[0]);}
73 inline double minval()
const {
return _heap[0].minloc->value;}
75 inline double operator[](
int i)
const {
return _heap[i].value;}
80 update(loc,std::numeric_limits<double>::max());};
83 void update(
unsigned int,
double);
92 std::vector<ValueLoc> _heap;
MinHeap(const std::vector< double > &values)
constructor in which the the maximum size is the size of the values array
MinHeap(const std::vector< double > &values, unsigned int max_size)
construct a MinHeap from the vector of values, allowing future expansion to a maximum size max_size;
MinHeap(unsigned int max_size)
do the minimal setup for a MinHeap that can reach max_size; initialisation must be performed later wi...
void remove(unsigned int loc)
remove the value at the specified location (i.e.
unsigned int minloc() const
return the location of the minimal value on the heap
double minval() const
return the minimal value on the heap