10#ifndef INFUSE_SDK_INCLUDE_INFUSE_MATH_STATISTICS_H_
11#define INFUSE_SDK_INCLUDE_INFUSE_MATH_STATISTICS_H_
51 memset(state, 0x00,
sizeof(*state));
76 return (
float)state->
m + ((float)state->
p / state->
n);
94 return (
float)state->
v + ((float)state->
w / (float)(state->
n - 1)) -
95 (state->
n * mean_error * mean_error / (state->
n - 1));
136 return state->
v + (state->
w / (state->
n - 1));
static int32_t statistics_mean_rough(const struct statistics_state *state)
Compute the rough mean of the statistics object.
Definition statistics.h:111
static float statistics_mean(const struct statistics_state *state)
Compute the mean of the statistics object.
Definition statistics.h:69
static uint64_t statistics_variance_rough(const struct statistics_state *state)
Compute the rough variance of the statistics object.
Definition statistics.h:131
void statistics_update(struct statistics_state *state, int32_t value)
Update the statistics object with a new sample.
static void statistics_reset(struct statistics_state *state)
Reset statistics object.
Definition statistics.h:49
static float statistics_variance(const struct statistics_state *state)
Compute the variance of the statistics object.
Definition statistics.h:86
Definition statistics.h:31
int64_t v
Definition statistics.h:33
uint32_t n
Definition statistics.h:41
int32_t m
Definition statistics.h:37
int64_t w
Definition statistics.h:35
int32_t p
Definition statistics.h:39