diff options
author | jofret | 2008-04-11 12:53:50 +0000 |
---|---|---|
committer | jofret | 2008-04-11 12:53:50 +0000 |
commit | 0b9181316a12676114ea351dafa0acc5ee46965a (patch) | |
tree | 425a121528c5ead69b8f7226ca5e0638662b1f51 | |
parent | 0484c8701c7f9bf4edf95ca44c88f8bd92633943 (diff) | |
download | scilab2c-0b9181316a12676114ea351dafa0acc5ee46965a.tar.gz scilab2c-0b9181316a12676114ea351dafa0acc5ee46965a.tar.bz2 scilab2c-0b9181316a12676114ea351dafa0acc5ee46965a.zip |
add tests and mimic Scilab behaviour sign(0) = 0
-rw-r--r-- | src/auxiliaryFunctions/sign/Makefile.am | 36 | ||||
-rw-r--r-- | src/auxiliaryFunctions/sign/Makefile.in | 255 | ||||
-rw-r--r-- | src/auxiliaryFunctions/sign/csigna.c | 27 | ||||
-rw-r--r-- | src/auxiliaryFunctions/sign/csigns.c | 26 | ||||
-rw-r--r-- | src/auxiliaryFunctions/sign/dsigna.c | 27 | ||||
-rw-r--r-- | src/auxiliaryFunctions/sign/dsigns.c | 28 | ||||
-rw-r--r-- | src/auxiliaryFunctions/sign/ssigna.c | 27 | ||||
-rw-r--r-- | src/auxiliaryFunctions/sign/ssigns.c | 28 | ||||
-rw-r--r-- | src/auxiliaryFunctions/sign/testSign.c | 97 | ||||
-rw-r--r-- | src/auxiliaryFunctions/sign/testSign.h | 30 | ||||
-rw-r--r-- | src/auxiliaryFunctions/sign/zsigna.c | 27 | ||||
-rw-r--r-- | src/auxiliaryFunctions/sign/zsigns.c | 26 |
12 files changed, 421 insertions, 213 deletions
diff --git a/src/auxiliaryFunctions/sign/Makefile.am b/src/auxiliaryFunctions/sign/Makefile.am index c421beea..ba5e2bc9 100644 --- a/src/auxiliaryFunctions/sign/Makefile.am +++ b/src/auxiliaryFunctions/sign/Makefile.am @@ -1,25 +1,24 @@ ## -## -*- makefile -*- +## Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +## Copyright (C) 2007-2008 - INRIA - Bruno JOFRET ## -## Makefile -## Made by Bruno JOFRET <bruno.jofret@inria.fr> +## 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 ## -## Started on Fri Jan 5 10:19:16 2007 jofret -## Last update Wed Apr 18 18:45:11 2007 jofret -## -## Copyright INRIA 2007 ## -AM_CFLAGS = -I ../../type \ - -I ../includes +libSign_la_CFLAGS = -I $(top_builddir)/type \ + -I $(top_builddir)/elementaryFunctions/includes \ + -I $(top_builddir)/auxiliaryFunctions/includes instdir = $(top_builddir)/lib -inst_LIBRARIES = libSign.a - -noinst_LIBRARIES = libSign.a +pkglib_LTLIBRARIES = libSign.la -libSign_a_SOURCES = $(HEAD) $(SRC) +libSign_la_SOURCES = $(HEAD) $(SRC) SRC = ssigns.c \ dsigns.c \ @@ -37,7 +36,8 @@ HEAD = ../includes/sign.h #### check_INCLUDES = -I $(top_builddir)/elementaryFunctions/includes \ - -I $(top_builddir)/type + -I $(top_builddir)/type \ + -I $(top_builddir)/auxiliaryFunctions/includes check_PROGRAMS = testSign @@ -48,7 +48,9 @@ TESTS = testSign # testSign_SOURCES = testSign.c testSign_CFLAGS = $(check_INCLUDES) -testSign_LDADD = $(top_builddir)/lib/libDoubleComplex.a \ - $(top_builddir)/lib/libFloatComplex.a \ - $(top_builddir)/lib/libSign.a \ +testSign_LDADD = $(top_builddir)/type/libDoubleComplex.la \ + $(top_builddir)/type/libFloatComplex.la \ + $(top_builddir)/elementaryFunctions/sqrt/libSqrt.la \ + $(top_builddir)/auxiliaryFunctions/abs/libAbs.la \ + $(top_builddir)/auxiliaryFunctions/sign/libSign.la \ @LIBMATH@ diff --git a/src/auxiliaryFunctions/sign/Makefile.in b/src/auxiliaryFunctions/sign/Makefile.in index ccc73d21..f27d27e3 100644 --- a/src/auxiliaryFunctions/sign/Makefile.in +++ b/src/auxiliaryFunctions/sign/Makefile.in @@ -37,8 +37,7 @@ TESTS = testSign$(EXEEXT) subdir = auxiliaryFunctions/sign DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/fortran.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -50,40 +49,49 @@ am__vpath_adj = case $$p in \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(instdir)" -instLIBRARIES_INSTALL = $(INSTALL_DATA) -LIBRARIES = $(inst_LIBRARIES) $(noinst_LIBRARIES) -AR = ar -ARFLAGS = cru -libSign_a_AR = $(AR) $(ARFLAGS) -libSign_a_LIBADD = +am__installdirs = "$(DESTDIR)$(pkglibdir)" +pkglibLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(pkglib_LTLIBRARIES) +libSign_la_LIBADD = am__objects_1 = -am__objects_2 = ssigns.$(OBJEXT) dsigns.$(OBJEXT) csigns.$(OBJEXT) \ - zsigns.$(OBJEXT) ssigna.$(OBJEXT) dsigna.$(OBJEXT) \ - csigna.$(OBJEXT) zsigna.$(OBJEXT) -am_libSign_a_OBJECTS = $(am__objects_1) $(am__objects_2) -libSign_a_OBJECTS = $(am_libSign_a_OBJECTS) +am__objects_2 = libSign_la-ssigns.lo libSign_la-dsigns.lo \ + libSign_la-csigns.lo libSign_la-zsigns.lo libSign_la-ssigna.lo \ + libSign_la-dsigna.lo libSign_la-csigna.lo libSign_la-zsigna.lo +am_libSign_la_OBJECTS = $(am__objects_1) $(am__objects_2) +libSign_la_OBJECTS = $(am_libSign_la_OBJECTS) +libSign_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libSign_la_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ am_testSign_OBJECTS = testSign-testSign.$(OBJEXT) testSign_OBJECTS = $(am_testSign_OBJECTS) -testSign_DEPENDENCIES = $(top_builddir)/lib/libDoubleComplex.a \ - $(top_builddir)/lib/libFloatComplex.a \ - $(top_builddir)/lib/libSign.a -testSign_LINK = $(CCLD) $(testSign_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ +testSign_DEPENDENCIES = $(top_builddir)/type/libDoubleComplex.la \ + $(top_builddir)/type/libFloatComplex.la \ + $(top_builddir)/elementaryFunctions/sqrt/libSqrt.la \ + $(top_builddir)/auxiliaryFunctions/abs/libAbs.la \ + $(top_builddir)/auxiliaryFunctions/sign/libSign.la +testSign_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(testSign_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I. -I$(top_builddir)/includes@am__isrc@ 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 = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libSign_a_SOURCES) $(testSign_SOURCES) -DIST_SOURCES = $(libSign_a_SOURCES) $(testSign_SOURCES) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libSign_la_SOURCES) $(testSign_SOURCES) +DIST_SOURCES = $(libSign_la_SOURCES) $(testSign_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@ @@ -94,11 +102,13 @@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ +CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ @@ -116,6 +126,7 @@ LDFLAGS = @LDFLAGS@ LIBMATH = @LIBMATH@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ @@ -130,6 +141,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -185,13 +197,13 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -AM_CFLAGS = -I ../../type \ - -I ../includes +libSign_la_CFLAGS = -I $(top_builddir)/type \ + -I $(top_builddir)/elementaryFunctions/includes \ + -I $(top_builddir)/auxiliaryFunctions/includes instdir = $(top_builddir)/lib -inst_LIBRARIES = libSign.a -noinst_LIBRARIES = libSign.a -libSign_a_SOURCES = $(HEAD) $(SRC) +pkglib_LTLIBRARIES = libSign.la +libSign_la_SOURCES = $(HEAD) $(SRC) SRC = ssigns.c \ dsigns.c \ csigns.c \ @@ -207,7 +219,8 @@ HEAD = ../includes/sign.h # Checking Part #### check_INCLUDES = -I $(top_builddir)/elementaryFunctions/includes \ - -I $(top_builddir)/type + -I $(top_builddir)/type \ + -I $(top_builddir)/auxiliaryFunctions/includes # @@ -215,15 +228,17 @@ check_INCLUDES = -I $(top_builddir)/elementaryFunctions/includes \ # testSign_SOURCES = testSign.c testSign_CFLAGS = $(check_INCLUDES) -testSign_LDADD = $(top_builddir)/lib/libDoubleComplex.a \ - $(top_builddir)/lib/libFloatComplex.a \ - $(top_builddir)/lib/libSign.a \ +testSign_LDADD = $(top_builddir)/type/libDoubleComplex.la \ + $(top_builddir)/type/libFloatComplex.la \ + $(top_builddir)/elementaryFunctions/sqrt/libSqrt.la \ + $(top_builddir)/auxiliaryFunctions/abs/libAbs.la \ + $(top_builddir)/auxiliaryFunctions/sign/libSign.la \ @LIBMATH@ all: all-am .SUFFIXES: -.SUFFIXES: .c .o .obj +.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 \ @@ -253,45 +268,42 @@ $(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-instLIBRARIES: $(inst_LIBRARIES) +install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) - test -z "$(instdir)" || $(MKDIR_P) "$(DESTDIR)$(instdir)" - @list='$(inst_LIBRARIES)'; for p in $$list; do \ + 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 " $(instLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(instdir)/$$f'"; \ - $(instLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(instdir)/$$f"; \ - else :; fi; \ - done - @$(POST_INSTALL) - @list='$(inst_LIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - p=$(am__strip_dir) \ - echo " $(RANLIB) '$(DESTDIR)$(instdir)/$$p'"; \ - $(RANLIB) "$(DESTDIR)$(instdir)/$$p"; \ + echo " $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkglibdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkglibdir)/$$f"; \ else :; fi; \ done -uninstall-instLIBRARIES: +uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(inst_LIBRARIES)'; for p in $$list; do \ + @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(instdir)/$$p'"; \ - rm -f "$(DESTDIR)$(instdir)/$$p"; \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$p"; \ done -clean-instLIBRARIES: - -test -z "$(inst_LIBRARIES)" || rm -f $(inst_LIBRARIES) - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -libSign.a: $(libSign_a_OBJECTS) $(libSign_a_DEPENDENCIES) - -rm -f libSign.a - $(libSign_a_AR) libSign.a $(libSign_a_OBJECTS) $(libSign_a_LIBADD) - $(RANLIB) libSign.a +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 +libSign.la: $(libSign_la_OBJECTS) $(libSign_la_DEPENDENCIES) + $(libSign_la_LINK) -rpath $(pkglibdir) $(libSign_la_OBJECTS) $(libSign_la_LIBADD) $(LIBS) clean-checkPROGRAMS: - -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) + @list='$(check_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done testSign$(EXEEXT): $(testSign_OBJECTS) $(testSign_DEPENDENCIES) @rm -f testSign$(EXEEXT) $(testSign_LINK) $(testSign_OBJECTS) $(testSign_LDADD) $(LIBS) @@ -302,15 +314,15 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csigna.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csigns.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dsigna.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dsigns.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssigna.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssigns.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libSign_la-csigna.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libSign_la-csigns.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libSign_la-dsigna.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libSign_la-dsigns.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libSign_la-ssigna.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libSign_la-ssigns.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libSign_la-zsigna.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libSign_la-zsigns.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testSign-testSign.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zsigna.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zsigns.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -326,6 +338,69 @@ distclean-compile: @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 $@ $< + +libSign_la-ssigns.lo: ssigns.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libSign_la_CFLAGS) $(CFLAGS) -MT libSign_la-ssigns.lo -MD -MP -MF $(DEPDIR)/libSign_la-ssigns.Tpo -c -o libSign_la-ssigns.lo `test -f 'ssigns.c' || echo '$(srcdir)/'`ssigns.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libSign_la-ssigns.Tpo $(DEPDIR)/libSign_la-ssigns.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ssigns.c' object='libSign_la-ssigns.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) $(libSign_la_CFLAGS) $(CFLAGS) -c -o libSign_la-ssigns.lo `test -f 'ssigns.c' || echo '$(srcdir)/'`ssigns.c + +libSign_la-dsigns.lo: dsigns.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libSign_la_CFLAGS) $(CFLAGS) -MT libSign_la-dsigns.lo -MD -MP -MF $(DEPDIR)/libSign_la-dsigns.Tpo -c -o libSign_la-dsigns.lo `test -f 'dsigns.c' || echo '$(srcdir)/'`dsigns.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libSign_la-dsigns.Tpo $(DEPDIR)/libSign_la-dsigns.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dsigns.c' object='libSign_la-dsigns.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) $(libSign_la_CFLAGS) $(CFLAGS) -c -o libSign_la-dsigns.lo `test -f 'dsigns.c' || echo '$(srcdir)/'`dsigns.c + +libSign_la-csigns.lo: csigns.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libSign_la_CFLAGS) $(CFLAGS) -MT libSign_la-csigns.lo -MD -MP -MF $(DEPDIR)/libSign_la-csigns.Tpo -c -o libSign_la-csigns.lo `test -f 'csigns.c' || echo '$(srcdir)/'`csigns.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libSign_la-csigns.Tpo $(DEPDIR)/libSign_la-csigns.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='csigns.c' object='libSign_la-csigns.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) $(libSign_la_CFLAGS) $(CFLAGS) -c -o libSign_la-csigns.lo `test -f 'csigns.c' || echo '$(srcdir)/'`csigns.c + +libSign_la-zsigns.lo: zsigns.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libSign_la_CFLAGS) $(CFLAGS) -MT libSign_la-zsigns.lo -MD -MP -MF $(DEPDIR)/libSign_la-zsigns.Tpo -c -o libSign_la-zsigns.lo `test -f 'zsigns.c' || echo '$(srcdir)/'`zsigns.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libSign_la-zsigns.Tpo $(DEPDIR)/libSign_la-zsigns.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zsigns.c' object='libSign_la-zsigns.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) $(libSign_la_CFLAGS) $(CFLAGS) -c -o libSign_la-zsigns.lo `test -f 'zsigns.c' || echo '$(srcdir)/'`zsigns.c + +libSign_la-ssigna.lo: ssigna.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libSign_la_CFLAGS) $(CFLAGS) -MT libSign_la-ssigna.lo -MD -MP -MF $(DEPDIR)/libSign_la-ssigna.Tpo -c -o libSign_la-ssigna.lo `test -f 'ssigna.c' || echo '$(srcdir)/'`ssigna.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libSign_la-ssigna.Tpo $(DEPDIR)/libSign_la-ssigna.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ssigna.c' object='libSign_la-ssigna.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) $(libSign_la_CFLAGS) $(CFLAGS) -c -o libSign_la-ssigna.lo `test -f 'ssigna.c' || echo '$(srcdir)/'`ssigna.c + +libSign_la-dsigna.lo: dsigna.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libSign_la_CFLAGS) $(CFLAGS) -MT libSign_la-dsigna.lo -MD -MP -MF $(DEPDIR)/libSign_la-dsigna.Tpo -c -o libSign_la-dsigna.lo `test -f 'dsigna.c' || echo '$(srcdir)/'`dsigna.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libSign_la-dsigna.Tpo $(DEPDIR)/libSign_la-dsigna.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dsigna.c' object='libSign_la-dsigna.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) $(libSign_la_CFLAGS) $(CFLAGS) -c -o libSign_la-dsigna.lo `test -f 'dsigna.c' || echo '$(srcdir)/'`dsigna.c + +libSign_la-csigna.lo: csigna.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libSign_la_CFLAGS) $(CFLAGS) -MT libSign_la-csigna.lo -MD -MP -MF $(DEPDIR)/libSign_la-csigna.Tpo -c -o libSign_la-csigna.lo `test -f 'csigna.c' || echo '$(srcdir)/'`csigna.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libSign_la-csigna.Tpo $(DEPDIR)/libSign_la-csigna.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='csigna.c' object='libSign_la-csigna.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) $(libSign_la_CFLAGS) $(CFLAGS) -c -o libSign_la-csigna.lo `test -f 'csigna.c' || echo '$(srcdir)/'`csigna.c + +libSign_la-zsigna.lo: zsigna.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libSign_la_CFLAGS) $(CFLAGS) -MT libSign_la-zsigna.lo -MD -MP -MF $(DEPDIR)/libSign_la-zsigna.Tpo -c -o libSign_la-zsigna.lo `test -f 'zsigna.c' || echo '$(srcdir)/'`zsigna.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libSign_la-zsigna.Tpo $(DEPDIR)/libSign_la-zsigna.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zsigna.c' object='libSign_la-zsigna.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) $(libSign_la_CFLAGS) $(CFLAGS) -c -o libSign_la-zsigna.lo `test -f 'zsigna.c' || echo '$(srcdir)/'`zsigna.c + testSign-testSign.o: testSign.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testSign_CFLAGS) $(CFLAGS) -MT testSign-testSign.o -MD -MP -MF $(DEPDIR)/testSign-testSign.Tpo -c -o testSign-testSign.o `test -f 'testSign.c' || echo '$(srcdir)/'`testSign.c @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testSign-testSign.Tpo $(DEPDIR)/testSign-testSign.Po @@ -340,6 +415,12 @@ testSign-testSign.obj: testSign.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testSign_CFLAGS) $(CFLAGS) -c -o testSign-testSign.obj `if test -f 'testSign.c'; then $(CYGPATH_W) 'testSign.c'; else $(CYGPATH_W) '$(srcdir)/testSign.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 \ @@ -491,9 +572,9 @@ check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am -all-am: Makefile $(LIBRARIES) +all-am: Makefile $(LTLIBRARIES) installdirs: - for dir in "$(DESTDIR)$(instdir)"; do \ + for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -522,8 +603,8 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-checkPROGRAMS clean-generic clean-instLIBRARIES \ - clean-noinstLIBRARIES mostlyclean-am +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + clean-pkglibLTLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) @@ -541,11 +622,11 @@ info: info-am info-am: -install-data-am: install-instLIBRARIES +install-data-am: install-dvi: install-dvi-am -install-exec-am: +install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am @@ -566,7 +647,8 @@ maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am -mostlyclean-am: mostlyclean-compile mostlyclean-generic +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf: pdf-am @@ -576,23 +658,24 @@ ps: ps-am ps-am: -uninstall-am: uninstall-instLIBRARIES +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-instLIBRARIES \ - clean-noinstLIBRARIES ctags distclean distclean-compile \ - distclean-generic 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-instLIBRARIES install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-instLIBRARIES + 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. diff --git a/src/auxiliaryFunctions/sign/csigna.c b/src/auxiliaryFunctions/sign/csigna.c index c1e5e50d..478b4689 100644 --- a/src/auxiliaryFunctions/sign/csigna.c +++ b/src/auxiliaryFunctions/sign/csigna.c @@ -1,24 +1,21 @@ /* -** -*- C -*- -** -** csigna.c -** Made by Bruno JOFRET <bruno.jofret@inria.fr> -** -** Started on Fri Sep 7 17:36:56 2007 bruno -** Last update Fri Sep 7 17:37:15 2007 bruno -** -** Copyright INRIA 2007 -*/ + * 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 "sign.h" -int csigna(floatComplex *in, int size) { +void csigna(floatComplex *in, int size, floatComplex *out) { int i = 0; - int sign = 1; - /* FIXME : Does it what it's supposed to do ? */ for (i = 0 ; i < size ; ++i) { - sign = sign * csigns(in[i]); + out[i] = csigns(in[i]); } - return sign; } diff --git a/src/auxiliaryFunctions/sign/csigns.c b/src/auxiliaryFunctions/sign/csigns.c index 9590e4bf..218314ab 100644 --- a/src/auxiliaryFunctions/sign/csigns.c +++ b/src/auxiliaryFunctions/sign/csigns.c @@ -1,18 +1,18 @@ /* -** -*- C -*- -** -** csigns.c -** Made by Bruno JOFRET <bruno.jofret@inria.fr> -** -** Started on Fri Sep 7 16:56:47 2007 bruno -** Last update Fri Sep 7 17:29:18 2007 bruno -** -** Copyright INRIA 2007 -*/ + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007-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 "sign.h" +#include "abs.h" -int csigns(floatComplex in) { - /* FIXME : Dummy ...*/ - return -1; +floatComplex csigns(floatComplex in) { + return FloatComplex(creals(in) / cabss(in), cimags(in) / cabss(in)); } diff --git a/src/auxiliaryFunctions/sign/dsigna.c b/src/auxiliaryFunctions/sign/dsigna.c index b72bbb9c..49e66144 100644 --- a/src/auxiliaryFunctions/sign/dsigna.c +++ b/src/auxiliaryFunctions/sign/dsigna.c @@ -1,25 +1,22 @@ /* -** -*- C -*- -** -** dsigna.c -** Made by Bruno JOFRET <bruno.jofret@inria.fr> -** -** Started on Fri Sep 7 17:35:44 2007 bruno -** Last update Fri Sep 7 17:36:15 2007 bruno -** -** Copyright INRIA 2007 -*/ + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007-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 "sign.h" -int dsigna(double *in, int size) { +void dsigna(double *in, int size, double *out) { int i = 0; - int sign = 1; - /* FIXME : Does it what it's supposed to do ? */ for (i = 0 ; i < size ; ++i) { - sign = sign * dsigns(in[i]); + out[i] = dsigns(in[i]); } - return sign; } diff --git a/src/auxiliaryFunctions/sign/dsigns.c b/src/auxiliaryFunctions/sign/dsigns.c index 99735e87..0715d537 100644 --- a/src/auxiliaryFunctions/sign/dsigns.c +++ b/src/auxiliaryFunctions/sign/dsigns.c @@ -1,20 +1,24 @@ /* -** -*- C -*- -** -** ssigns.c -** Made by Bruno JOFRET <bruno.jofret@inria.fr> -** -** Started on Thu Feb 8 10:26:22 2007 jofret -** Last update Thu Feb 8 15:58:44 2007 jofret -** -** Copyright INRIA 2007 -*/ + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007-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 "sign.h" int dsigns(double num) { - if (num >= 0) { + if (num > 0) { return 1; } - return -1; + if (num < 0) { + return -1; + } + /* num == 0 */ + return 0; } diff --git a/src/auxiliaryFunctions/sign/ssigna.c b/src/auxiliaryFunctions/sign/ssigna.c index 5926e99d..44f8cf4a 100644 --- a/src/auxiliaryFunctions/sign/ssigna.c +++ b/src/auxiliaryFunctions/sign/ssigna.c @@ -1,24 +1,21 @@ /* -** -*- C -*- -** -** ssigna.c -** Made by Bruno JOFRET <bruno.jofret@inria.fr> -** -** Started on Fri Sep 7 17:30:57 2007 bruno -** Last update Fri Sep 7 17:35:32 2007 bruno -** -** Copyright INRIA 2007 -*/ + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007-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 "sign.h" -int ssigna(float *in, int size) { +void ssigna(float *in, int size, float *out) { int i = 0; - int sign = 1; - /* FIXME : Does it what it's supposed to do ? */ for (i = 0 ; i < size ; ++i) { - sign = sign * ssigns(in[i]); + out[i] = ssigns(in[i]); } - return sign; } diff --git a/src/auxiliaryFunctions/sign/ssigns.c b/src/auxiliaryFunctions/sign/ssigns.c index 0bb21833..f79d1a1a 100644 --- a/src/auxiliaryFunctions/sign/ssigns.c +++ b/src/auxiliaryFunctions/sign/ssigns.c @@ -1,20 +1,24 @@ /* -** -*- C -*- -** -** ssigns.c -** Made by Bruno JOFRET <bruno.jofret@inria.fr> -** -** Started on Thu Feb 8 10:26:22 2007 jofret -** Last update Thu Feb 8 15:58:54 2007 jofret -** -** Copyright INRIA 2007 -*/ + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007-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 "sign.h" int ssigns(float num) { - if (num >= 0) { + if (num > 0) { return 1; } - return -1; + if (num < 0) { + return -1; + } + /* num == 0 */ + return 0; } diff --git a/src/auxiliaryFunctions/sign/testSign.c b/src/auxiliaryFunctions/sign/testSign.c new file mode 100644 index 00000000..b3d77d72 --- /dev/null +++ b/src/auxiliaryFunctions/sign/testSign.c @@ -0,0 +1,97 @@ +/* + * 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 + * + */ + +/* +** FIXME : Add some array tests ! +*/ + +#include "testSign.h" + +int ssignsTest() { + + float positive = 0.123; + float negative = -0.123; + float zero = 0; + + printf(">> Float \n"); + assert(ssigns(positive) == 1); + assert(ssigns(negative) == -1); + assert(ssigns(zero) == 0); + return 0; +} + +int dsignsTest() { + + double positive = 0.123; + double negative = -0.123; + double zero = 0; + + printf(">> Double\n"); + assert(dsigns(positive) == 1); + assert(dsigns(negative) == -1); + assert(dsigns(zero) == 0); + return 0; +} + +int csignsTest() { + + floatComplex i = FloatComplex(0., 1.); + floatComplex oneAndI = FloatComplex(1., 1.); + floatComplex sign_i = csigns(i); + floatComplex sign_oneAndI = csigns(oneAndI); + + printf(">> Float Complex\n"); + /* sign(%i) = %i */ + assert(creals(sign_i) == 0); + assert(cimags(sign_i) == 1); + /* sign(1+%i) = (1+%i) / sqrt(2) */ + assert(creals(sign_oneAndI) == 1 / sqrtf(2)); + assert(cimags(sign_oneAndI) == 1 / sqrtf(2)); + + return 0; +} + +int zsignsTest() { + doubleComplex i = DoubleComplex(0., 1.); + doubleComplex oneAndI = DoubleComplex(1., 1.); + doubleComplex sign_i = zsigns(i); + doubleComplex sign_oneAndI = zsigns(oneAndI); + + printf(">> Double Complex\n"); + /* sign(%i) = %i */ + assert(zreals(sign_i) == 0); + assert(zimags(sign_i) == 1); + /* sign(1+%i) = (1+%i) / sqrt(2) */ + assert(zreals(sign_oneAndI) == sqrt(2) / 2); + assert(zimags(sign_oneAndI) == 1 / sqrt(2)); + + return 0; +} + + +int testSign() { + int ssignsTestStatus, dsignsTestStatus = 0; + int csignsTestStatus, zsignsTestStatus = 0; + printf("\n>>>> Sign Tests\n"); + ssignsTestStatus = ssignsTest(); + dsignsTestStatus = dsignsTest(); + csignsTestStatus = csignsTest(); + zsignsTestStatus = zsignsTest(); + + return (ssignsTestStatus + dsignsTestStatus + + csignsTestStatus + zsignsTestStatus); +} + +int main(void) { + assert(testSign() == 0); + return 0; +} diff --git a/src/auxiliaryFunctions/sign/testSign.h b/src/auxiliaryFunctions/sign/testSign.h new file mode 100644 index 00000000..214f28eb --- /dev/null +++ b/src/auxiliaryFunctions/sign/testSign.h @@ -0,0 +1,30 @@ +/* + * 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 + * + */ + +#ifndef __TESTSIGN_H__ +#define __TESTSIGN_H__ + +#include <stdio.h> +#include <assert.h> +#include "sign.h" + +int ssignsTest(void); + +int dsignsTest(void); + +int csignsTest(void); + +int zsignsTest(void); + +int testSign(void); + +#endif /* ! __TESTSIGN_H__ */ diff --git a/src/auxiliaryFunctions/sign/zsigna.c b/src/auxiliaryFunctions/sign/zsigna.c index cb6c13b7..eafbfbbf 100644 --- a/src/auxiliaryFunctions/sign/zsigna.c +++ b/src/auxiliaryFunctions/sign/zsigna.c @@ -1,24 +1,21 @@ /* -** -*- C -*- -** -** zsigna.c -** Made by Bruno JOFRET <bruno.jofret@inria.fr> -** -** Started on Fri Sep 7 17:38:11 2007 bruno -** Last update Fri Sep 7 17:38:36 2007 bruno -** -** Copyright INRIA 2007 -*/ + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007-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 "sign.h" -int zsigna(doubleComplex *in, int size) { +void zsigna(doubleComplex *in, int size, doubleComplex *out) { int i = 0; - int sign = 1; - /* FIXME : Does it what it's supposed to do ? */ for (i = 0 ; i < size ; ++i) { - sign = sign * zsigns(in[i]); + out[i] = zsigns(in[i]); } - return sign; } diff --git a/src/auxiliaryFunctions/sign/zsigns.c b/src/auxiliaryFunctions/sign/zsigns.c index ae1a960c..397cc33a 100644 --- a/src/auxiliaryFunctions/sign/zsigns.c +++ b/src/auxiliaryFunctions/sign/zsigns.c @@ -1,18 +1,18 @@ /* -** -*- C -*- -** -** zsigns.c -** Made by Bruno JOFRET <bruno.jofret@inria.fr> -** -** Started on Fri Sep 7 17:29:33 2007 bruno -** Last update Fri Sep 7 17:30:33 2007 bruno -** -** Copyright INRIA 2007 -*/ + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007-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 "sign.h" +#include "abs.h" -int zsigns(doubleComplex in) { -/* FIXME : Dummy... */ - return -1; +doubleComplex zsigns(doubleComplex in) { + return DoubleComplex(zreals(in) / zabss(in), zimags(in) / zabss(in)); } |