From 8bd000332f486ccce32f161dacf4339e2159d223 Mon Sep 17 00:00:00 2001 From: Miller Cy Chan Date: Sat, 28 Sep 2024 15:18:17 +0800 Subject: [PATCH] Add files via upload --- nQuantCpp/PnnLABGAQuantizer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nQuantCpp/PnnLABGAQuantizer.cpp b/nQuantCpp/PnnLABGAQuantizer.cpp index 92d0b1d..a68e3d1 100644 --- a/nQuantCpp/PnnLABGAQuantizer.cpp +++ b/nQuantCpp/PnnLABGAQuantizer.cpp @@ -216,7 +216,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; } @@ -224,7 +224,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; }