Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
mcychan authored Sep 28, 2024
1 parent 1d22068 commit 58176df
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/nQuant/j2se/PnnLABGAQuantizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,15 @@ public float getFitness() {
private double rotateLeft(double u, double v, double delta) {
double theta = Math.PI * randrange(minRatio, maxRatio) / Math.exp(delta);
double result = u * Math.sin(theta) + v * Math.cos(theta);
if(result <= minRatio || result >= maxRatio)
if (delta < 50 && (result <= minRatio || result >= maxRatio))
result = rotateLeft(u, v, delta + .5);
return result;
}

private double rotateRight(double u, double v, double delta) {
double theta = Math.PI * randrange(minRatio, maxRatio) / Math.exp(delta);
double result = u * Math.cos(theta) - v * Math.sin(theta);
if(result <= minRatio || result >= maxRatio)
if (delta < 50 && (result <= minRatio || result >= maxRatio))
result = rotateRight(u, v, delta + .5);
return result;
}
Expand Down

0 comments on commit 58176df

Please sign in to comment.