From 72eddec73ac1d5b547d7d519409630f706aac2c4 Mon Sep 17 00:00:00 2001 From: Miller Cy Chan Date: Sat, 28 Sep 2024 15:20:16 +0800 Subject: [PATCH] Add files via upload --- nQuantGpp/PnnLABGAQuantizer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nQuantGpp/PnnLABGAQuantizer.cpp b/nQuantGpp/PnnLABGAQuantizer.cpp index 15a69c0..7177782 100644 --- a/nQuantGpp/PnnLABGAQuantizer.cpp +++ b/nQuantGpp/PnnLABGAQuantizer.cpp @@ -207,7 +207,7 @@ namespace PnnLABQuant static double rotateLeft(double u, double v, double delta) { auto theta = M_PI * randrange(minRatio, maxRatio) / exp(delta); auto result = u * sin(theta) + v * cos(theta); - if (result <= minRatio || result >= maxRatio) + if (delta < 50 && (result <= minRatio || result >= maxRatio)) result = rotateLeft(u, v, delta + .5); return result; } @@ -215,7 +215,7 @@ namespace PnnLABQuant static double rotateRight(double u, double v, double delta) { auto theta = M_PI * randrange(minRatio, maxRatio) / exp(delta); auto result = u * cos(theta) - v * sin(theta); - if (result <= minRatio || result >= maxRatio) + if (delta < 50 && (result <= minRatio || result >= maxRatio)) result = rotateRight(u, v, delta + .5); return result; }