summaryrefslogtreecommitdiff
path: root/hadamard_mcmc.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'hadamard_mcmc.hpp')
-rw-r--r--hadamard_mcmc.hpp26
1 files changed, 4 insertions, 22 deletions
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<double>& 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;