diff options
author | torset | 2009-01-12 13:17:56 +0000 |
---|---|---|
committer | torset | 2009-01-12 13:17:56 +0000 |
commit | d919964ae7fd6741f92ffa7682889f7602d1b405 (patch) | |
tree | 1eec287e1d5e9ca839cf53d168afc19a6b4b52bb /src/statisticsFunctions/prod/sproda.c | |
parent | 9d66ab3c5fe27b62252e1a2c8c7a037d9a5af9b9 (diff) | |
download | scilab2c-d919964ae7fd6741f92ffa7682889f7602d1b405.tar.gz scilab2c-d919964ae7fd6741f92ffa7682889f7602d1b405.tar.bz2 scilab2c-d919964ae7fd6741f92ffa7682889f7602d1b405.zip |
Add prod (tests for cproda and zproda failed)
Diffstat (limited to 'src/statisticsFunctions/prod/sproda.c')
-rw-r--r-- | src/statisticsFunctions/prod/sproda.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/statisticsFunctions/prod/sproda.c b/src/statisticsFunctions/prod/sproda.c new file mode 100644 index 00000000..9c5bfc24 --- /dev/null +++ b/src/statisticsFunctions/prod/sproda.c @@ -0,0 +1,29 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud TORSET + * + * 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 "prod.h" + + +float sproda(float *in, int size) { + float accumulate = in[0]; + int i = 0; + + + for (i = 1; i < size; ++i) + { + accumulate *= in[i]; + } + return accumulate; + +} + + |