Paparazzi UAS  v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
pprz_stat.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 Gautier Hattenberger (ENAC), 2017 Kirk Scheper
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
27 #ifndef PPRZ_STAT_H
28 #define PPRZ_STAT_H
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #include "std.h"
35 
42 extern int32_t mean_i(int32_t *array, uint32_t n_elements);
43 
53 extern int32_t variance_i(int32_t *array, uint32_t n_elements);
54 
64 extern int32_t covariance_i(int32_t *array1, int32_t *array2, uint32_t n_elements);
65 
66 
72 extern float sum_f(float *array, uint32_t n_elements);
73 
79 extern float mean_f(float *arr, uint32_t n_elements);
80 
89 extern float variance_f(float *array, uint32_t n_elements);
90 
99 extern float covariance_f(float *array1, float *array2, uint32_t n_elements);
100 
101 #ifdef __cplusplus
102 } /* extern "C" */
103 #endif
104 
105 #endif /* PPRZ_STAT_H */
int32_t mean_i(int32_t *array, uint32_t n_elements)
Compute the mean value of an array This is implemented using floats to handle scaling of all variable...
Definition: pprz_stat.c:39
int * array
int32_t variance_i(int32_t *array, uint32_t n_elements)
Compute the variance of an array of values (integer).
Definition: pprz_stat.c:64
unsigned long uint32_t
Definition: types.h:18
float variance_f(float *array, uint32_t n_elements)
Compute the variance of an array of values (float).
Definition: pprz_stat.c:139
signed long int32_t
Definition: types.h:19
float sum_f(float *array, uint32_t n_elements)
Compute the sum array elements.
Definition: pprz_stat.c:106
int32_t covariance_i(int32_t *array1, int32_t *array2, uint32_t n_elements)
Compute the covariance of two arrays V(X) = E[(X-E[X])(Y-E[Y])] = E[XY] - E[X]E[Y] where E[X] is the ...
Definition: pprz_stat.c:78
float covariance_f(float *array1, float *array2, uint32_t n_elements)
Compute the covariance of two arrays V(X) = E[(X-E[X])(Y-E[Y])] = E[XY] - E[X]E[Y] where E[X] is the ...
Definition: pprz_stat.c:152
float mean_f(float *arr, uint32_t n_elements)
Compute the mean value of an array (float)
Definition: pprz_stat.c:122