This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
stellar-stellar/decoders/session_flags/onlinemean.h

31 lines
632 B
C

#ifndef ONLINEMEAN_H_
#define ONLINEMEAN_H_
#ifdef __cplusplus
extern "C" {
#endif
/* Set to 1 to return unbiased (sample) variance
* rather than a population variance */
#define UNBIASED_ESTIMATOR 0
#include <stdint.h>
typedef struct OnlineMean {
float mean;
float varsum; // variance sum
uint32_t count;
} OnlineMean_t;
void OnlineMean_Init(OnlineMean_t *oMean);
void OnlineMean_Update(OnlineMean_t *oMean, float newValue);
float OnlineMean_GetMean(OnlineMean_t *oMean);
float OnlineMean_GetStd(OnlineMean_t *oMean);
void OnlineMean_Reset(OnlineMean_t *oMean);
#ifdef __cplusplus
}
#endif
#endif /* ONLINEMEAN_H_ */