summaryrefslogtreecommitdiff
path: root/vector.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'vector.hpp')
-rw-r--r--vector.hpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/vector.hpp b/vector.hpp
index 2e87acd..f642816 100644
--- a/vector.hpp
+++ b/vector.hpp
@@ -1,6 +1,7 @@
#pragma once
+#include "mod.hpp"
#include <eigen3/Eigen/Dense>
template <class T, int D> using Vector = Eigen::Matrix<T, D, 1>;
@@ -9,7 +10,7 @@ template <class T, int D> Vector<T, D> diff(T L, Vector<T, D> v1, Vector<T, D> v
Vector<T, D> v;
for (unsigned i = 0; i < D; i++) {
- v(i) = std::abs(v1(i) - v2(i));
+ v(i) = std::abs(mod(v1(i), L) - mod(v2(i), L));
if (v(i) > L / 2) {
v(i) = L - v(i);
}