From c188371411765049f5953bc8a29028333e19a6d9 Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Fri, 24 Apr 2020 10:16:09 +0200 Subject: [PATCH] added support for disabling normalization --- sma.hh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sma.hh b/sma.hh index ca284f9..8cb0c11 100644 --- a/sma.hh +++ b/sma.hh @@ -41,7 +41,7 @@ public: } }; -template +template class SMA2 { TYPE hist_inp[NUM]; @@ -59,11 +59,13 @@ public: hist_inp[hist_pos] = input; if (++hist_pos >= NUM) hist_pos = 0; - return hist_sum / VALUE(NUM); + if (NORM) + return hist_sum / VALUE(NUM); + return hist_sum; } }; -template +template class SMA3 { TYPE hist_inp[NUM]; @@ -81,11 +83,13 @@ public: hist_inp[hist_pos] = input; if (++hist_pos >= NUM) hist_pos = 0; - return hist_sum(input) / VALUE(NUM); + if (NORM) + return hist_sum(input) / VALUE(NUM); + return hist_sum(input); } }; -template +template class SMA4 { TYPE tree[2 * NUM]; @@ -103,7 +107,9 @@ public: tree[parent] = tree[child] + tree[child^1]; if (++leaf >= 2 * NUM) leaf = NUM; - return tree[1] / VALUE(NUM); + if (NORM) + return tree[1] / VALUE(NUM); + return tree[1]; } };