summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--space_wolff.hpp41
1 files changed, 21 insertions, 20 deletions
diff --git a/space_wolff.hpp b/space_wolff.hpp
index 6ac9788..4c02406 100644
--- a/space_wolff.hpp
+++ b/space_wolff.hpp
@@ -29,12 +29,12 @@ const std::array<std::array<unsigned, 16>, 16> smiley = {
{{0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0}},
{{0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0}}}};
-template <class T, int D> using vector = Eigen::Matrix<T, D, 1>;
+template <class U, unsigned D> using vector = Eigen::Matrix<U, D, 1>;
-template <class T, int D> using matrix = Eigen::Matrix<T, D, D>;
+template <class U, unsigned D> using matrix = Eigen::Matrix<U, D, D>;
-template <class T, int D> vector<T, D> diff(T L, vector<T, D> v1, vector<T, D> v2) {
- vector<T, D> v;
+template <class U, unsigned D> vector<U, D> diff(U L, vector<U, D> v1, vector<U, D> v2) {
+ vector<U, D> v;
for (unsigned i = 0; i < D; i++) {
v(i) = std::abs(v1(i) - v2(i));
@@ -46,20 +46,20 @@ template <class T, int D> vector<T, D> diff(T L, vector<T, D> v1, vector<T, D> v
return v;
}
-template <class T, int D, class state> class spin {
+template <class U, unsigned D, class state> class spin {
public:
- vector<T, D> x;
+ vector<U, D> x;
state s;
};
-template <class T, int D> class euclidean {
+template <class U, unsigned D> class euclidean {
private:
- T L;
+ U L;
public:
- vector<T, D> t;
- matrix<T, D> r;
- euclidean(T L) : L(L) {
+ vector<U, D> t;
+ matrix<U, D> r;
+ euclidean(U L) : L(L) {
for (unsigned i = 0; i < D; i++) {
t(i) = 0;
r(i, i) = 1;
@@ -69,13 +69,14 @@ public:
}
}
- euclidean(T L, vector<T, D> t0, matrix<T, D> r0) : L(L) {
+ euclidean(U L, vector<U, D> t0, matrix<U, D> r0) : L(L) {
t = t0;
r = r0;
}
- template <class state> spin<T, D, state> act(const spin<T, D, state>& s) const {
- spin<T, D, state> s_new;
+ template <class state>
+ spin<U, D, state> act(const spin<U, D, state> &s) const {
+ spin<U, D, state> s_new;
s_new.x = t + r * s.x;
s_new.s = s.s;
@@ -88,8 +89,8 @@ public:
}
euclidean act(const euclidean& x) const {
- vector<T, D> tnew = r * x.t + t;
- matrix<T, D> rnew = r * x.r;
+ vector<U, D> tnew = r * x.t + t;
+ matrix<U, D> rnew = r * x.r;
for (unsigned i = 0; i < D; i++) {
tnew(i) = fmod(L + tnew(i), L);
@@ -101,8 +102,8 @@ public:
}
euclidean inverse() const {
- vector<T, D> tnew = -r.transpose() * t;
- matrix<T, D> rnew = r.transpose();
+ vector<U, D> tnew = -r.transpose() * t;
+ matrix<U, D> rnew = r.transpose();
euclidean pnew(this->L, tnew, rnew);
@@ -110,7 +111,7 @@ public:
}
};
-template <class T, int D> class dictionary {
+template <class T, unsigned D> class dictionary {
private:
unsigned N;
T L;
@@ -243,7 +244,7 @@ public:
unsigned num_added() const { return n - wait; }
};
-template <class U, int D, class state> class model {
+template <class U, unsigned D, class state> class model {
public:
U L;
euclidean<U, D> s0;