Skip to content

Commit

Permalink
tweak accumulation of average
Browse files Browse the repository at this point in the history
  • Loading branch information
bodono committed Jan 1, 2024
1 parent 66bc3b2 commit 41bf301
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/aa.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ aa_float aa_apply(aa_float *f, const aa_float *x, AaWork *a) {

for (i = 0; i < a->dim; ++i) {
/* accumulate the average */
a->x[i] = (a->x[i] * a->iter + f[i]) / (a->iter + 1);
a->x[i] *= a->iter / (a->iter + 1);
a->x[i] += f[i] / (a->iter + 1);
/* a->x[i] = (a->x[i] * a->iter + f[i]) / (a->iter + 1); */
}

a->iter++;
Expand Down

0 comments on commit 41bf301

Please sign in to comment.