Skip to content

Commit

Permalink
MovStats: fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
baranovmv committed May 29, 2024
1 parent a22c2eb commit 23fa62e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/internal_modules/roc_core/mov_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ template <typename T> class MovStats {
, curr_max_(T(0))
, queue_min_(arena, win_len + 1)
, curr_min_(T(0)) {

if (win_len == 0) {
roc_panic("mov stats: window length must be greater than 0");
}
Expand Down
6 changes: 3 additions & 3 deletions src/tests/roc_core/test_mov_stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ TEST(movstats, single_pass) {
double target_avg = 0;
double target_var = 0;
for (size_t i = 0; i < n; i++) {
x[i] = int64_t (i * n);
x[i] = int64_t(i * n);
stats.add(x[i]);
target_avg = target_var = 0;
for (size_t j = 0; j <= i; ++j) {
target_avg += double(x[j]);
}
target_avg /= double(i+1);
target_avg /= double(i + 1);
for (size_t j = 0; j <= i; ++j) {
target_var += (double)(x[j] - target_avg) * (double)(x[j] - target_avg);
}
target_var = sqrt(target_var / double (i + 1));
target_var = sqrt(target_var / double(i + 1));
LONGS_EQUAL((int64_t)target_avg, stats.mov_avg());
LONGS_EQUAL((int64_t)target_var, stats.mov_var());
}
Expand Down

0 comments on commit 23fa62e

Please sign in to comment.