ALPSCore reference
Public Member Functions | List of all members
alps::alea::internal::galois_hopper Class Reference

#include <galois.hpp>

Collaboration diagram for alps::alea::internal::galois_hopper:
Collaboration graph

Public Member Functions

 galois_hopper (size_t size)
galois_hopperoperator++ ()
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

Detailed Description

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;

Definition at line 37 of file galois.hpp.

Constructor & Destructor Documentation

alps::alea::internal::galois_hopper::galois_hopper ( size_t  size)

Expects number of batches

Definition at line 10 of file galois.cpp.

Member Function Documentation

size_t alps::alea::internal::galois_hopper::current ( ) const

Current batch to fill

Definition at line 53 of file galois.hpp.

size_t alps::alea::internal::galois_hopper::cycle ( ) const

Galois cycle

Definition at line 68 of file galois.hpp.

double alps::alea::internal::galois_hopper::factor ( ) const

Scaling factor of bin size (2**level)

Definition at line 62 of file galois.hpp.

size_t alps::alea::internal::galois_hopper::level ( ) const

Merging level

Definition at line 65 of file galois.hpp.

size_t alps::alea::internal::galois_hopper::merge_into ( ) const

Merge current batch into this one before filling

Definition at line 59 of file galois.hpp.

bool alps::alea::internal::galois_hopper::merge_mode ( ) const

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)


Definition at line 19 of file galois.cpp.

The documentation for this class was generated from the following files: