summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/statisticsFunctions/mean/Makefile.am11
-rw-r--r--src/statisticsFunctions/mean/Makefile.in86
-rw-r--r--src/statisticsFunctions/mean/ccolumnmeana.c24
-rw-r--r--src/statisticsFunctions/mean/crowmeana.c24
-rw-r--r--src/statisticsFunctions/mean/dcolumnmeana.c24
-rw-r--r--src/statisticsFunctions/mean/drowmeana.c24
-rw-r--r--src/statisticsFunctions/mean/scolumnmeana.c24
-rw-r--r--src/statisticsFunctions/mean/srowmeana.c24
-rw-r--r--src/statisticsFunctions/mean/testDoubleMean.c418
-rw-r--r--src/statisticsFunctions/mean/testFloatMean.c399
-rw-r--r--src/statisticsFunctions/mean/zcolumnmeana.c24
-rw-r--r--src/statisticsFunctions/mean/zrowmeana.c24
12 files changed, 1078 insertions, 28 deletions
diff --git a/src/statisticsFunctions/mean/Makefile.am b/src/statisticsFunctions/mean/Makefile.am
index 7fac26c5..695ababa 100644
--- a/src/statisticsFunctions/mean/Makefile.am
+++ b/src/statisticsFunctions/mean/Makefile.am
@@ -20,9 +20,17 @@ pkglib_LTLIBRARIES = libMean.la
libMean_la_SOURCES = $(HEAD) $(SRC)
SRC = smeana.c \
+ srowmeana.c \
+ scolumnmeana.c \
dmeana.c \
+ drowmeana.c \
+ dcolumnmeana.c \
cmeana.c \
- zmeana.c
+ crowmeana.c \
+ ccolumnmeana.c \
+ zmeana.c \
+ zrowmeana.c \
+ zcolumnmeana.c
HEAD = ../includes/mean.h
@@ -36,6 +44,7 @@ check_INCLUDES = -I $(top_builddir)/statisticsFunctions/includes \
check_LDADD = $(top_builddir)/type/libDoubleComplex.la \
$(top_builddir)/type/libFloatComplex.la \
$(top_builddir)/statisticsFunctions/mean/libMean.la \
+ $(top_builddir)/statisticsFunctions/sum/libSum.la \
@LIBMATH@
check_PROGRAMS = testFloatMean testDoubleMean
diff --git a/src/statisticsFunctions/mean/Makefile.in b/src/statisticsFunctions/mean/Makefile.in
index 00628302..19a30094 100644
--- a/src/statisticsFunctions/mean/Makefile.in
+++ b/src/statisticsFunctions/mean/Makefile.in
@@ -54,8 +54,12 @@ 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__objects_2 = libMean_la-smeana.lo libMean_la-srowmeana.lo \
+ libMean_la-scolumnmeana.lo libMean_la-dmeana.lo \
+ libMean_la-drowmeana.lo libMean_la-dcolumnmeana.lo \
+ libMean_la-cmeana.lo libMean_la-crowmeana.lo \
+ libMean_la-ccolumnmeana.lo libMean_la-zmeana.lo \
+ libMean_la-zrowmeana.lo libMean_la-zcolumnmeana.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) \
@@ -65,7 +69,8 @@ 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
+ $(top_builddir)/statisticsFunctions/mean/libMean.la \
+ $(top_builddir)/statisticsFunctions/sum/libSum.la
testDoubleMean_DEPENDENCIES = $(am__DEPENDENCIES_1)
testDoubleMean_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(testDoubleMean_CFLAGS) \
@@ -212,9 +217,17 @@ instdir = $(top_builddir)/lib
pkglib_LTLIBRARIES = libMean.la
libMean_la_SOURCES = $(HEAD) $(SRC)
SRC = smeana.c \
+ srowmeana.c \
+ scolumnmeana.c \
dmeana.c \
+ drowmeana.c \
+ dcolumnmeana.c \
cmeana.c \
- zmeana.c
+ crowmeana.c \
+ ccolumnmeana.c \
+ zmeana.c \
+ zrowmeana.c \
+ zcolumnmeana.c
HEAD = ../includes/mean.h
@@ -227,6 +240,7 @@ check_INCLUDES = -I $(top_builddir)/statisticsFunctions/includes \
check_LDADD = $(top_builddir)/type/libDoubleComplex.la \
$(top_builddir)/type/libFloatComplex.la \
$(top_builddir)/statisticsFunctions/mean/libMean.la \
+ $(top_builddir)/statisticsFunctions/sum/libSum.la \
@LIBMATH@
@@ -321,10 +335,18 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMean_la-ccolumnmeana.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMean_la-cmeana.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMean_la-crowmeana.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMean_la-dcolumnmeana.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-drowmeana.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMean_la-scolumnmeana.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-srowmeana.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMean_la-zcolumnmeana.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMean_la-zmeana.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMean_la-zrowmeana.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@
@@ -356,6 +378,20 @@ libMean_la-smeana.lo: smeana.c
@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-srowmeana.lo: srowmeana.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-srowmeana.lo -MD -MP -MF $(DEPDIR)/libMean_la-srowmeana.Tpo -c -o libMean_la-srowmeana.lo `test -f 'srowmeana.c' || echo '$(srcdir)/'`srowmeana.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libMean_la-srowmeana.Tpo $(DEPDIR)/libMean_la-srowmeana.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='srowmeana.c' object='libMean_la-srowmeana.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-srowmeana.lo `test -f 'srowmeana.c' || echo '$(srcdir)/'`srowmeana.c
+
+libMean_la-scolumnmeana.lo: scolumnmeana.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-scolumnmeana.lo -MD -MP -MF $(DEPDIR)/libMean_la-scolumnmeana.Tpo -c -o libMean_la-scolumnmeana.lo `test -f 'scolumnmeana.c' || echo '$(srcdir)/'`scolumnmeana.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libMean_la-scolumnmeana.Tpo $(DEPDIR)/libMean_la-scolumnmeana.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='scolumnmeana.c' object='libMean_la-scolumnmeana.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-scolumnmeana.lo `test -f 'scolumnmeana.c' || echo '$(srcdir)/'`scolumnmeana.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
@@ -363,6 +399,20 @@ libMean_la-dmeana.lo: dmeana.c
@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-drowmeana.lo: drowmeana.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-drowmeana.lo -MD -MP -MF $(DEPDIR)/libMean_la-drowmeana.Tpo -c -o libMean_la-drowmeana.lo `test -f 'drowmeana.c' || echo '$(srcdir)/'`drowmeana.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libMean_la-drowmeana.Tpo $(DEPDIR)/libMean_la-drowmeana.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drowmeana.c' object='libMean_la-drowmeana.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-drowmeana.lo `test -f 'drowmeana.c' || echo '$(srcdir)/'`drowmeana.c
+
+libMean_la-dcolumnmeana.lo: dcolumnmeana.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-dcolumnmeana.lo -MD -MP -MF $(DEPDIR)/libMean_la-dcolumnmeana.Tpo -c -o libMean_la-dcolumnmeana.lo `test -f 'dcolumnmeana.c' || echo '$(srcdir)/'`dcolumnmeana.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libMean_la-dcolumnmeana.Tpo $(DEPDIR)/libMean_la-dcolumnmeana.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dcolumnmeana.c' object='libMean_la-dcolumnmeana.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-dcolumnmeana.lo `test -f 'dcolumnmeana.c' || echo '$(srcdir)/'`dcolumnmeana.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
@@ -370,6 +420,20 @@ libMean_la-cmeana.lo: cmeana.c
@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-crowmeana.lo: crowmeana.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-crowmeana.lo -MD -MP -MF $(DEPDIR)/libMean_la-crowmeana.Tpo -c -o libMean_la-crowmeana.lo `test -f 'crowmeana.c' || echo '$(srcdir)/'`crowmeana.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libMean_la-crowmeana.Tpo $(DEPDIR)/libMean_la-crowmeana.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='crowmeana.c' object='libMean_la-crowmeana.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-crowmeana.lo `test -f 'crowmeana.c' || echo '$(srcdir)/'`crowmeana.c
+
+libMean_la-ccolumnmeana.lo: ccolumnmeana.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-ccolumnmeana.lo -MD -MP -MF $(DEPDIR)/libMean_la-ccolumnmeana.Tpo -c -o libMean_la-ccolumnmeana.lo `test -f 'ccolumnmeana.c' || echo '$(srcdir)/'`ccolumnmeana.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libMean_la-ccolumnmeana.Tpo $(DEPDIR)/libMean_la-ccolumnmeana.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ccolumnmeana.c' object='libMean_la-ccolumnmeana.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-ccolumnmeana.lo `test -f 'ccolumnmeana.c' || echo '$(srcdir)/'`ccolumnmeana.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
@@ -377,6 +441,20 @@ libMean_la-zmeana.lo: zmeana.c
@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
+libMean_la-zrowmeana.lo: zrowmeana.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-zrowmeana.lo -MD -MP -MF $(DEPDIR)/libMean_la-zrowmeana.Tpo -c -o libMean_la-zrowmeana.lo `test -f 'zrowmeana.c' || echo '$(srcdir)/'`zrowmeana.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libMean_la-zrowmeana.Tpo $(DEPDIR)/libMean_la-zrowmeana.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zrowmeana.c' object='libMean_la-zrowmeana.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-zrowmeana.lo `test -f 'zrowmeana.c' || echo '$(srcdir)/'`zrowmeana.c
+
+libMean_la-zcolumnmeana.lo: zcolumnmeana.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-zcolumnmeana.lo -MD -MP -MF $(DEPDIR)/libMean_la-zcolumnmeana.Tpo -c -o libMean_la-zcolumnmeana.lo `test -f 'zcolumnmeana.c' || echo '$(srcdir)/'`zcolumnmeana.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libMean_la-zcolumnmeana.Tpo $(DEPDIR)/libMean_la-zcolumnmeana.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zcolumnmeana.c' object='libMean_la-zcolumnmeana.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-zcolumnmeana.lo `test -f 'zcolumnmeana.c' || echo '$(srcdir)/'`zcolumnmeana.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
diff --git a/src/statisticsFunctions/mean/ccolumnmeana.c b/src/statisticsFunctions/mean/ccolumnmeana.c
new file mode 100644
index 00000000..888150c2
--- /dev/null
+++ b/src/statisticsFunctions/mean/ccolumnmeana.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"
+#include "sum.h"
+
+void ccolumnmeana(floatComplex *in, int lines, int columns, floatComplex *out) {
+ int i = 0;
+
+ ccolumnsuma(in, lines, columns, out);
+ for (i = 0; i < lines; ++i)
+ {
+ out[i] = cdevides(out[i] , FloatComplex((float) columns, 0.0f));
+ }
+}
diff --git a/src/statisticsFunctions/mean/crowmeana.c b/src/statisticsFunctions/mean/crowmeana.c
new file mode 100644
index 00000000..05f3f523
--- /dev/null
+++ b/src/statisticsFunctions/mean/crowmeana.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"
+#include "sum.h"
+
+void crowmeana(floatComplex *in, int lines, int columns, floatComplex *out) {
+ int i = 0;
+
+ crowsuma(in, lines, columns, out);
+ for (i = 0; i < columns; ++i)
+ {
+ out[i] = cdevides(out[i], FloatComplex((float)lines, 0.0f));
+ }
+}
diff --git a/src/statisticsFunctions/mean/dcolumnmeana.c b/src/statisticsFunctions/mean/dcolumnmeana.c
new file mode 100644
index 00000000..90d7863b
--- /dev/null
+++ b/src/statisticsFunctions/mean/dcolumnmeana.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"
+#include "sum.h"
+
+void dcolumnmeana(double *in, int lines, int columns, double *out) {
+ int i = 0;
+
+ dcolumnsuma(in, lines, columns, out);
+ for (i = 0; i < lines; ++i)
+ {
+ out[i] /= (double) columns;
+ }
+}
diff --git a/src/statisticsFunctions/mean/drowmeana.c b/src/statisticsFunctions/mean/drowmeana.c
new file mode 100644
index 00000000..aec1b31a
--- /dev/null
+++ b/src/statisticsFunctions/mean/drowmeana.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"
+#include "sum.h"
+
+void drowmeana(double *in, int lines, int columns, double *out) {
+ int i = 0;
+
+ drowsuma(in, lines, columns, out);
+ for (i = 0; i < columns; ++i)
+ {
+ out[i] /= (double) lines;
+ }
+}
diff --git a/src/statisticsFunctions/mean/scolumnmeana.c b/src/statisticsFunctions/mean/scolumnmeana.c
new file mode 100644
index 00000000..59985d5e
--- /dev/null
+++ b/src/statisticsFunctions/mean/scolumnmeana.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"
+#include "sum.h"
+
+void scolumnmeana(float *in, int lines, int columns, float *out) {
+ int i = 0;
+
+ scolumnsuma(in, lines, columns, out);
+ for (i = 0; i < lines; ++i)
+ {
+ out[i] /= (float) columns;
+ }
+}
diff --git a/src/statisticsFunctions/mean/srowmeana.c b/src/statisticsFunctions/mean/srowmeana.c
new file mode 100644
index 00000000..3fb799f0
--- /dev/null
+++ b/src/statisticsFunctions/mean/srowmeana.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"
+#include "sum.h"
+
+void srowmeana(float *in, int lines, int columns, float *out) {
+ int i = 0;
+
+ srowsuma(in, lines, columns, out);
+ for (i = 0; i < columns; ++i)
+ {
+ out[i] /= (float) lines;
+ }
+}
diff --git a/src/statisticsFunctions/mean/testDoubleMean.c b/src/statisticsFunctions/mean/testDoubleMean.c
index 2f970aef..cbb5ce1a 100644
--- a/src/statisticsFunctions/mean/testDoubleMean.c
+++ b/src/statisticsFunctions/mean/testDoubleMean.c
@@ -12,16 +12,21 @@
#include <assert.h>
#include <stdio.h>
+#include <math.h>
#include "mean.h"
/* #define LOCAL_DEBUG */
+#define ERROR(x) printf("diff = %e\n", x)
+
static int dmeansTest(void) {
- double value1 = 3.0f;
- double value2 = 1.123456789f;
+ double value1 = 3.0;
+ double value2 = 1.123456789;
+
+ printf("\n>>>> Mean Double Scalar Test\n");
+ assert(dmeans(value1) == 3.0);
+ assert(dmeans(value2) == 1.123456789);
- assert(dmeans(value1) == 3.0f);
- assert(dmeans(value2) == 1.123456789f);
return 0;
}
@@ -33,8 +38,162 @@ static int dmeanaTest(void) {
9.186784563,
9.186784563};
- assert(dmeana(table1, 3) == 3.0);
- assert(dmeana(table2, 5) == 9.186784563);
+ printf("\n>>>> Mean Double Array Test\n");
+ assert(dmeana(table1, 3) == 9.0 / 3.0);
+ assert((dmeana(table2, 5) == (9.186784563 + 9.186784563 + 9.186784563 + 9.186784563 + 9.186784563) / 5.0));
+ return 0;
+}
+
+static int dcolumnmeanaTest(void) {
+ int i = 0;
+ double table1[9] = {1.0, 4.0, 7.0, 2.0 , 5.0, 8.0, 3.0, 6.0, 9.0};
+ double table2[10] = {1.0, 2.0, 3.0, 4.0 , 5.0, 6.0, 7.0, 8.0, 9.0, 10.0};
+ double columnMeanmedTable1_3_3[3] = {0};
+ double columnMeanmedTable1_1_9[1] = {0};
+ double columnMeanmedTable1_9_1[9] = {0};
+ double columnMeanmedTable2_2_5[2] = {0};
+ double columnMeanmedTable2_5_2[5] = {0};
+
+ printf("\n>>>> Column Mean Double Array Test\n");
+ /*
+ [ 1 2 3 ]
+ [ 4 5 6 ] => [ 6 15 24 ]
+ [ 7 8 9 ]
+ */
+ dcolumnmeana(table1, 3, 3,columnMeanmedTable1_3_3);
+ assert(columnMeanmedTable1_3_3[0] == 6.0 / 3.0);
+ assert(columnMeanmedTable1_3_3[1] == 15.0 / 3.0);
+ assert(columnMeanmedTable1_3_3[2] == 24.0 / 3.0);
+
+ /*
+ [ 1 2 3 4 5 6 7 8 9 ] => [ 45 ]
+ */
+ dcolumnmeana(table1, 1, 9,columnMeanmedTable1_1_9);
+ assert(columnMeanmedTable1_1_9[0] == 45.0 / 9.0);
+
+ /*
+ [ 1 ]
+ [ 2 ]
+ [ 3 ]
+ [ 4 ]
+ [ 5 ] => [ 1 2 3 4 5 6 7 8 9 ]
+ [ 6 ]
+ [ 7 ]
+ [ 8 ]
+ [ 9 ]
+ */
+ dcolumnmeana(table1, 9, 1,columnMeanmedTable1_9_1);
+ for ( i = 0 ; i < 9 ; ++i) {
+ printf("columnMeanmedTable1_9_1[%d] = %e\n", i, columnMeanmedTable1_9_1[i]);
+ assert(columnMeanmedTable1_9_1[i] == table1[i]);
+ }
+
+ /*
+ [ 1 3 5 7 9 ]
+ [ 2 4 6 8 10 ] => [ 25 30 ]
+ */
+ dcolumnmeana(table2, 2, 5,columnMeanmedTable2_2_5);
+ assert(columnMeanmedTable2_2_5[0] == 25.0 / 5.0);
+ assert(columnMeanmedTable2_2_5[1] == 30.0 / 5.0);
+ for ( i = 0 ; i < 2 ; ++i) {
+ printf("columnMeanmedTable2_2_5[%d] = %e\n", i, columnMeanmedTable2_2_5[i]);
+ }
+
+ /*
+ [ 1 6 ]
+ [ 2 7 ] => [ 7 9 11 13 15 ]
+ [ 3 8 ]
+ [ 4 9 ]
+ [ 5 10 ]
+ */
+ dcolumnmeana(table2, 5, 2,columnMeanmedTable2_5_2);
+ assert(columnMeanmedTable2_5_2[0] == 7.0 / 2.0);
+ assert(columnMeanmedTable2_5_2[1] == 9.0 / 2.0);
+ assert(columnMeanmedTable2_5_2[2] == 11.0 / 2.0);
+ assert(columnMeanmedTable2_5_2[3] == 13.0 / 2.0);
+ assert(columnMeanmedTable2_5_2[4] == 15.0 / 2.0);
+ for ( i = 0 ; i < 5 ; ++i) {
+ printf("columnMeanmedTable2_5_2[%d] = %e\n", i, columnMeanmedTable2_5_2[i]);
+ }
+
+ return 0;
+}
+
+static int drowmeanaTest(void) {
+ int i = 0;
+ double table1[9] = {1.0, 4.0, 7.0, 2.0 , 5.0, 8.0, 3.0, 6.0, 9.0};
+ double table2[10] = {1.0, 2.0, 3.0, 4.0 , 5.0, 6.0, 7.0, 8.0, 9.0, 10.0};
+ double rowMeanmedTable1_3_3[3] = {0};
+ double rowMeanmedTable1_1_9[9] = {0};
+ double rowMeanmedTable1_9_1[1] = {0};
+ double rowMeanmedTable2_2_5[5] = {0};
+ double rowMeanmedTable2_5_2[2] = {0};
+
+ printf("\n>>>> Row Mean Double Array Test\n");
+ /*
+ [ 1 2 3 ]
+ [ 4 5 6 ] => [ 12 15 18 ]
+ [ 7 8 9 ]
+ */
+ drowmeana(table1, 3, 3,rowMeanmedTable1_3_3);
+ for ( i = 0 ; i < 3 ; ++i) {
+ printf("rowMeanmedTable1_3_3[%d] = %e\n", i, rowMeanmedTable1_3_3[i]);
+ }
+ assert(rowMeanmedTable1_3_3[0] == 12.0 / 3.0);
+ assert(rowMeanmedTable1_3_3[1] == 15.0 / 3.0);
+ assert(rowMeanmedTable1_3_3[2] == 18.0 / 3.0);
+
+ /*
+ [ 1 ]
+ [ 2 ]
+ [ 3 ]
+ [ 4 ]
+ [ 5 ] => [ 1 2 3 4 5 6 7 8 9 ]
+ [ 6 ]
+ [ 7 ]
+ [ 8 ]
+ [ 9 ]
+ */
+ drowmeana(table1, 1, 9,rowMeanmedTable1_1_9);
+ for ( i = 0 ; i < 9 ; ++i) {
+ printf("rowMeanmedTable1_1_9[%d] = %e\n", i, rowMeanmedTable1_1_9[i]);
+ assert(rowMeanmedTable1_1_9[i] == table1[i]);
+ }
+
+ /*
+ [ 1 2 3 4 5 6 7 8 9 ] => [ 45 ]
+ */
+ drowmeana(table1, 9, 1,rowMeanmedTable1_9_1);
+ assert(rowMeanmedTable1_9_1[0] == 45.0 / 9.0);
+
+ /*
+ [ 1 3 5 7 9 ]
+ [ 2 4 6 8 10 ] => [ 3 7 11 15 19 ]
+ */
+ drowmeana(table2, 2, 5,rowMeanmedTable2_2_5);
+ for ( i = 0 ; i < 5 ; ++i) {
+ printf("rowMeanmedTable2_2_5[%d] = %e\n", i, rowMeanmedTable2_2_5[i]);
+ }
+ assert(rowMeanmedTable2_2_5[0] == 3.0 / 2.0);
+ assert(rowMeanmedTable2_2_5[1] == 7.0 / 2.0);
+ assert(rowMeanmedTable2_2_5[2] == 11.0 / 2.0);
+ assert(rowMeanmedTable2_2_5[3] == 15.0 / 2.0);
+ assert(rowMeanmedTable2_2_5[4] == 19.0 / 2.0);
+
+ /*
+ [ 1 6 ]
+ [ 2 7 ] => [ 15 40 ]
+ [ 3 8 ]
+ [ 4 9 ]
+ [ 5 10 ]
+ */
+ drowmeana(table2, 5, 2,rowMeanmedTable2_5_2);
+ assert(rowMeanmedTable2_5_2[0] == 15.0 / 5.0);
+ assert(rowMeanmedTable2_5_2[1] == 40.0 / 5.0);
+ for ( i = 0 ; i < 2 ; ++i) {
+ printf("rowMeanmedTable2_5_2[%d] = %e\n", i, rowMeanmedTable2_5_2[i]);
+ }
+
return 0;
}
@@ -42,6 +201,7 @@ static int zmeansTest(void) {
doubleComplex value1 = DoubleComplex(3.0, 3.0);
doubleComplex value2 = DoubleComplex(1.123456789, 1.123456789);
+ printf("\n>>>> Mean Double Complex Scalar Test\n");
assert(zreals(zmeans(value1)) == 3.0);
assert(zimags(zmeans(value1)) == 3.0);
assert(zreals(zmeans(value2)) == 1.123456789);
@@ -55,6 +215,7 @@ static int zmeanaTest(void) {
doubleComplex value2 = DoubleComplex(9.186784563,9.186784563);
doubleComplex table2[5];
+ printf("\n>>>> Mean Double Complex Array Test\n");
table1[0] = value1;
table1[1] = value1;
table1[2] = value1;
@@ -74,27 +235,258 @@ static int zmeanaTest(void) {
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);
+ assert(zreals(zmeana(table1, 3)) == 9.0 / 3.0);
+ assert(zimags(zmeana(table1, 3)) == 9.0 / 3.0);
+ assert(zreals(zmeana(table2, 5)) == (9.186784563 + 9.186784563 + 9.186784563 + 9.186784563 + 9.186784563) / 5.0);
+ assert(zimags(zmeana(table2, 5)) == (9.186784563 + 9.186784563 + 9.186784563 + 9.186784563 + 9.186784563) / 5.0);
+
+ return 0;
+}
+
+static int zrowmeanaTest(void) {
+ int i = 0;
+ doubleComplex in[12];
+ doubleComplex rowMeanmedIn_4_3[3];
+ doubleComplex rowMeanmedIn_3_4[4];
+ doubleComplex rowMeanmedIn_6_2[2];
+ doubleComplex rowMeanmedIn_2_6[6];
+ doubleComplex rowMeanmedIn_1_12[12];
+ doubleComplex rowMeanmedIn_12_1[1];
+
+ printf("\n>>>> Row Mean Double Complex Array Test\n");
+ /* Init input var */
+ for (i = 0 ; i < 12 ; ++i)
+ {
+ in[i] = DoubleComplex((double) i / 10.0, (11.0 - (double) i) / 10.0);
+ }
+
+ /*
+ [ 1.1i 0.4+0.7i 0.8+0.3i ]
+ [ 0.1+i 0.5+0.6i 0.9+0.2i ] => [ 0.6+3.8i 2.2+2.2i 3.8+0.6i ]
+ [ 0.2+0.9i 0.6+0.5i 1+0.1i ]
+ [ 0.3+0.8i 0.7+0.4i 1.1 ]
+ */
+ zrowmeana(in, 4, 3, rowMeanmedIn_4_3);
+ for (i = 0 ; i < 3 ; ++i) {
+ printf("rowMeanmedIn_4_3[%d] = %e + %ei\n", i, zreals(rowMeanmedIn_4_3[i]), zimags(rowMeanmedIn_4_3[i]));
+ }
+ assert(fabs(zreals(rowMeanmedIn_4_3[0]) - 0.6 / 4.0) < 1e-16);
+ assert(zimags(rowMeanmedIn_4_3[0]) == 3.8 / 4.0);
+ assert(zreals(rowMeanmedIn_4_3[1]) == 2.2 / 4.0);
+ assert(fabs(zimags(rowMeanmedIn_4_3[1]) - 2.2 / 4.0) < 1e-15);
+ assert(fabs(zreals(rowMeanmedIn_4_3[2]) - 3.8 / 4.0) < 1e-15);
+ assert(zimags(rowMeanmedIn_4_3[2]) == 0.6 / 4.0);
+
+ /*
+ [ 1.1i 0.3+0.8i 0.6+0.5i 0.9+0.2i ]
+ [ 0.1+i 0.4+0.7i 0.7+0.4i 1+0.1i ] => [ 0.3+3.i 1.2+2.1i 2.1+1.2i 3.+0.3i]
+ [ 0.2+0.9i 0.5+0.6i 0.8+0.3i 1.1 ]
+ */
+ zrowmeana(in, 3, 4, rowMeanmedIn_3_4);
+ for (i = 0 ; i < 4 ; ++i) {
+ printf("rowMeanmedIn_3_4[%d] = %e + %ei\n", i, zreals(rowMeanmedIn_3_4[i]), zimags(rowMeanmedIn_3_4[i]));
+ }
+ assert(fabs(zreals(rowMeanmedIn_3_4[0]) - 0.3 / 3.0) < 1e-16);
+ assert(zimags(rowMeanmedIn_3_4[0]) == 3.0 / 3.0);
+ assert(zreals(rowMeanmedIn_3_4[1]) == 1.2 / 3.0 && zimags(rowMeanmedIn_3_4[1]) == 2.1 / 3.0);
+ assert(fabs(zreals(rowMeanmedIn_3_4[2]) - 2.1 / 3.0) < 1e-15);
+ assert(zimags(rowMeanmedIn_3_4[2]) == 1.2 / 3.0);
+ assert(zreals(rowMeanmedIn_3_4[3]) == 3.0 / 3.0);
+ assert(fabs(zimags(rowMeanmedIn_3_4[3]) - 0.3 / 3.0) < 1e-16);
+
+ /*
+ [ 1.1i 0.6+0.5i ]
+ [ 0.1+i 0.7+0.4i ]
+ [ 0.2+0.9i 0.8+0.3i ] => [ 1.5+5.1i 5.1+1.5i ]
+ [ 0.3+0.8i 0.9+0.2i ]
+ [ 0.4+0.7i 1+0.1i ]
+ [ 0.5+0.6i 1.1 ]
+ */
+ zrowmeana(in, 6, 2, rowMeanmedIn_6_2);
+ for (i = 0 ; i < 2 ; ++i) {
+ printf("rowMeanmedIn_6_2[%d] = %e + %ei\n", i, zreals(rowMeanmedIn_6_2[i]), zimags(rowMeanmedIn_6_2[i]));
+ }
+ assert(zreals(rowMeanmedIn_6_2[0]) == 1.5 / 6.0 && zimags(rowMeanmedIn_6_2[0]) == 5.1 / 6.0);
+ assert(zreals(rowMeanmedIn_6_2[1]) == 5.1 / 6.0 && zimags(rowMeanmedIn_6_2[1]) == 1.5 / 6.0);
+
+ /*
+ [ 1.1i 0.2+0.9i 0.4+0.7i 0.6+0.5i 0.8+0.3i 1+0.1i ]
+ [ 0.1+i 0.3+0.8i 0.5+0.6i 0.7+0.4i 0.9+0.2i 1.1 ] => [ 0.1+2.1i 0.5+1.7i 0.9+1.3i 1.3+0.9i 1.7+0.5i 2.1+0.1i ]
+ */
+ zrowmeana(in, 2, 6, rowMeanmedIn_2_6);
+ for (i = 0 ; i < 6 ; ++i) {
+ printf("rowMeanmedIn_2_6[%d] = %e + %ei\n", i, zreals(rowMeanmedIn_2_6[i]), zimags(rowMeanmedIn_2_6[i]));
+ }
+ assert(zreals(rowMeanmedIn_2_6[0]) == 0.1 / 2.0 && zimags(rowMeanmedIn_2_6[0]) == 2.1 / 2.0);
+ assert(zreals(rowMeanmedIn_2_6[1]) == 0.5 / 2.0);
+ assert(fabs(zimags(rowMeanmedIn_2_6[1]) == 1.7 / 2.0) < 1e-16);
+ assert(zreals(rowMeanmedIn_2_6[2]) == 0.9 / 2.0);
+ assert(fabs(zimags(rowMeanmedIn_2_6[2]) == 1.3 / 2.0) < 1e-16);
+ assert(fabs(zreals(rowMeanmedIn_2_6[3]) == 1.3 / 2.0) < 1e-16);
+ assert(zimags(rowMeanmedIn_2_6[3]) == 0.9 / 2.0);
+ assert(fabs(zreals(rowMeanmedIn_2_6[4]) == 1.7 / 2.0) < 1e-16);
+ assert(zimags(rowMeanmedIn_2_6[4]) == 0.5 / 2.0);
+ assert(zreals(rowMeanmedIn_2_6[5]) == 2.1 / 2.0 && zimags(rowMeanmedIn_2_6[5]) == 0.1 / 2.0);
+
+ /*
+ [ 1.1i 0.1+i 0.2+0.9i 0.3+0.8i 0.4+0.7i 0.5+0.6i 0.6+0.5i 0.7+0.4i 0.8+0.3i 0.9+0.2i 1+0.1i 1.1 ]
+ =>
+ [ 1.1i 0.1+i 0.2+0.9i 0.3+0.8i 0.4+0.7i 0.5+0.6i 0.6+0.5i 0.7+0.4i 0.8+0.3i 0.9+0.2i 1+0.1i 1.1 ]
+ */
+ zrowmeana(in, 1, 12, rowMeanmedIn_1_12);
+ for (i = 0 ; i < 12 ; ++i) {
+ printf("rowMeanmedIn_1_12[%d] = %e + %ei\n", i, zreals(rowMeanmedIn_1_12[i]), zimags(rowMeanmedIn_1_12[i]));
+ assert(zreals(rowMeanmedIn_1_12[i]) == zreals(in[i]) && zimags(rowMeanmedIn_1_12[i]) == zimags(in[i]));
+ }
+
+ /*
+ [ 1.1i ]
+ [ 0.1+i ]
+ [ 0.2+0.9i ]
+ [ 0.3+0.8i ]
+ [ 0.4+0.7i ]
+ [ 0.5+0.6i ]
+ [ 0.6+0.5i ] => [ 6.6+6.6i ]
+ [ 0.7+0.4i ]
+ [ 0.8+0.3i ]
+ [ 0.9+0.2i ]
+ [ 1+0.1i ]
+ [ 1.1 ]
+ */
+ zrowmeana(in, 12, 1, rowMeanmedIn_12_1);
+ printf("rowMeanmedIn_12_1[%d] = %e + %ei\n", 0, zreals(rowMeanmedIn_12_1[0]), zimags(rowMeanmedIn_12_1[0]));
+ assert(zreals(rowMeanmedIn_12_1[0]) == 6.6 / 12.0 && zimags(rowMeanmedIn_12_1[0]) == 6.6 / 12.0);
+
+ return 0;
+}
+
+static int zcolumnmeanaTest(void) {
+ int i = 0;
+ doubleComplex in[12];
+ doubleComplex columnMeanmedIn_4_3[4];
+ doubleComplex columnMeanmedIn_3_4[3];
+ doubleComplex columnMeanmedIn_6_2[6];
+ doubleComplex columnMeanmedIn_2_6[2];
+ doubleComplex columnMeanmedIn_1_12[1];
+ doubleComplex columnMeanmedIn_12_1[12];
+
+ printf("\n>>>> ColumnMean Double Complex Array Test\n");
+ /* Init input var */
+ for (i = 0 ; i < 12 ; ++i)
+ {
+ in[i] = DoubleComplex((double) i / 10.0, (11.0 - (double) i) / 10.0);
+ }
+
+ /*
+ [ 1.1i 0.4+0.7i 0.8+0.3i ]
+ [ 0.1+i 0.5+0.6i 0.9+0.2i ] => [ 1.2+2.1i 1.5+1.8i 1.8+1.5i 2.1+1.2i ]
+ [ 0.2+0.9i 0.6+0.5i 1+0.1i ]
+ [ 0.3+0.8i 0.7+0.4i 1.1 ]
+ */
+ zcolumnmeana(in, 4, 3, columnMeanmedIn_4_3);
+ for (i = 0 ; i < 4 ; ++i) {
+ printf("columnMeanmedIn_4_3[%d] = %e + %ei\n", i, zreals(columnMeanmedIn_4_3[i]), zimags(columnMeanmedIn_4_3[i]));
+ }
+ assert(fabs(zreals(columnMeanmedIn_4_3[0]) - 1.2 / 3.0) < 1e-15);
+ assert(zimags(columnMeanmedIn_4_3[0]) == 2.1 / 3.0);
+ assert(zreals(columnMeanmedIn_4_3[1]) == 1.5 / 3.0 && zimags(columnMeanmedIn_4_3[1]) == 1.8 / 3.0);
+ assert(zreals(columnMeanmedIn_4_3[2]) == 1.8 / 3.0&& zimags(columnMeanmedIn_4_3[2]) == 1.5 / 3.0);
+ assert(zreals(columnMeanmedIn_4_3[3]) == 2.1 / 3.0);
+ assert(fabs(zimags(columnMeanmedIn_4_3[3]) - 1.2 / 3.0) < 1e-15);
+
+ /*
+ [ 1.1i 0.3+0.8i 0.6+0.5i 0.9+0.2i ]
+ [ 0.1+i 0.4+0.7i 0.7+0.4i 1+0.1i ] => [ 1.8+2.6i 2.2+2.2i 2.6+1.8i ]
+ [ 0.2+0.9i 0.5+0.6i 0.8+0.3i 1.1 ]
+ */
+ zcolumnmeana(in, 3, 4, columnMeanmedIn_3_4);
+ for (i = 0 ; i < 3 ; ++i) {
+ printf("columnMeanmedIn_3_4[%d] = %e + %ei\n", i, zreals(columnMeanmedIn_3_4[i]), zimags(columnMeanmedIn_3_4[i]));
+ }
+ assert(fabs(zreals(columnMeanmedIn_3_4[0]) - 1.8 / 4.0) < 1e-15);
+ assert(fabs(zimags(columnMeanmedIn_3_4[0]) - 2.6 / 4.0) < 1e-15);
+ assert(zreals(columnMeanmedIn_3_4[1]) == 2.2 / 4.0 && zimags(columnMeanmedIn_3_4[1]) == 2.2 / 4.0);
+ assert(zreals(columnMeanmedIn_3_4[2]) == 2.6 / 4.0 && zimags(columnMeanmedIn_3_4[2]) == 1.8 / 4.0);
+
+ /*
+ [ 1.1i 0.6+0.5i ]
+ [ 0.1+i 0.7+0.4i ]
+ [ 0.2+0.9i 0.8+0.3i ] => [ 0.6+1.6i 0.8+1.4i 1+1.2i 1.2+i 1.4+0.8i 1.6+0.6i ]
+ [ 0.3+0.8i 0.9+0.2i ]
+ [ 0.4+0.7i 1+0.1i ]
+ [ 0.5+0.6i 1.1 ]
+ */
+ zcolumnmeana(in, 6, 2, columnMeanmedIn_6_2);
+ for (i = 0 ; i < 6 ; ++i) {
+ printf("columnMeanmedIn_6_2[%d] = %e + %ei\n", i, zreals(columnMeanmedIn_6_2[i]), zimags(columnMeanmedIn_6_2[i]));
+ }
+ assert(zreals(columnMeanmedIn_6_2[0]) == 0.6 / 2.0 && zimags(columnMeanmedIn_6_2[0]) == 1.6 / 2.0);
+ assert(fabs(zreals(columnMeanmedIn_6_2[1]) - 0.8 / 2.0) < 1e-15);
+ assert(zimags(columnMeanmedIn_6_2[1]) == 1.4 / 2.0);
+ assert(zreals(columnMeanmedIn_6_2[2]) == 1.0 / 2.0 && zimags(columnMeanmedIn_6_2[2]) == 1.2 / 2.0);
+ assert(zreals(columnMeanmedIn_6_2[3]) == 1.2 / 2.0 && zimags(columnMeanmedIn_6_2[3]) == 1.0 / 2.0);
+ assert(zreals(columnMeanmedIn_6_2[4]) == 1.4 / 2.0);
+ assert(fabs(zimags(columnMeanmedIn_6_2[4]) - 0.8 / 2.0) < 1e-15);
+ assert(zreals(columnMeanmedIn_6_2[5]) == 1.6 / 2.0 && zimags(columnMeanmedIn_6_2[5]) == 0.6 / 2.0);
+
+ /*
+ [ 1.1i 0.2+0.9i 0.4+0.7i 0.6+0.5i 0.8+0.3i 1+0.1i ]
+ [ 0.1+i 0.3+0.8i 0.5+0.6i 0.7+0.4i 0.9+0.2i 1.1 ] => [ 3+3.6i 3.6+3i ]
+ */
+ zcolumnmeana(in, 2, 6, columnMeanmedIn_2_6);
+ for (i = 0 ; i < 2 ; ++i) {
+ printf("columnMeanmedIn_2_6[%d] = %e + %ei\n", i, zreals(columnMeanmedIn_2_6[i]), zimags(columnMeanmedIn_2_6[i]));
+ }
+ assert(zreals(columnMeanmedIn_2_6[0]) == 3.0 / 6.0 && zimags(columnMeanmedIn_2_6[0]) == 3.6 / 6.0);
+ assert(zreals(columnMeanmedIn_2_6[1]) == 3.6 / 6.0 && zimags(columnMeanmedIn_2_6[1]) == 3.0 / 6.0);
+
+ /*
+ [ 1.1i 0.1+i 0.2+0.9i 0.3+0.8i 0.4+0.7i 0.5+0.6i 0.6+0.5i 0.7+0.4i 0.8+0.3i 0.9+0.2i 1+0.1i 1.1 ]
+ =>
+ [ 6.6+6.6i ]
+ */
+ zcolumnmeana(in, 1, 12, columnMeanmedIn_1_12);
+ printf("columnMeanmedIn_1_12[%d] = %e + %ei\n", 0, zreals(columnMeanmedIn_1_12[0]), zimags(columnMeanmedIn_1_12[0]));
+ assert(zreals(columnMeanmedIn_1_12[0]) == 6.6 / 12.0 && zimags(columnMeanmedIn_1_12[0]) == 6.6 / 12.0);
+
+
+ /*
+ [ 1.1i ]
+ [ 0.1+i ]
+ [ 0.2+0.9i ]
+ [ 0.3+0.8i ]
+ [ 0.4+0.7i ]
+ [ 0.5+0.6i ]
+ [ 0.6+0.5i ] => [ 1.1i 0.1+i 0.2+0.9i 0.3+0.8i 0.4+0.7i 0.5+0.6i 0.6+0.5i 0.7+0.4i 0.8+0.3i 0.9+0.2i 1+0.1i 1.1 ]
+ [ 0.7+0.4i ]
+ [ 0.8+0.3i ]
+ [ 0.9+0.2i ]
+ [ 1+0.1i ]
+ [ 1.1 ]
+ */
+ zcolumnmeana(in, 12, 1, columnMeanmedIn_12_1);
+ for (i = 0 ; i < 12 ; ++i) {
+ printf("columnMeanmedIn_12_1[%d] = %e + %ei\n", i, zreals(columnMeanmedIn_12_1[i]), zimags(columnMeanmedIn_12_1[i]));
+ assert(zreals(columnMeanmedIn_12_1[i]) == zreals(in[i]) && zimags(columnMeanmedIn_12_1[i]) == zimags(in[i]));
+ }
return 0;
}
static int testMean(void) {
- printf("\n>>>> Mean Tests\n");
dmeansTest();
dmeanaTest();
+ drowmeanaTest();
+ dcolumnmeanaTest();
zmeansTest();
zmeanaTest();
+ zrowmeanaTest();
+ zcolumnmeanaTest();
return 0;
}
-
-
int main(void) {
assert(testMean() == 0);
return 0;
diff --git a/src/statisticsFunctions/mean/testFloatMean.c b/src/statisticsFunctions/mean/testFloatMean.c
index 46c463fb..e5c6d9d8 100644
--- a/src/statisticsFunctions/mean/testFloatMean.c
+++ b/src/statisticsFunctions/mean/testFloatMean.c
@@ -12,6 +12,7 @@
#include <assert.h>
#include <stdio.h>
+#include <math.h>
#include "mean.h"
/* #define LOCAL_DEBUG */
@@ -20,8 +21,10 @@ static int smeansTest(void) {
float value1 = 3.0f;
float value2 = 1.123456789f;
+ printf("\n>>>> Mean Float Scalar Test\n");
assert(smeans(value1) == 3.0f);
assert(smeans(value2) == 1.123456789f);
+
return 0;
}
@@ -33,9 +36,162 @@ static int smeanaTest(void) {
9.186784563f,
9.186784563f};
- assert(smeana(table1, 3) == 3.0f);
- assert(smeana(table2, 5) == 9.186784563f);
- assert(smeana(table2, 5) - 9.186784f < 1e-6);
+ printf("\n>>>> Mean Float Array Test\n");
+ assert(smeana(table1, 3) == 9.0f / 3.0f);
+ assert((smeana(table2, 5) - (9.186784563f + 9.186784563f + 9.186784563f + 9.186784563f + 9.186784563f) / 5.0f) / smeana(table2, 5) < 1e-6);
+ return 0;
+}
+
+static int scolumnmeanaTest(void) {
+ int i = 0;
+ float table1[9] = {1.0f, 4.0f, 7.0f, 2.0f , 5.0f, 8.0f, 3.0f, 6.0f, 9.0f};
+ float table2[10] = {1.0f, 2.0f, 3.0f, 4.0f , 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f};
+ float columnMeanmedTable1_3_3[3] = {0};
+ float columnMeanmedTable1_1_9[1] = {0};
+ float columnMeanmedTable1_9_1[9] = {0};
+ float columnMeanmedTable2_2_5[2] = {0};
+ float columnMeanmedTable2_5_2[5] = {0};
+
+ printf("\n>>>> Column Mean Float Array Test\n");
+ /*
+ [ 1 2 3 ]
+ [ 4 5 6 ] => [ 6 15 24 ]
+ [ 7 8 9 ]
+ */
+ scolumnmeana(table1, 3, 3,columnMeanmedTable1_3_3);
+ assert(columnMeanmedTable1_3_3[0] == 6.0f / 3.0f);
+ assert(columnMeanmedTable1_3_3[1] == 15.0f / 3.0f);
+ assert(columnMeanmedTable1_3_3[2] == 24.0f / 3.0f);
+
+ /*
+ [ 1 2 3 4 5 6 7 8 9 ] => [ 45 ]
+ */
+ scolumnmeana(table1, 1, 9,columnMeanmedTable1_1_9);
+ assert(columnMeanmedTable1_1_9[0] == 45.0f / 9.0f);
+
+ /*
+ [ 1 ]
+ [ 2 ]
+ [ 3 ]
+ [ 4 ]
+ [ 5 ] => [ 1 2 3 4 5 6 7 8 9 ]
+ [ 6 ]
+ [ 7 ]
+ [ 8 ]
+ [ 9 ]
+ */
+ scolumnmeana(table1, 9, 1,columnMeanmedTable1_9_1);
+ for ( i = 0 ; i < 9 ; ++i) {
+ printf("columnMeanmedTable1_9_1[%d] = %e\n", i, columnMeanmedTable1_9_1[i]);
+ assert(columnMeanmedTable1_9_1[i] == table1[i]);
+ }
+
+ /*
+ [ 1 3 5 7 9 ]
+ [ 2 4 6 8 10 ] => [ 25 30 ]
+ */
+ scolumnmeana(table2, 2, 5,columnMeanmedTable2_2_5);
+ assert(columnMeanmedTable2_2_5[0] == 25.0f / 5.0f);
+ assert(columnMeanmedTable2_2_5[1] == 30.0f / 5.0f);
+ for ( i = 0 ; i < 2 ; ++i) {
+ printf("columnMeanmedTable2_2_5[%d] = %e\n", i, columnMeanmedTable2_2_5[i]);
+ }
+
+ /*
+ [ 1 6 ]
+ [ 2 7 ] => [ 7 9 11 13 15 ]
+ [ 3 8 ]
+ [ 4 9 ]
+ [ 5 10 ]
+ */
+ scolumnmeana(table2, 5, 2,columnMeanmedTable2_5_2);
+ assert(columnMeanmedTable2_5_2[0] == 7.0f / 2.0f);
+ assert(columnMeanmedTable2_5_2[1] == 9.0f / 2.0f);
+ assert(columnMeanmedTable2_5_2[2] == 11.0f / 2.0f);
+ assert(columnMeanmedTable2_5_2[3] == 13.0f / 2.0f);
+ assert(columnMeanmedTable2_5_2[4] == 15.0f / 2.0f);
+ for ( i = 0 ; i < 5 ; ++i) {
+ printf("columnMeanmedTable2_5_2[%d] = %e\n", i, columnMeanmedTable2_5_2[i]);
+ }
+
+ return 0;
+}
+
+static int srowmeanaTest(void) {
+ int i = 0;
+ float table1[9] = {1.0f, 4.0f, 7.0f, 2.0f , 5.0f, 8.0f, 3.0f, 6.0f, 9.0f};
+ float table2[10] = {1.0f, 2.0f, 3.0f, 4.0f , 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f};
+ float rowMeanmedTable1_3_3[3] = {0};
+ float rowMeanmedTable1_1_9[9] = {0};
+ float rowMeanmedTable1_9_1[1] = {0};
+ float rowMeanmedTable2_2_5[5] = {0};
+ float rowMeanmedTable2_5_2[2] = {0};
+
+ printf("\n>>>> Row Mean Float Array Test\n");
+ /*
+ [ 1 2 3 ]
+ [ 4 5 6 ] => [ 12 15 18 ]
+ [ 7 8 9 ]
+ */
+ srowmeana(table1, 3, 3,rowMeanmedTable1_3_3);
+ for ( i = 0 ; i < 3 ; ++i) {
+ printf("rowMeanmedTable1_3_3[%d] = %e\n", i, rowMeanmedTable1_3_3[i]);
+ }
+ assert(rowMeanmedTable1_3_3[0] == 12.0f / 3.0f);
+ assert(rowMeanmedTable1_3_3[1] == 15.0f / 3.0f);
+ assert(rowMeanmedTable1_3_3[2] == 18.0f / 3.0f);
+
+ /*
+ [ 1 ]
+ [ 2 ]
+ [ 3 ]
+ [ 4 ]
+ [ 5 ] => [ 1 2 3 4 5 6 7 8 9 ]
+ [ 6 ]
+ [ 7 ]
+ [ 8 ]
+ [ 9 ]
+ */
+ srowmeana(table1, 1, 9,rowMeanmedTable1_1_9);
+ for ( i = 0 ; i < 9 ; ++i) {
+ printf("rowMeanmedTable1_1_9[%d] = %e\n", i, rowMeanmedTable1_1_9[i]);
+ assert(rowMeanmedTable1_1_9[i] == table1[i]);
+ }
+
+ /*
+ [ 1 2 3 4 5 6 7 8 9 ] => [ 45 ]
+ */
+ srowmeana(table1, 9, 1,rowMeanmedTable1_9_1);
+ assert(rowMeanmedTable1_9_1[0] == 45.0f / 9.0f);
+
+ /*
+ [ 1 3 5 7 9 ]
+ [ 2 4 6 8 10 ] => [ 3 7 11 15 19 ]
+ */
+ srowmeana(table2, 2, 5,rowMeanmedTable2_2_5);
+ assert(rowMeanmedTable2_2_5[0] == 3.0f / 2.0f);
+ assert(rowMeanmedTable2_2_5[1] == 7.0f / 2.0f);
+ assert(rowMeanmedTable2_2_5[2] == 11.0f / 2.0f);
+ assert(rowMeanmedTable2_2_5[3] == 15.0f / 2.0f);
+ assert(rowMeanmedTable2_2_5[4] == 19.0f / 2.0f);
+ for ( i = 0 ; i < 5 ; ++i) {
+ printf("rowMeanmedTable2_2_5[%d] = %e\n", i, rowMeanmedTable2_2_5[i]);
+ }
+
+ /*
+ [ 1 6 ]
+ [ 2 7 ] => [ 15 40 ]
+ [ 3 8 ]
+ [ 4 9 ]
+ [ 5 10 ]
+ */
+ srowmeana(table2, 5, 2,rowMeanmedTable2_5_2);
+ assert(rowMeanmedTable2_5_2[0] == 15.0f / 5.0f);
+ assert(rowMeanmedTable2_5_2[1] == 40.0f / 5.0f);
+ for ( i = 0 ; i < 2 ; ++i) {
+ printf("rowMeanmedTable2_5_2[%d] = %e\n", i, rowMeanmedTable2_5_2[i]);
+ }
+
return 0;
}
@@ -43,6 +199,7 @@ static int cmeansTest(void) {
floatComplex value1 = FloatComplex(3.0f, 3.0f);
floatComplex value2 = FloatComplex(1.123456789f, 1.123456789f);
+ printf("\n>>>> Mean Float Complex Scalar Test\n");
assert(creals(cmeans(value1)) == 3.0f);
assert(cimags(cmeans(value1)) == 3.0f);
assert(creals(cmeans(value2)) == 1.123456789f);
@@ -56,6 +213,7 @@ static int cmeanaTest(void) {
floatComplex value2 = FloatComplex(9.186784563f,9.186784563f);
floatComplex table2[5];
+ printf("\n>>>> Mean Float Complex Array Test\n");
table1[0] = value1;
table1[1] = value1;
table1[2] = value1;
@@ -75,23 +233,244 @@ static int cmeanaTest(void) {
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);
+ assert(creals(cmeana(table1, 3)) == 9.0f / 3.0f);
+ assert(cimags(cmeana(table1, 3)) == 9.0f / 3.0f);
+ assert(creals(cmeana(table2, 5)) == (9.186784563f + 9.186784563f + 9.186784563f + 9.186784563f + 9.186784563f) / 5.0f);
+ assert(cimags(cmeana(table2, 5)) == (9.186784563f + 9.186784563f + 9.186784563f + 9.186784563f + 9.186784563f) / 5.0f);
+
+ return 0;
+}
+
+static int crowmeanaTest(void) {
+ int i = 0;
+ floatComplex in[12];
+ floatComplex rowMeanmedIn_4_3[3];
+ floatComplex rowMeanmedIn_3_4[4];
+ floatComplex rowMeanmedIn_6_2[2];
+ floatComplex rowMeanmedIn_2_6[6];
+ floatComplex rowMeanmedIn_1_12[12];
+ floatComplex rowMeanmedIn_12_1[1];
+
+ printf("\n>>>> Row Mean Float Complex Array Test\n");
+ /* Init input var */
+ for (i = 0 ; i < 12 ; ++i)
+ {
+ in[i] = FloatComplex((float) i / 10.0f, (11.0f - (float) i) / 10.0f);
+ }
+
+ /*
+ [ 1.1i 0.4+0.7i 0.8+0.3i ]
+ [ 0.1+i 0.5+0.6i 0.9+0.2i ] => [ 0.6+3.8i 2.2+2.2i 3.8+0.6i ]
+ [ 0.2+0.9i 0.6+0.5i 1+0.1i ]
+ [ 0.3+0.8i 0.7+0.4i 1.1 ]
+ */
+ crowmeana(in, 4, 3, rowMeanmedIn_4_3);
+ for (i = 0 ; i < 3 ; ++i) {
+ printf("rowMeanmedIn_4_3[%d] = %e + %ei\n", i, creals(rowMeanmedIn_4_3[i]), cimags(rowMeanmedIn_4_3[i]));
+ }
+ assert(creals(rowMeanmedIn_4_3[0]) == 0.6f / 4.0f && cimags(rowMeanmedIn_4_3[0]) == 3.8f / 4.0f);
+ assert(creals(rowMeanmedIn_4_3[1]) == 2.2f / 4.0f && cimags(rowMeanmedIn_4_3[1]) == 2.2f / 4.0f);
+ assert(fabs(creals(rowMeanmedIn_4_3[2]) - 3.8f / 4.0f) < 1e-06);
+ assert(cimags(rowMeanmedIn_4_3[2]) == 0.6f / 4.0f);
+
+ /*
+ [ 1.1i 0.3+0.8i 0.6+0.5i 0.9+0.2i ]
+ [ 0.1+i 0.4+0.7i 0.7+0.4i 1+0.1i ] => [ 0.3+3.i 1.2+2.1i 2.1+1.2i 3.+0.3i]
+ [ 0.2+0.9i 0.5+0.6i 0.8+0.3i 1.1 ]
+ */
+ crowmeana(in, 3, 4, rowMeanmedIn_3_4);
+ for (i = 0 ; i < 4 ; ++i) {
+ printf("rowMeanmedIn_3_4[%d] = %e + %ei\n", i, creals(rowMeanmedIn_3_4[i]), cimags(rowMeanmedIn_3_4[i]));
+ }
+ assert(creals(rowMeanmedIn_3_4[0]) == 0.3f / 3.0f && cimags(rowMeanmedIn_3_4[0]) == 3.0f / 3.0f);
+ assert(creals(rowMeanmedIn_3_4[1]) == 1.2f / 3.0f && cimags(rowMeanmedIn_3_4[1]) == 2.1f / 3.0f);
+ assert(creals(rowMeanmedIn_3_4[2]) == 2.1f / 3.0f && cimags(rowMeanmedIn_3_4[2]) == 1.2f / 3.0f);
+ assert(creals(rowMeanmedIn_3_4[3]) == 3.0f / 3.0f && cimags(rowMeanmedIn_3_4[3]) == 0.3f / 3.0f);
+
+ /*
+ [ 1.1i 0.6+0.5i ]
+ [ 0.1+i 0.7+0.4i ]
+ [ 0.2+0.9i 0.8+0.3i ] => [ 1.5+5.1i 5.1+1.5i ]
+ [ 0.3+0.8i 0.9+0.2i ]
+ [ 0.4+0.7i 1+0.1i ]
+ [ 0.5+0.6i 1.1 ]
+ */
+ crowmeana(in, 6, 2, rowMeanmedIn_6_2);
+ for (i = 0 ; i < 2 ; ++i) {
+ printf("rowMeanmedIn_6_2[%d] = %e + %ei\n", i, creals(rowMeanmedIn_6_2[i]), cimags(rowMeanmedIn_6_2[i]));
+ }
+ assert(creals(rowMeanmedIn_6_2[0]) == 1.5f / 6.0f && cimags(rowMeanmedIn_6_2[0]) == 5.1f / 6.0f);
+ assert(creals(rowMeanmedIn_6_2[1]) == 5.1f / 6.0f);
+ assert(fabs(cimags(rowMeanmedIn_6_2[1]) - 1.5f / 6.0f) < 1e-06);
+
+ /*
+ [ 1.1i 0.2+0.9i 0.4+0.7i 0.6+0.5i 0.8+0.3i 1+0.1i ]
+ [ 0.1+i 0.3+0.8i 0.5+0.6i 0.7+0.4i 0.9+0.2i 1.1 ] => [ 0.1+2.1i 0.5+1.7i 0.9+1.3i 1.3+0.9i 1.7+0.5i 2.1+0.1i ]
+ */
+ crowmeana(in, 2, 6, rowMeanmedIn_2_6);
+ for (i = 0 ; i < 6 ; ++i) {
+ printf("rowMeanmedIn_2_6[%d] = %e + %ei\n", i, creals(rowMeanmedIn_2_6[i]), cimags(rowMeanmedIn_2_6[i]));
+ }
+ assert(creals(rowMeanmedIn_2_6[0]) == 0.1f / 2.0f && cimags(rowMeanmedIn_2_6[0]) == 2.1f / 2.0f);
+ assert(creals(rowMeanmedIn_2_6[1]) == 0.5f / 2.0f && cimags(rowMeanmedIn_2_6[1]) == 1.7f / 2.0f);
+ assert(creals(rowMeanmedIn_2_6[2]) == 0.9f / 2.0f && cimags(rowMeanmedIn_2_6[2]) == 1.3f / 2.0f);
+ assert(creals(rowMeanmedIn_2_6[3]) == 1.3f / 2.0f && cimags(rowMeanmedIn_2_6[3]) == 0.9f / 2.0f);
+ assert(creals(rowMeanmedIn_2_6[4]) == 1.7f / 2.0f && cimags(rowMeanmedIn_2_6[4]) == 0.5f / 2.0f);
+ assert(creals(rowMeanmedIn_2_6[5]) == 2.1f / 2.0f && cimags(rowMeanmedIn_2_6[5]) == 0.1f / 2.0f);
+
+ /*
+ [ 1.1i 0.1+i 0.2+0.9i 0.3+0.8i 0.4+0.7i 0.5+0.6i 0.6+0.5i 0.7+0.4i 0.8+0.3i 0.9+0.2i 1+0.1i 1.1 ]
+ =>
+ [ 1.1i 0.1+i 0.2+0.9i 0.3+0.8i 0.4+0.7i 0.5+0.6i 0.6+0.5i 0.7+0.4i 0.8+0.3i 0.9+0.2i 1+0.1i 1.1 ]
+ */
+ crowmeana(in, 1, 12, rowMeanmedIn_1_12);
+ for (i = 0 ; i < 12 ; ++i) {
+ printf("rowMeanmedIn_1_12[%d] = %e + %ei\n", i, creals(rowMeanmedIn_1_12[i]), cimags(rowMeanmedIn_1_12[i]));
+ assert(creals(rowMeanmedIn_1_12[i]) == creals(in[i]) && cimags(rowMeanmedIn_1_12[i]) == cimags(in[i]));
+ }
+
+ /*
+ [ 1.1i ]
+ [ 0.1+i ]
+ [ 0.2+0.9i ]
+ [ 0.3+0.8i ]
+ [ 0.4+0.7i ]
+ [ 0.5+0.6i ]
+ [ 0.6+0.5i ] => [ 6.6+6.6i ]
+ [ 0.7+0.4i ]
+ [ 0.8+0.3i ]
+ [ 0.9+0.2i ]
+ [ 1+0.1i ]
+ [ 1.1 ]
+ */
+ crowmeana(in, 12, 1, rowMeanmedIn_12_1);
+ printf("rowMeanmedIn_12_1[%d] = %e + %ei\n", 0, creals(rowMeanmedIn_12_1[0]), cimags(rowMeanmedIn_12_1[0]));
+ assert(creals(rowMeanmedIn_12_1[0]) == 6.6f / 12.0f && cimags(rowMeanmedIn_12_1[0]) == 6.6f / 12.0f);
+
+ return 0;
+}
+
+static int ccolumnmeanaTest(void) {
+ int i = 0;
+ floatComplex in[12];
+ floatComplex columnMeanmedIn_4_3[4];
+ floatComplex columnMeanmedIn_3_4[3];
+ floatComplex columnMeanmedIn_6_2[6];
+ floatComplex columnMeanmedIn_2_6[2];
+ floatComplex columnMeanmedIn_1_12[1];
+ floatComplex columnMeanmedIn_12_1[12];
+
+ printf("\n>>>> ColumnMean Float Complex Array Test\n");
+ /* Init input var */
+ for (i = 0 ; i < 12 ; ++i)
+ {
+ in[i] = FloatComplex((float) i / 10.0f, (11.0f - (float) i) / 10.0f);
+ }
+
+ /*
+ [ 1.1i 0.4+0.7i 0.8+0.3i ]
+ [ 0.1+i 0.5+0.6i 0.9+0.2i ] => [ 1.2+2.1i 1.5+1.8i 1.8+1.5i 2.1+1.2i ]
+ [ 0.2+0.9i 0.6+0.5i 1+0.1i ]
+ [ 0.3+0.8i 0.7+0.4i 1.1 ]
+ */
+ ccolumnmeana(in, 4, 3, columnMeanmedIn_4_3);
+ for (i = 0 ; i < 4 ; ++i) {
+ printf("columnMeanmedIn_4_3[%d] = %e + %ei\n", i, creals(columnMeanmedIn_4_3[i]), cimags(columnMeanmedIn_4_3[i]));
+ }
+ assert(creals(columnMeanmedIn_4_3[0]) == 1.2f / 3.0f && cimags(columnMeanmedIn_4_3[0]) == 2.1f / 3.0f);
+ assert(creals(columnMeanmedIn_4_3[1]) == 1.5f / 3.0f);
+ assert(fabs(cimags(columnMeanmedIn_4_3[1]) - 1.8f / 3.0f) < 1e-06);
+ assert(creals(columnMeanmedIn_4_3[2]) == 1.8f / 3.0f && cimags(columnMeanmedIn_4_3[2]) == 1.5f / 3.0f);
+ assert(creals(columnMeanmedIn_4_3[3]) == 2.1f / 3.0f && cimags(columnMeanmedIn_4_3[3]) == 1.2f / 3.0f);
+
+ /*
+ [ 1.1i 0.3+0.8i 0.6+0.5i 0.9+0.2i ]
+ [ 0.1+i 0.4+0.7i 0.7+0.4i 1+0.1i ] => [ 1.8+2.6i 2.2+2.2i 2.6+1.8i ]
+ [ 0.2+0.9i 0.5+0.6i 0.8+0.3i 1.1 ]
+ */
+ ccolumnmeana(in, 3, 4, columnMeanmedIn_3_4);
+ for (i = 0 ; i < 3 ; ++i) {
+ printf("columnMeanmedIn_3_4[%d] = %e + %ei\n", i, creals(columnMeanmedIn_3_4[i]), cimags(columnMeanmedIn_3_4[i]));
+ }
+ assert(creals(columnMeanmedIn_3_4[0]) == 1.8f / 4.0f);
+ assert(fabs(cimags(columnMeanmedIn_3_4[0]) - 2.6f / 4.0f) < 1e-06);
+ assert(creals(columnMeanmedIn_3_4[1]) == 2.2f / 4.0f && cimags(columnMeanmedIn_3_4[1]) == 2.2f / 4.0f);
+ assert(creals(columnMeanmedIn_3_4[2]) == 2.6f / 4.0f && cimags(columnMeanmedIn_3_4[2]) == 1.8f / 4.0f);
+
+ /*
+ [ 1.1i 0.6+0.5i ]
+ [ 0.1+i 0.7+0.4i ]
+ [ 0.2+0.9i 0.8+0.3i ] => [ 0.6+1.6i 0.8+1.4i 1+1.2i 1.2+i 1.4+0.8i 1.6+0.6i ]
+ [ 0.3+0.8i 0.9+0.2i ]
+ [ 0.4+0.7i 1+0.1i ]
+ [ 0.5+0.6i 1.1 ]
+ */
+ ccolumnmeana(in, 6, 2, columnMeanmedIn_6_2);
+ for (i = 0 ; i < 6 ; ++i) {
+ printf("columnMeanmedIn_6_2[%d] = %e + %ei\n", i, creals(columnMeanmedIn_6_2[i]), cimags(columnMeanmedIn_6_2[i]));
+ }
+ assert(creals(columnMeanmedIn_6_2[0]) == 0.6f / 2.0f && cimags(columnMeanmedIn_6_2[0]) == 1.6f / 2.0f);
+ assert(creals(columnMeanmedIn_6_2[1]) == 0.8f / 2.0f && cimags(columnMeanmedIn_6_2[1]) == 1.4f / 2.0f);
+ assert(creals(columnMeanmedIn_6_2[2]) == 1.0f / 2.0f && cimags(columnMeanmedIn_6_2[2]) == 1.2f / 2.0f);
+ assert(creals(columnMeanmedIn_6_2[3]) == 1.2f / 2.0f && cimags(columnMeanmedIn_6_2[3]) == 1.0f / 2.0f);
+ assert(creals(columnMeanmedIn_6_2[4]) == 1.4f / 2.0f && cimags(columnMeanmedIn_6_2[4]) == 0.8f / 2.0f);
+ assert(creals(columnMeanmedIn_6_2[5]) == 1.6f / 2.0f && cimags(columnMeanmedIn_6_2[5]) == 0.6f / 2.0f);
+
+ /*
+ [ 1.1i 0.2+0.9i 0.4+0.7i 0.6+0.5i 0.8+0.3i 1+0.1i ]
+ [ 0.1+i 0.3+0.8i 0.5+0.6i 0.7+0.4i 0.9+0.2i 1.1 ] => [ 3+3.6i 3.6+3i ]
+ */
+ ccolumnmeana(in, 2, 6, columnMeanmedIn_2_6);
+ for (i = 0 ; i < 2 ; ++i) {
+ printf("columnMeanmedIn_2_6[%d] = %e + %ei\n", i, creals(columnMeanmedIn_2_6[i]), cimags(columnMeanmedIn_2_6[i]));
+ }
+ assert(creals(columnMeanmedIn_2_6[0]) == 3.0f / 6.0f && cimags(columnMeanmedIn_2_6[0]) == 3.6f / 6.0f);
+ assert(creals(columnMeanmedIn_2_6[1]) == 3.6f / 6.0f);
+ assert(fabs(cimags(columnMeanmedIn_2_6[1]) -3.0f / 6.0f) < 1e-06);
+
+ /*
+ [ 1.1i 0.1+i 0.2+0.9i 0.3+0.8i 0.4+0.7i 0.5+0.6i 0.6+0.5i 0.7+0.4i 0.8+0.3i 0.9+0.2i 1+0.1i 1.1 ]
+ =>
+ [ 6.6+6.6i ]
+ */
+ ccolumnmeana(in, 1, 12, columnMeanmedIn_1_12);
+ printf("columnMeanmedIn_1_12[%d] = %e + %ei\n", 0, creals(columnMeanmedIn_1_12[0]), cimags(columnMeanmedIn_1_12[0]));
+ assert(creals(columnMeanmedIn_1_12[0]) == 6.6f / 12.0f && cimags(columnMeanmedIn_1_12[0]) == 6.6f / 12.0f);
+
+
+ /*
+ [ 1.1i ]
+ [ 0.1+i ]
+ [ 0.2+0.9i ]
+ [ 0.3+0.8i ]
+ [ 0.4+0.7i ]
+ [ 0.5+0.6i ]
+ [ 0.6+0.5i ] => [ 1.1i 0.1+i 0.2+0.9i 0.3+0.8i 0.4+0.7i 0.5+0.6i 0.6+0.5i 0.7+0.4i 0.8+0.3i 0.9+0.2i 1+0.1i 1.1 ]
+ [ 0.7+0.4i ]
+ [ 0.8+0.3i ]
+ [ 0.9+0.2i ]
+ [ 1+0.1i ]
+ [ 1.1 ]
+ */
+ ccolumnmeana(in, 12, 1, columnMeanmedIn_12_1);
+ for (i = 0 ; i < 12 ; ++i) {
+ printf("columnMeanmedIn_12_1[%d] = %e + %ei\n", i, creals(columnMeanmedIn_12_1[i]), cimags(columnMeanmedIn_12_1[i]));
+ assert(creals(columnMeanmedIn_12_1[i]) == creals(in[i]) && cimags(columnMeanmedIn_12_1[i]) == cimags(in[i]));
+ }
return 0;
}
static int testMean(void) {
- printf("\n>>>> Mean Tests\n");
smeansTest();
smeanaTest();
+ srowmeanaTest();
+ scolumnmeanaTest();
cmeansTest();
cmeanaTest();
+ crowmeanaTest();
+ ccolumnmeanaTest();
return 0;
}
diff --git a/src/statisticsFunctions/mean/zcolumnmeana.c b/src/statisticsFunctions/mean/zcolumnmeana.c
new file mode 100644
index 00000000..c4ffef3c
--- /dev/null
+++ b/src/statisticsFunctions/mean/zcolumnmeana.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"
+#include "sum.h"
+
+void zcolumnmeana(doubleComplex *in, int lines, int columns, doubleComplex *out) {
+ int i = 0;
+
+ zcolumnsuma(in, lines, columns, out);
+ for (i = 0; i < lines; ++i)
+ {
+ out[i] = zdevides(out[i] , DoubleComplex((double) columns, 0.0f));
+ }
+}
diff --git a/src/statisticsFunctions/mean/zrowmeana.c b/src/statisticsFunctions/mean/zrowmeana.c
new file mode 100644
index 00000000..280df796
--- /dev/null
+++ b/src/statisticsFunctions/mean/zrowmeana.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"
+#include "sum.h"
+
+void zrowmeana(doubleComplex *in, int lines, int columns, doubleComplex *out) {
+ int i = 0;
+
+ zrowsuma(in, lines, columns, out);
+ for (i = 0; i < columns; ++i)
+ {
+ out[i] = zdevides(out[i], DoubleComplex((double)lines, 0.0f));
+ }
+}