From dbee70fe5eb7abca31c01c046ec2174f2dde7665 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Thu, 30 Jan 2020 13:52:53 -0500 Subject: any orthogonal size that is a multiple of four is now available instead of powers of two --- hadamard_mcmc.hpp | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) (limited to 'hadamard_mcmc.hpp') diff --git a/hadamard_mcmc.hpp b/hadamard_mcmc.hpp index eab9916..bca8ae2 100644 --- a/hadamard_mcmc.hpp +++ b/hadamard_mcmc.hpp @@ -18,6 +18,10 @@ public: } } + Orthogonal(const std::vector& x) : m(x) { + d = sqrt(x.size()); + } + unsigned size() const { return d; } double& operator()(unsigned i, unsigned j) { return m[d * i + j]; } @@ -37,28 +41,6 @@ public: } }; -Orthogonal walsh(unsigned k) { - if (k == 0) { - return Orthogonal(1); - } else { - Orthogonal s = walsh(k - 1); - Orthogonal t = Orthogonal(2 * s.size()); - - for (unsigned i = 0; i < s.size(); i++) { - for (unsigned j = 0; j < s.size(); j++) { - double sij = s(i, j); - - t(i, j) = sij; - t(s.size() + i, j) = sij; - t(i, s.size() + j) = sij; - t(s.size() + i, s.size() + j) = -sij; - } - } - - return t; - } -} - class Givens { private: Orthogonal& m; -- cgit v1.2.3-54-g00ecf