ALPSCore reference
galois.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1998-2018 ALPS Collaboration. See COPYRIGHT.TXT
3  * All rights reserved. Use is subject to license terms. See LICENSE.TXT
4  * For use in publications, see ACKNOWLEDGE.TXT
5  */
6 #pragma once
7 
8 #include <alps/alea/core.hpp>
9 
10 namespace alps { namespace alea { namespace internal {
11 
38 {
39 public:
41  galois_hopper(size_t size);
42 
45 
48 
50  void reset(bool merge_mode=false);
51 
53  size_t current() const { return current_; }
54 
56  bool merge_mode() const { return level_ != 0; }
57 
59  size_t merge_into() const { return (current_ + skip_) % (size_ + 1); }
60 
62  double factor() const { return factor_; }
63 
65  size_t level() const { return level_; }
66 
68  size_t cycle() const { return cycle_; }
69 
70 private:
71  void advance_fill();
72  void advance_galois();
73 
74  size_t size_;
75  size_t level_, factor_;
76  size_t current_, skip_, level_pos_, cycle_;
77 };
78 
79 }}}
std::enable_if<!is_sequence< T >::value, std::size_t >::type size(T const &)
Definition: size.hpp:20
void reset(bool merge_mode=false)
Definition: galois.cpp:19
galois_hopper & operator++()
Definition: galois.cpp:42