From 32033b5c86201233f337e372698403e2d4dca399 Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Sun, 23 Jul 2023 12:53:46 +0200 Subject: [PATCH] stop using pow when possible https://stackoverflow.com/questions/2940367/what-is-more-efficient-using-pow-to-square-or-just-multiply-it-with-itself --- examples/06_gamma_beta/example | Bin 22192 -> 22160 bytes squiggle.c | 9 +++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/06_gamma_beta/example b/examples/06_gamma_beta/example index b3743d3fa102c761c8f872a7324609b9bc3dfc54..20513bc6d08ac3b043606cf8d7d4ed0f2bed6c34 100755 GIT binary patch literal 22160 zcmeHPe{@vUoxe#4KWdUm6bjWAM$|1J3;}@(l#+xzcxe-jNGhbjIAkVd+9U&$84L)D zrdp>l7Wb@c+wGoW*LLxgc5RpT#8X-)TAR4dwo$Q#729czcBaHO2HIvdI{W$Fd%rJl z9vSWF*+2S6?n&l*@AudJ-tYH&@4N5Ln|G&Cy)ic@M{vm#9}}{5slt?L!oUs8Aw-$D zUKHYUo|r490zC!)Wt!}Sr*jp7;dITH2S{>rs4@Zkph63VY#~9C%T{VaSGMg#$h=l?uVoE=Rs8Tc_m8YBJ$~!!ImHXp*bda(&Nv9Kb!^sbQXM1 z7JO|Myf+K}KeFII47?lv&awrFiN^J%EO>JEMEtjB!LI_|jelpU2Vx>UM}eR3WTrOq zv4zramGD+=sqy*);lS=-TO<(PQnR5s)Ee00+tnNpUhnRfP^-5s;tNN-Ud1{gV{>S? zXxkf(G|EqbW~0~>x=jSy_W%`arT!XJe}VR31d5@v;WOTbrq6gAeZgk2CmLyJ@`Xi< zuemwY0D42a&)XPm^)&|%kR2qi?P&2qUt8;*aIh8qHHHHLv8lSMVuN?NXSrwPczyMF z^&?hw1r0t|&VxM6s(e|Wf_XwSV=6xBU)6{+2b3H@nww?#k6s?c6=ACQxyHpF{AWy~ zDdHvF{+w**iPzAkk^^mf0eStH84MQEEPq4el)hZ4kNA0A=k+w9gKFw^oAF0AemW&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7L7kjick6RzkwtF$N85M6&^?D2}to}Op0GY`X#cFKmHu+7F?Zk8qU diff --git a/squiggle.c b/squiggle.c index 9d649d3..3d3f4e6 100644 --- a/squiggle.c +++ b/squiggle.c @@ -105,9 +105,9 @@ float sample_gamma(float alpha, uint64_t* seed) v = 1.0 + c * x; } while (v <= 0.0); - v = pow(v, 3); + v = v * v * v; u = sample_unit_uniform(seed); - if (u < 1.0 - 0.0331 * pow(x, 4)) { // Condition 1 + if (u < 1.0 - 0.0331 * (x * x * x * x)) { // Condition 1 // the 0.0331 doesn't inspire much confidence // however, this isn't the whole story // by knowing that Condition 1 implies condition 2 @@ -115,7 +115,7 @@ float sample_gamma(float alpha, uint64_t* seed) // i.e., of not using the logarithms return d * v; } - if (log(u) < 0.5 * pow(x, 2) + d * (1.0 - v + log(v))) { // Condition 2 + if (log(u) < 0.5 * (x * x) + d * (1.0 - v + log(v))) { // Condition 2 return d * v; } } @@ -161,7 +161,8 @@ float array_std(float* array, int length) float mean = array_mean(array, length); float std = 0.0; for (int i = 0; i < length; i++) { - std += pow(array[i] - mean, 2.0); + std += (array[i] - mean); + std *= std; } std = sqrt(std / length); return std;