diff options
author | jofret | 2008-05-30 12:14:49 +0000 |
---|---|---|
committer | jofret | 2008-05-30 12:14:49 +0000 |
commit | bce36a4569db3eb9ffc61faa6ed4fe6c53181d7f (patch) | |
tree | 268779c3c76db52f04e86e08520910518840ae7f /src/statisticsFunctions | |
parent | 1b6fd6bc59862405df426528f0ba21785d59d821 (diff) | |
download | scilab2c-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')
-rw-r--r-- | src/statisticsFunctions/mean/Makefile.am | 2 | ||||
-rw-r--r-- | src/statisticsFunctions/mean/Makefile.in | 671 | ||||
-rw-r--r-- | src/statisticsFunctions/mean/cmeana.c | 24 | ||||
-rw-r--r-- | src/statisticsFunctions/mean/dmeana.c | 25 | ||||
-rw-r--r-- | src/statisticsFunctions/mean/smeana.c | 25 | ||||
-rw-r--r-- | src/statisticsFunctions/mean/testDoubleMean.c | 101 | ||||
-rw-r--r-- | src/statisticsFunctions/mean/testFloatMean.c | 102 | ||||
-rw-r--r-- | src/statisticsFunctions/mean/zmeana.c | 24 |
8 files changed, 973 insertions, 1 deletions
diff --git a/src/statisticsFunctions/mean/Makefile.am b/src/statisticsFunctions/mean/Makefile.am index dd2d9358..7fac26c5 100644 --- a/src/statisticsFunctions/mean/Makefile.am +++ b/src/statisticsFunctions/mean/Makefile.am @@ -43,7 +43,7 @@ check_PROGRAMS = testFloatMean testDoubleMean TESTS = testFloatMean testDoubleMean # -# -*- Meanine Tests -*- +# -*- Mean Tests -*- # testFloatMean_SOURCES = testFloatMean.c testFloatMean_CFLAGS = $(check_INCLUDES) diff --git a/src/statisticsFunctions/mean/Makefile.in b/src/statisticsFunctions/mean/Makefile.in new file mode 100644 index 00000000..00628302 --- /dev/null +++ b/src/statisticsFunctions/mean/Makefile.in @@ -0,0 +1,671 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +check_PROGRAMS = testFloatMean$(EXEEXT) testDoubleMean$(EXEEXT) +TESTS = testFloatMean$(EXEEXT) testDoubleMean$(EXEEXT) +subdir = statisticsFunctions/mean +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/includes/machine.h +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(pkglibdir)" +pkglibLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(pkglib_LTLIBRARIES) +libMean_la_LIBADD = +am__objects_1 = +am__objects_2 = libMean_la-smeana.lo libMean_la-dmeana.lo \ + libMean_la-cmeana.lo libMean_la-zmeana.lo +am_libMean_la_OBJECTS = $(am__objects_1) $(am__objects_2) +libMean_la_OBJECTS = $(am_libMean_la_OBJECTS) +libMean_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libMean_la_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_testDoubleMean_OBJECTS = testDoubleMean-testDoubleMean.$(OBJEXT) +testDoubleMean_OBJECTS = $(am_testDoubleMean_OBJECTS) +am__DEPENDENCIES_1 = $(top_builddir)/type/libDoubleComplex.la \ + $(top_builddir)/type/libFloatComplex.la \ + $(top_builddir)/statisticsFunctions/mean/libMean.la +testDoubleMean_DEPENDENCIES = $(am__DEPENDENCIES_1) +testDoubleMean_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(testDoubleMean_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_testFloatMean_OBJECTS = testFloatMean-testFloatMean.$(OBJEXT) +testFloatMean_OBJECTS = $(am_testFloatMean_OBJECTS) +testFloatMean_DEPENDENCIES = $(am__DEPENDENCIES_1) +testFloatMean_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(testFloatMean_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/includes +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libMean_la_SOURCES) $(testDoubleMean_SOURCES) \ + $(testFloatMean_SOURCES) +DIST_SOURCES = $(libMean_la_SOURCES) $(testDoubleMean_SOURCES) \ + $(testFloatMean_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBMATH = @LIBMATH@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NMEDIT = @NMEDIT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +libMean_la_CFLAGS = -I $(top_builddir)/type \ + -I ../includes + +instdir = $(top_builddir)/lib +pkglib_LTLIBRARIES = libMean.la +libMean_la_SOURCES = $(HEAD) $(SRC) +SRC = smeana.c \ + dmeana.c \ + cmeana.c \ + zmeana.c + +HEAD = ../includes/mean.h + +#### +# Checking Part +#### +check_INCLUDES = -I $(top_builddir)/statisticsFunctions/includes \ + -I $(top_builddir)/type + +check_LDADD = $(top_builddir)/type/libDoubleComplex.la \ + $(top_builddir)/type/libFloatComplex.la \ + $(top_builddir)/statisticsFunctions/mean/libMean.la \ + @LIBMATH@ + + +# +# -*- Mean Tests -*- +# +testFloatMean_SOURCES = testFloatMean.c +testFloatMean_CFLAGS = $(check_INCLUDES) +testFloatMean_LDADD = $(check_LDADD) +testDoubleMean_SOURCES = testDoubleMean.c +testDoubleMean_CFLAGS = $(check_INCLUDES) +testDoubleMean_LDADD = $(check_LDADD) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign statisticsFunctions/mean/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign statisticsFunctions/mean/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" + @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkglibdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkglibdir)/$$f"; \ + else :; fi; \ + done + +uninstall-pkglibLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$p'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$p"; \ + done + +clean-pkglibLTLIBRARIES: + -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) + @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libMean.la: $(libMean_la_OBJECTS) $(libMean_la_DEPENDENCIES) + $(libMean_la_LINK) -rpath $(pkglibdir) $(libMean_la_OBJECTS) $(libMean_la_LIBADD) $(LIBS) + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +testDoubleMean$(EXEEXT): $(testDoubleMean_OBJECTS) $(testDoubleMean_DEPENDENCIES) + @rm -f testDoubleMean$(EXEEXT) + $(testDoubleMean_LINK) $(testDoubleMean_OBJECTS) $(testDoubleMean_LDADD) $(LIBS) +testFloatMean$(EXEEXT): $(testFloatMean_OBJECTS) $(testFloatMean_DEPENDENCIES) + @rm -f testFloatMean$(EXEEXT) + $(testFloatMean_LINK) $(testFloatMean_OBJECTS) $(testFloatMean_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMean_la-cmeana.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMean_la-dmeana.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMean_la-smeana.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMean_la-zmeana.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testDoubleMean-testDoubleMean.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testFloatMean-testFloatMean.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +libMean_la-smeana.lo: smeana.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMean_la_CFLAGS) $(CFLAGS) -MT libMean_la-smeana.lo -MD -MP -MF $(DEPDIR)/libMean_la-smeana.Tpo -c -o libMean_la-smeana.lo `test -f 'smeana.c' || echo '$(srcdir)/'`smeana.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libMean_la-smeana.Tpo $(DEPDIR)/libMean_la-smeana.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smeana.c' object='libMean_la-smeana.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMean_la_CFLAGS) $(CFLAGS) -c -o libMean_la-smeana.lo `test -f 'smeana.c' || echo '$(srcdir)/'`smeana.c + +libMean_la-dmeana.lo: dmeana.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMean_la_CFLAGS) $(CFLAGS) -MT libMean_la-dmeana.lo -MD -MP -MF $(DEPDIR)/libMean_la-dmeana.Tpo -c -o libMean_la-dmeana.lo `test -f 'dmeana.c' || echo '$(srcdir)/'`dmeana.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libMean_la-dmeana.Tpo $(DEPDIR)/libMean_la-dmeana.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dmeana.c' object='libMean_la-dmeana.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMean_la_CFLAGS) $(CFLAGS) -c -o libMean_la-dmeana.lo `test -f 'dmeana.c' || echo '$(srcdir)/'`dmeana.c + +libMean_la-cmeana.lo: cmeana.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMean_la_CFLAGS) $(CFLAGS) -MT libMean_la-cmeana.lo -MD -MP -MF $(DEPDIR)/libMean_la-cmeana.Tpo -c -o libMean_la-cmeana.lo `test -f 'cmeana.c' || echo '$(srcdir)/'`cmeana.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libMean_la-cmeana.Tpo $(DEPDIR)/libMean_la-cmeana.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmeana.c' object='libMean_la-cmeana.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMean_la_CFLAGS) $(CFLAGS) -c -o libMean_la-cmeana.lo `test -f 'cmeana.c' || echo '$(srcdir)/'`cmeana.c + +libMean_la-zmeana.lo: zmeana.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMean_la_CFLAGS) $(CFLAGS) -MT libMean_la-zmeana.lo -MD -MP -MF $(DEPDIR)/libMean_la-zmeana.Tpo -c -o libMean_la-zmeana.lo `test -f 'zmeana.c' || echo '$(srcdir)/'`zmeana.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libMean_la-zmeana.Tpo $(DEPDIR)/libMean_la-zmeana.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zmeana.c' object='libMean_la-zmeana.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMean_la_CFLAGS) $(CFLAGS) -c -o libMean_la-zmeana.lo `test -f 'zmeana.c' || echo '$(srcdir)/'`zmeana.c + +testDoubleMean-testDoubleMean.o: testDoubleMean.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleMean_CFLAGS) $(CFLAGS) -MT testDoubleMean-testDoubleMean.o -MD -MP -MF $(DEPDIR)/testDoubleMean-testDoubleMean.Tpo -c -o testDoubleMean-testDoubleMean.o `test -f 'testDoubleMean.c' || echo '$(srcdir)/'`testDoubleMean.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testDoubleMean-testDoubleMean.Tpo $(DEPDIR)/testDoubleMean-testDoubleMean.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testDoubleMean.c' object='testDoubleMean-testDoubleMean.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleMean_CFLAGS) $(CFLAGS) -c -o testDoubleMean-testDoubleMean.o `test -f 'testDoubleMean.c' || echo '$(srcdir)/'`testDoubleMean.c + +testDoubleMean-testDoubleMean.obj: testDoubleMean.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleMean_CFLAGS) $(CFLAGS) -MT testDoubleMean-testDoubleMean.obj -MD -MP -MF $(DEPDIR)/testDoubleMean-testDoubleMean.Tpo -c -o testDoubleMean-testDoubleMean.obj `if test -f 'testDoubleMean.c'; then $(CYGPATH_W) 'testDoubleMean.c'; else $(CYGPATH_W) '$(srcdir)/testDoubleMean.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testDoubleMean-testDoubleMean.Tpo $(DEPDIR)/testDoubleMean-testDoubleMean.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testDoubleMean.c' object='testDoubleMean-testDoubleMean.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleMean_CFLAGS) $(CFLAGS) -c -o testDoubleMean-testDoubleMean.obj `if test -f 'testDoubleMean.c'; then $(CYGPATH_W) 'testDoubleMean.c'; else $(CYGPATH_W) '$(srcdir)/testDoubleMean.c'; fi` + +testFloatMean-testFloatMean.o: testFloatMean.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatMean_CFLAGS) $(CFLAGS) -MT testFloatMean-testFloatMean.o -MD -MP -MF $(DEPDIR)/testFloatMean-testFloatMean.Tpo -c -o testFloatMean-testFloatMean.o `test -f 'testFloatMean.c' || echo '$(srcdir)/'`testFloatMean.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testFloatMean-testFloatMean.Tpo $(DEPDIR)/testFloatMean-testFloatMean.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testFloatMean.c' object='testFloatMean-testFloatMean.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatMean_CFLAGS) $(CFLAGS) -c -o testFloatMean-testFloatMean.o `test -f 'testFloatMean.c' || echo '$(srcdir)/'`testFloatMean.c + +testFloatMean-testFloatMean.obj: testFloatMean.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatMean_CFLAGS) $(CFLAGS) -MT testFloatMean-testFloatMean.obj -MD -MP -MF $(DEPDIR)/testFloatMean-testFloatMean.Tpo -c -o testFloatMean-testFloatMean.obj `if test -f 'testFloatMean.c'; then $(CYGPATH_W) 'testFloatMean.c'; else $(CYGPATH_W) '$(srcdir)/testFloatMean.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testFloatMean-testFloatMean.Tpo $(DEPDIR)/testFloatMean-testFloatMean.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testFloatMean.c' object='testFloatMean-testFloatMean.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatMean_CFLAGS) $(CFLAGS) -c -o testFloatMean-testFloatMean.obj `if test -f 'testFloatMean.c'; then $(CYGPATH_W) 'testFloatMean.c'; else $(CYGPATH_W) '$(srcdir)/testFloatMean.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *$$ws$$tst$$ws*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + echo "XPASS: $$tst"; \ + ;; \ + *) \ + echo "PASS: $$tst"; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *$$ws$$tst$$ws*) \ + xfail=`expr $$xfail + 1`; \ + echo "XFAIL: $$tst"; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + echo "FAIL: $$tst"; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + echo "SKIP: $$tst"; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all tests failed"; \ + else \ + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + skipped="($$skip tests were not run)"; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(pkglibdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + clean-pkglibLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: install-pkglibLTLIBRARIES + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-pkglibLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool \ + clean-pkglibLTLIBRARIES ctags distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-pkglibLTLIBRARIES install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-pkglibLTLIBRARIES + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/statisticsFunctions/mean/cmeana.c b/src/statisticsFunctions/mean/cmeana.c new file mode 100644 index 00000000..ad2a66fc --- /dev/null +++ b/src/statisticsFunctions/mean/cmeana.c @@ -0,0 +1,24 @@ +/* + * 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" + +floatComplex cmeana(floatComplex *in, int size) { + floatComplex accumulate = FloatComplex(0.0f, 0.0f); + int i = 0; + + for (i = 0; i < size; ++i) + { + accumulate = cadds(accumulate, in[i]); + } + return FloatComplex(creals(accumulate) / (float) size, cimags(accumulate) / (float) size); +} 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; + +} diff --git a/src/statisticsFunctions/mean/smeana.c b/src/statisticsFunctions/mean/smeana.c new file mode 100644 index 00000000..f4b1cd10 --- /dev/null +++ b/src/statisticsFunctions/mean/smeana.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" + +float smeana(float *in, int size) { + float accumulate = 0.0f; + int i = 0; + + for (i = 0; i < size; ++i) + { + accumulate += in[i]; + } + return accumulate / (float) size; + +} diff --git a/src/statisticsFunctions/mean/testDoubleMean.c b/src/statisticsFunctions/mean/testDoubleMean.c new file mode 100644 index 00000000..2f970aef --- /dev/null +++ b/src/statisticsFunctions/mean/testDoubleMean.c @@ -0,0 +1,101 @@ +/* + * 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 <assert.h> +#include <stdio.h> +#include "mean.h" + +/* #define LOCAL_DEBUG */ + +static int dmeansTest(void) { + double value1 = 3.0f; + double value2 = 1.123456789f; + + assert(dmeans(value1) == 3.0f); + assert(dmeans(value2) == 1.123456789f); + return 0; +} + +static int dmeanaTest(void) { + double table1[3] = {3.0, 3.0, 3.0}; + double table2[5] = {9.186784563, + 9.186784563, + 9.186784563, + 9.186784563, + 9.186784563}; + + assert(dmeana(table1, 3) == 3.0); + assert(dmeana(table2, 5) == 9.186784563); + return 0; +} + +static int zmeansTest(void) { + doubleComplex value1 = DoubleComplex(3.0, 3.0); + doubleComplex value2 = DoubleComplex(1.123456789, 1.123456789); + + assert(zreals(zmeans(value1)) == 3.0); + assert(zimags(zmeans(value1)) == 3.0); + assert(zreals(zmeans(value2)) == 1.123456789); + assert(zimags(zmeans(value2)) == 1.123456789); + return 0; +} + +static int zmeanaTest(void) { + doubleComplex value1 = DoubleComplex(3.0, 3.0); + doubleComplex table1[3]; + doubleComplex value2 = DoubleComplex(9.186784563,9.186784563); + doubleComplex table2[5]; + + table1[0] = value1; + table1[1] = value1; + table1[2] = value1; + + table2[0] = value2; + table2[1] = value2; + table2[2] = value2; + table2[3] = value2; + table2[4] = value2; + +#ifdef LOCAL_DEBUG + printf("--------\n"); + printf("%e\n", zimags(zmeana(table1, 3))); + printf("%e\n", zreals(zmeana(table2, 5))); + printf("%e\n", zimags(zmeana(table2, 5))); + printf("%e\n", zreals(zmeana(table2, 5))); + printf("%e\n", zimags(zmeana(table2, 5))); + printf("--------\n"); +#endif + assert(zreals(zmeana(table1, 3)) == 3.0); + assert(zimags(zmeana(table1, 3)) == 3.0); + assert(zreals(zmeana(table2, 5)) == 9.186784563); + assert(zimags(zmeana(table2, 5)) == 9.186784563); + + return 0; +} + +static int testMean(void) { + + printf("\n>>>> Mean Tests\n"); + dmeansTest(); + dmeanaTest(); + zmeansTest(); + zmeanaTest(); + + return 0; +} + + + +int main(void) { + assert(testMean() == 0); + return 0; +} diff --git a/src/statisticsFunctions/mean/testFloatMean.c b/src/statisticsFunctions/mean/testFloatMean.c new file mode 100644 index 00000000..46c463fb --- /dev/null +++ b/src/statisticsFunctions/mean/testFloatMean.c @@ -0,0 +1,102 @@ +/* + * 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 <assert.h> +#include <stdio.h> +#include "mean.h" + +/* #define LOCAL_DEBUG */ + +static int smeansTest(void) { + float value1 = 3.0f; + float value2 = 1.123456789f; + + assert(smeans(value1) == 3.0f); + assert(smeans(value2) == 1.123456789f); + return 0; +} + +static int smeanaTest(void) { + float table1[3] = {3.0f, 3.0f, 3.0f}; + float table2[5] = {9.186784563f, + 9.186784563f, + 9.186784563f, + 9.186784563f, + 9.186784563f}; + + assert(smeana(table1, 3) == 3.0f); + assert(smeana(table2, 5) == 9.186784563f); + assert(smeana(table2, 5) - 9.186784f < 1e-6); + return 0; +} + +static int cmeansTest(void) { + floatComplex value1 = FloatComplex(3.0f, 3.0f); + floatComplex value2 = FloatComplex(1.123456789f, 1.123456789f); + + assert(creals(cmeans(value1)) == 3.0f); + assert(cimags(cmeans(value1)) == 3.0f); + assert(creals(cmeans(value2)) == 1.123456789f); + assert(cimags(cmeans(value2)) == 1.123456789f); + return 0; +} + +static int cmeanaTest(void) { + floatComplex value1 = FloatComplex(3.0f, 3.0f); + floatComplex table1[3]; + floatComplex value2 = FloatComplex(9.186784563f,9.186784563f); + floatComplex table2[5]; + + table1[0] = value1; + table1[1] = value1; + table1[2] = value1; + + table2[0] = value2; + table2[1] = value2; + table2[2] = value2; + table2[3] = value2; + table2[4] = value2; + +#ifdef LOCAL_DEBUG + printf("--------\n"); + printf("%e\n", cimags(cmeana(table1, 3))); + printf("%e\n", creals(cmeana(table2, 5))); + printf("%e\n", cimags(cmeana(table2, 5))); + printf("%e\n", creals(cmeana(table2, 5))); + printf("%e\n", cimags(cmeana(table2, 5))); + printf("--------\n"); +#endif + assert(creals(cmeana(table1, 3)) == 3.0f); + assert(cimags(cmeana(table1, 3)) == 3.0f); + assert(creals(cmeana(table2, 5)) == 9.186784563f); + assert(cimags(cmeana(table2, 5)) == 9.186784563f); + assert(creals(cmeana(table2, 5)) - 9.186784f < 1e-6); + assert(cimags(cmeana(table2, 5)) - 9.186784f < 1e-6); + + return 0; +} + +static int testMean(void) { + + printf("\n>>>> Mean Tests\n"); + smeansTest(); + smeanaTest(); + cmeansTest(); + cmeanaTest(); + + return 0; +} + +int main(void) { + assert(testMean() == 0); + return 0; +} diff --git a/src/statisticsFunctions/mean/zmeana.c b/src/statisticsFunctions/mean/zmeana.c new file mode 100644 index 00000000..aae80ffc --- /dev/null +++ b/src/statisticsFunctions/mean/zmeana.c @@ -0,0 +1,24 @@ +/* + * 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" + +doubleComplex zmeana(doubleComplex *in, int size) { + doubleComplex accumulate = DoubleComplex(0.0f, 0.0f); + int i = 0; + + for (i = 0; i < size; ++i) + { + accumulate = zadds(accumulate, in[i]); + } + return DoubleComplex(zreals(accumulate) / (double) size, zimags(accumulate) / (double) size); +} |