-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwalker.h
34 lines (30 loc) · 847 Bytes
/
walker.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef WALKER_H
#define WALKER_H
#include <complex>
#include <eigen3/Eigen/Dense>
#include <vector>
class Walker {
bool isQuantum{false};
Eigen::VectorXcd state;
Eigen::MatrixXd walkMatrix;
Eigen::PermutationMatrix<Eigen::Dynamic> permutationMatrix() const;
public:
explicit Walker(const decltype(state) & initState, const Eigen::Matrix2d & coin);
decltype(state) step(const std::size_t n);
virtual Eigen::VectorXd getProbabilities() const;
static auto hadamardCoin() {
static Eigen::Matrix2d hadamard;
hadamard << 1, 1,
1, -1;
hadamard /= std::sqrt(2);
return hadamard;
}
static auto classicCoin() {
static Eigen::Matrix2d coin;
coin << 1, 1,
1, 1;
coin /= 2;
return coin;
}
};
#endif // WALKER_H