luasandbox  1.4.0
Generic Lua sandbox for dynamic data analysis
running_stats.h
Go to the documentation of this file.
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 
7 /** Calculates the running count, sum, mean, variance, and standard deviation
8  * @file */
9 
10 #ifndef lsb_util_running_stats_h_
11 #define lsb_util_running_stats_h_
12 
13 #include "util.h"
14 
15 typedef struct lsb_running_stats
16 {
17  double count;
18  double mean;
19  double sum;
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 /**
27  * Zeros out the stats counters
28  *
29  * @param s Stat structure to zero out
30  */
32 
33 /**
34  * Value to add to the running stats
35  *
36  * @param s Stat structure
37  * @param d Value to add
38  */
40 
41 /**
42  * Return the standard deviation of the stats
43  *
44  * @param s Stat structure
45  *
46  * @return double Standard deviation of the stats up to this point
47  */
49 
50 #ifdef __cplusplus
51 }
52 #endif
53 
54 #endif
LSB_UTIL_EXPORT double lsb_sd_running_stats(lsb_running_stats *s)
Return the standard deviation of the stats.
Shared types and structures.
#define LSB_UTIL_EXPORT
Definition: util.h:28
LSB_UTIL_EXPORT void lsb_update_running_stats(lsb_running_stats *s, double d)
Value to add to the running stats.
LSB_UTIL_EXPORT void lsb_init_running_stats(lsb_running_stats *s)
Zeros out the stats counters.
struct lsb_running_stats lsb_running_stats