summaryrefslogtreecommitdiff
path: root/src/statisticsFunctions/mean/dmeana.c
diff options
context:
space:
mode:
authorjofret2008-05-30 12:14:49 +0000
committerjofret2008-05-30 12:14:49 +0000
commitbce36a4569db3eb9ffc61faa6ed4fe6c53181d7f (patch)
tree268779c3c76db52f04e86e08520910518840ae7f /src/statisticsFunctions/mean/dmeana.c
parent1b6fd6bc59862405df426528f0ba21785d59d821 (diff)
downloadscilab2c-bce36a4569db3eb9ffc61faa6ed4fe6c53181d7f.tar.gz
scilab2c-bce36a4569db3eb9ffc61faa6ed4fe6c53181d7f.tar.bz2
scilab2c-bce36a4569db3eb9ffc61faa6ed4fe6c53181d7f.zip
* Adding mean function
!! WARNING !! For the moment only the global mean is implemented, the one with only one parameter. More will follow.
Diffstat (limited to 'src/statisticsFunctions/mean/dmeana.c')
-rw-r--r--src/statisticsFunctions/mean/dmeana.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/statisticsFunctions/mean/dmeana.c b/src/statisticsFunctions/mean/dmeana.c
new file mode 100644
index 00000000..db11766a
--- /dev/null
+++ b/src/statisticsFunctions/mean/dmeana.c
@@ -0,0 +1,25 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+#include "mean.h"
+
+double dmeana(double *in, int size) {
+ double accumulate = 0.0;
+ int i = 0;
+
+ for (i = 0; i < size; ++i)
+ {
+ accumulate += in[i];
+ }
+ return accumulate / (double) size;
+
+}