diff options
Diffstat (limited to 'vector.hpp')
-rw-r--r-- | vector.hpp | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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); } |