From 54f476df0d229c643a63e0184a5168c397139aff Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sun, 21 Jul 2024 12:18:14 +0200 Subject: [PATCH] fixed nmul to use get_half_shift_cycles --- nonisotropic.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nonisotropic.cpp b/nonisotropic.cpp index 4db79e41..6926a0bc 100644 --- a/nonisotropic.cpp +++ b/nonisotropic.cpp @@ -2573,6 +2573,10 @@ EX namespace twist { return floor(shift / TAU + .5) * TAU; } + EX ld get_half_shift_cycles(ld shift) { + return floor(shift / M_PI + .5) * M_PI; + } + EX transmatrix chg_shift(ld x) { return cspin(2, 3, x) * cspin(0, 1, x); } @@ -2580,7 +2584,7 @@ EX namespace twist { /** multiply a SLR-shiftmatrix by a SLR-shiftpoint */ EX shiftpoint nmul(const shiftmatrix& T, shiftpoint h) { optimize_shift(h); - ld sh = get_shift_cycles(h.shift); + ld sh = get_half_shift_cycles(h.shift); h.shift -= sh; auto res0 = T; optimize_shift(res0); @@ -2597,7 +2601,7 @@ EX namespace twist { /** multiply a SLR-shiftmatrix by a SLR-shiftmatrix */ EX shiftmatrix nmul(const shiftmatrix& T, shiftmatrix h) { optimize_shift(h); - ld sh = get_shift_cycles(h.shift); + ld sh = get_half_shift_cycles(h.shift); h.shift -= sh; auto res0 = T;