diff options
Diffstat (limited to 'hadamard_pt.hpp')
-rw-r--r-- | hadamard_pt.hpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/hadamard_pt.hpp b/hadamard_pt.hpp index 404129c..744c866 100644 --- a/hadamard_pt.hpp +++ b/hadamard_pt.hpp @@ -1,6 +1,7 @@ #pragma once #include "hadamard_mcmc.hpp" +#include <list> void swap(MCMC& s1, MCMC& s2) { std::swap(s1.M, s2.M); @@ -13,6 +14,12 @@ public: virtual void after_sweep(const std::vector<MCMC>&){}; }; +typedef struct range { + double β0; + double β1; + unsigned N; +} range; + class PT { private: randutils::mt19937_rng rng; @@ -22,13 +29,14 @@ public: ParallelMeasurement& B; std::vector<Measurement*>& As; - PT(double β0, double β1, unsigned N, unsigned n, ParallelMeasurement& B, + PT(std::list<range> ranges, unsigned n, ParallelMeasurement& B, std::vector<Measurement*>& As) : B(B), As(As) { - Ms.reserve(N); - for (unsigned i = 0; i < N; i++) { - double β = β0 + i * (β1 - β0) / (N - 1); - Ms.push_back(MCMC(n, β, *As[i])); + for (range r : ranges) { + for (unsigned i = 0; i < r.N; i++) { + double β = r.β0 + i * (r.β1 - r.β0) / (r.N - 1); + Ms.push_back(MCMC(n, β, *As[i])); + } } } |