|
ALPSCore reference
|
#include <galois.hpp>

Public Member Functions | |
| galois_hopper (size_t size) | |
| galois_hopper & | operator++ () |
| galois_hopper | operator++ (int) |
| void | reset (bool merge_mode=false) |
| size_t | current () const |
| bool | merge_mode () const |
| size_t | merge_into () const |
| double | factor () const |
| size_t | level () const |
| size_t | cycle () const |
Continuous bin merging strategy that preserves time ordering.
We want to split a time series (t1, ..., tN) into n compact batches. If we don't know the number of measurements beforehand, the naive strategy to proceed is to average over n/2 pair of batches whenever we run out of space. However, this loses half the batch information.
This class solves the problem by proposing a merge of one batch into it successor at every step, freeing exactly one spot and thus preserving the number of bins. One example usage is:
galois_hopper x(size);
while (true) {
if (x.merge_mode()) {
batch[x.merge_into()] += batch[x.current()];
batch[x.current()] = 0;
}
for (size_t i = 0; i != x.factor(); ++i) {
value = get_next_value();
batch[x.current()] += value;
}
x.advance();
}
Definition at line 37 of file galois.hpp.
| alps::alea::internal::galois_hopper::galois_hopper | ( | size_t | size | ) |
Expects number of batches
Definition at line 10 of file galois.cpp.
|
inline |
Current batch to fill
Definition at line 53 of file galois.hpp.
|
inline |
Galois cycle
Definition at line 68 of file galois.hpp.
|
inline |
Scaling factor of bin size (2**level)
Definition at line 62 of file galois.hpp.
|
inline |
Merging level
Definition at line 65 of file galois.hpp.
|
inline |
Merge current batch into this one before filling
Definition at line 59 of file galois.hpp.
|
inline |
Are we in merge mode?
Definition at line 56 of file galois.hpp.
| galois_hopper & alps::alea::internal::galois_hopper::operator++ | ( | ) |
Advance to the next prescription
Definition at line 42 of file galois.cpp.
| galois_hopper alps::alea::internal::galois_hopper::operator++ | ( | int | ) |
Advance to the next prescription
Definition at line 35 of file galois.cpp.
| void alps::alea::internal::galois_hopper::reset | ( | bool | merge_mode = false | ) |
Reset
Definition at line 19 of file galois.cpp.
1.8.11