|
| MinHeap (const std::vector< double > &values, unsigned int max_size) |
|
| MinHeap (unsigned int max_size) |
|
| MinHeap (const std::vector< double > &values) |
|
void | initialise (const std::vector< double > &values) |
|
unsigned int | minloc () const |
|
double | minval () const |
|
double | operator[] (int i) const |
|
void | remove (unsigned int loc) |
|
void | update (unsigned int, double) |
|
◆ MinHeap() [1/3]
MinHeap |
( |
const std::vector< double > & |
values, |
|
|
unsigned int |
max_size |
|
) |
| |
|
inline |
◆ MinHeap() [2/3]
◆ MinHeap() [3/3]
MinHeap |
( |
const std::vector< double > & |
values | ) |
|
|
inline |
◆ initialise()
void initialise |
( |
const std::vector< double > & |
values | ) |
|
3692 for (
unsigned i = values.size(); i <
_heap.size(); i++) {
3693 _heap[i].value = std::numeric_limits<double>::max();
3696 for (
unsigned i = 0; i < values.size(); i++) {
3697 _heap[i].value = values[i];
3700 for (
unsigned i =
_heap.size()-1; i > 0; i--) {
3701 ValueLoc * parent = &(
_heap[(i-1)/2]);
3702 ValueLoc * here = &(
_heap[i]);
3703 if (here->minloc->value < parent->minloc->value) {
3704 parent->minloc = here->minloc;
◆ minloc()
unsigned int minloc |
( |
| ) |
const |
|
inline |
◆ minval()
657 {
return _heap[0].minloc->value;}
◆ operator[]()
double operator[] |
( |
int |
i | ) |
const |
|
inline |
658 {
return _heap[i].value;}
◆ remove()
void remove |
( |
unsigned int |
loc | ) |
|
|
inline |
660 update(loc,std::numeric_limits<double>::max());};
◆ update()
void update |
( |
unsigned int |
loc, |
|
|
double |
new_value |
|
) |
| |
3709 assert(loc <
_heap.size());
3710 ValueLoc * start = &(
_heap[loc]);
3711 if (start->minloc != start && !(new_value < start->
minloc->value)) {
3712 start->value = new_value;
3715 start->value = new_value;
3716 start->minloc = start;
3717 bool change_made =
true;
3718 ValueLoc * heap_end = (&(
_heap[0])) +
_heap.size();
3719 while(change_made) {
3720 ValueLoc * here = &(
_heap[loc]);
3721 change_made =
false;
3722 if (here->minloc == start) {
3723 here->minloc = here; change_made =
true;
3725 ValueLoc * child = &(
_heap[2*loc+1]);
3726 if (child < heap_end && child->
minloc->value < here->minloc->value ) {
3727 here->minloc = child->minloc;
3728 change_made =
true;}
3730 if (child < heap_end && child->
minloc->value < here->minloc->value ) {
3731 here->minloc = child->minloc;
3732 change_made =
true;}
3733 if (loc == 0) {
break;}
◆ _heap
The documentation for this class was generated from the following file:
- /builds/cms-analysis/general/DasAnalysisSystem/Core/Installer/Core/JetObservables/src/fjcore.cc