diff options
| -rw-r--r-- | .gitmodules | 3 | ||||
| -rw-r--r-- | hadamard_mcmc.hpp | 9 | ||||
| -rw-r--r-- | hadamard_pt.hpp | 2 | ||||
| m--------- | pcg-cpp | 0 | 
4 files changed, 10 insertions, 4 deletions
| diff --git a/.gitmodules b/.gitmodules index 94345fd..a14394b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@  [submodule "randutils"]  	path = randutils  	url = https://gist.github.com/imneme/540829265469e673d045 +[submodule "pcg-cpp"] +	path = pcg-cpp +	url = https://github.com/imneme/pcg-cpp diff --git a/hadamard_mcmc.hpp b/hadamard_mcmc.hpp index bca8ae2..218f8d1 100644 --- a/hadamard_mcmc.hpp +++ b/hadamard_mcmc.hpp @@ -1,8 +1,11 @@  #pragma once  #include "randutils/randutils.hpp" +#include "pcg-cpp/include/pcg_random.hpp"  #include <vector> +using Rng = randutils::random_generator<pcg32>; +  inline double Ei(double x) { return -fabs(x); }  class Orthogonal { @@ -53,7 +56,7 @@ private:    std::vector<double> rows;  public: -  Givens(Orthogonal& m, bool t, unsigned a1, unsigned a2, double θ0, randutils::mt19937_rng& rng) +  Givens(Orthogonal& m, bool t, unsigned a1, unsigned a2, double θ0, Rng& rng)        : m(m), rows(2 * m.size()) {      transpose = t;      axis_1 = a1; @@ -61,7 +64,7 @@ public:      Δθ = rng.uniform(-θ0, θ0);    } -  Givens(Orthogonal& m, double θ0, randutils::mt19937_rng& rng) : m(m), rows(2 * m.size()) { +  Givens(Orthogonal& m, double θ0, Rng& rng) : m(m), rows(2 * m.size()) {      Δθ = rng.uniform(-θ0, θ0);      unsigned axis1axis2 = rng.uniform((unsigned)0, m.size() * (m.size() - 1) - 1); @@ -134,7 +137,7 @@ private:    double θ0;  public: -  randutils::mt19937_rng rng; +  Rng rng;    double β;    double E;    Orthogonal M; diff --git a/hadamard_pt.hpp b/hadamard_pt.hpp index 7b53b92..8d0a1f7 100644 --- a/hadamard_pt.hpp +++ b/hadamard_pt.hpp @@ -21,7 +21,7 @@ typedef struct range {  class PT {  private: -  randutils::mt19937_rng rng; +  Rng rng;  public:    std::vector<MCMC> Ms; diff --git a/pcg-cpp b/pcg-cpp new file mode 160000 +Subproject b263c73ec965ad515de8be8286086d78c67c2f0 | 
