diff options
Diffstat (limited to 'gsl-1.9/diff')
-rw-r--r-- | gsl-1.9/diff/ChangeLog | 13 | ||||
-rw-r--r-- | gsl-1.9/diff/Makefile.am | 16 | ||||
-rw-r--r-- | gsl-1.9/diff/Makefile.in | 546 | ||||
-rw-r--r-- | gsl-1.9/diff/diff.c | 180 | ||||
-rw-r--r-- | gsl-1.9/diff/gsl_diff.h | 50 | ||||
-rw-r--r-- | gsl-1.9/diff/test.c | 195 |
6 files changed, 1000 insertions, 0 deletions
diff --git a/gsl-1.9/diff/ChangeLog b/gsl-1.9/diff/ChangeLog new file mode 100644 index 0000000..863e949 --- /dev/null +++ b/gsl-1.9/diff/ChangeLog @@ -0,0 +1,13 @@ +Mon Apr 23 13:26:21 2001 Brian Gough <bjg@network-theory.co.uk> + + * Makefile.am: removed demo from Makefile + + * test.c (test): changed return type to void + +Mon Feb 5 13:42:54 2001 Brian Gough <bjg@network-theory.co.uk> + + * diff.c: moved gradient calculating function into multimin since + it depends on multimin functions + + * test.c (main): tidied up the tests + diff --git a/gsl-1.9/diff/Makefile.am b/gsl-1.9/diff/Makefile.am new file mode 100644 index 0000000..bb1ad5b --- /dev/null +++ b/gsl-1.9/diff/Makefile.am @@ -0,0 +1,16 @@ +noinst_LTLIBRARIES = libgsldiff.la + +INCLUDES= -I$(top_builddir) + +libgsldiff_la_SOURCES = diff.c + +pkginclude_HEADERS = gsl_diff.h + +TESTS = $(check_PROGRAMS) +check_PROGRAMS = test #demo + +test_SOURCES = test.c +test_LDADD = libgsldiff.la ../vector/libgslvector.la ../block/libgslblock.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la + +#demo_SOURCES = demo.c +#demo_LDADD = libgsldiff.la ../vector/libgslvector.la ../block/libgslblock.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la diff --git a/gsl-1.9/diff/Makefile.in b/gsl-1.9/diff/Makefile.in new file mode 100644 index 0000000..efea5f7 --- /dev/null +++ b/gsl-1.9/diff/Makefile.in @@ -0,0 +1,546 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +check_PROGRAMS = test$(EXEEXT) +subdir = diff +DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in ChangeLog +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libgsldiff_la_LIBADD = +am_libgsldiff_la_OBJECTS = diff.lo +libgsldiff_la_OBJECTS = $(am_libgsldiff_la_OBJECTS) +am_test_OBJECTS = test.$(OBJEXT) +test_OBJECTS = $(am_test_OBJECTS) +test_DEPENDENCIES = libgsldiff.la ../vector/libgslvector.la \ + ../block/libgslblock.la ../ieee-utils/libgslieeeutils.la \ + ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = +am__depfiles_maybe = +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libgsldiff_la_SOURCES) $(test_SOURCES) +DIST_SOURCES = $(libgsldiff_la_SOURCES) $(test_SOURCES) +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(pkgincludedir)" +pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(pkginclude_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GSL_CFLAGS = @GSL_CFLAGS@ +GSL_LIBS = @GSL_LIBS@ +GSL_LT_CBLAS_VERSION = @GSL_LT_CBLAS_VERSION@ +GSL_LT_VERSION = @GSL_LT_VERSION@ +HAVE_AIX_IEEE_INTERFACE = @HAVE_AIX_IEEE_INTERFACE@ +HAVE_DARWIN86_IEEE_INTERFACE = @HAVE_DARWIN86_IEEE_INTERFACE@ +HAVE_DARWIN_IEEE_INTERFACE = @HAVE_DARWIN_IEEE_INTERFACE@ +HAVE_EXTENDED_PRECISION_REGISTERS = @HAVE_EXTENDED_PRECISION_REGISTERS@ +HAVE_FREEBSD_IEEE_INTERFACE = @HAVE_FREEBSD_IEEE_INTERFACE@ +HAVE_GNUM68K_IEEE_INTERFACE = @HAVE_GNUM68K_IEEE_INTERFACE@ +HAVE_GNUPPC_IEEE_INTERFACE = @HAVE_GNUPPC_IEEE_INTERFACE@ +HAVE_GNUSPARC_IEEE_INTERFACE = @HAVE_GNUSPARC_IEEE_INTERFACE@ +HAVE_GNUX86_IEEE_INTERFACE = @HAVE_GNUX86_IEEE_INTERFACE@ +HAVE_HPUX11_IEEE_INTERFACE = @HAVE_HPUX11_IEEE_INTERFACE@ +HAVE_HPUX_IEEE_INTERFACE = @HAVE_HPUX_IEEE_INTERFACE@ +HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ +HAVE_IEEE_DENORMALS = @HAVE_IEEE_DENORMALS@ +HAVE_INLINE = @HAVE_INLINE@ +HAVE_IRIX_IEEE_INTERFACE = @HAVE_IRIX_IEEE_INTERFACE@ +HAVE_NETBSD_IEEE_INTERFACE = @HAVE_NETBSD_IEEE_INTERFACE@ +HAVE_OPENBSD_IEEE_INTERFACE = @HAVE_OPENBSD_IEEE_INTERFACE@ +HAVE_OS2EMX_IEEE_INTERFACE = @HAVE_OS2EMX_IEEE_INTERFACE@ +HAVE_PRINTF_LONGDOUBLE = @HAVE_PRINTF_LONGDOUBLE@ +HAVE_SOLARIS_IEEE_INTERFACE = @HAVE_SOLARIS_IEEE_INTERFACE@ +HAVE_SUNOS4_IEEE_INTERFACE = @HAVE_SUNOS4_IEEE_INTERFACE@ +HAVE_TRU64_IEEE_INTERFACE = @HAVE_TRU64_IEEE_INTERFACE@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +RELEASED = @RELEASED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__leading_dot = @am__leading_dot@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +noinst_LTLIBRARIES = libgsldiff.la +INCLUDES = -I$(top_builddir) +libgsldiff_la_SOURCES = diff.c +pkginclude_HEADERS = gsl_diff.h +TESTS = $(check_PROGRAMS) +test_SOURCES = test.c +test_LDADD = libgsldiff.la ../vector/libgslvector.la ../block/libgslblock.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps diff/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu --ignore-deps diff/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_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 +libgsldiff.la: $(libgsldiff_la_OBJECTS) $(libgsldiff_la_DEPENDENCIES) + $(LINK) $(libgsldiff_la_LDFLAGS) $(libgsldiff_la_OBJECTS) $(libgsldiff_la_LIBADD) $(LIBS) + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +test$(EXEEXT): $(test_OBJECTS) $(test_DEPENDENCIES) + @rm -f test$(EXEEXT) + $(LINK) $(test_LDFLAGS) $(test_OBJECTS) $(test_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +.c.o: + $(COMPILE) -c $< + +.c.obj: + $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: + $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +install-pkgincludeHEADERS: $(pkginclude_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(pkgincludedir)" || $(mkdir_p) "$(DESTDIR)$(pkgincludedir)" + @list='$(pkginclude_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(pkgincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludedir)/$$f'"; \ + $(pkgincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludedir)/$$f"; \ + done + +uninstall-pkgincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(pkginclude_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pkgincludedir)/$$f'"; \ + rm -f "$(DESTDIR)$(pkgincludedir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list='$(TESTS)'; \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *" $$tst "*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + echo "XPASS: $$tst"; \ + ;; \ + *) \ + echo "PASS: $$tst"; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *" $$tst "*) \ + xfail=`expr $$xfail + 1`; \ + echo "XFAIL: $$tst"; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + echo "FAIL: $$tst"; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + echo "SKIP: $$tst"; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all tests failed"; \ + else \ + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + skipped="($$skip tests were not run)"; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(pkgincludedir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + clean-noinstLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-pkgincludeHEADERS + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-pkgincludeHEADERS + +.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool \ + clean-noinstLTLIBRARIES 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-exec install-exec-am \ + install-info install-info-am install-man \ + install-pkgincludeHEADERS 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-info-am \ + uninstall-pkgincludeHEADERS + + +#demo_SOURCES = demo.c +#demo_LDADD = libgsldiff.la ../vector/libgslvector.la ../block/libgslblock.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/gsl-1.9/diff/diff.c b/gsl-1.9/diff/diff.c new file mode 100644 index 0000000..83aae18 --- /dev/null +++ b/gsl-1.9/diff/diff.c @@ -0,0 +1,180 @@ +/* diff/diff.c + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 David Morrison + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include <config.h> +#include <stdlib.h> +#include <gsl/gsl_math.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_diff.h> + +int +gsl_diff_backward (const gsl_function * f, + double x, double *result, double *abserr) +{ + /* Construct a divided difference table with a fairly large step + size to get a very rough estimate of f''. Use this to estimate + the step size which will minimize the error in calculating f'. */ + + int i, k; + double h = GSL_SQRT_DBL_EPSILON; + double a[3], d[3], a2; + + /* Algorithm based on description on pg. 204 of Conte and de Boor + (CdB) - coefficients of Newton form of polynomial of degree 2. */ + + for (i = 0; i < 3; i++) + { + a[i] = x + (i - 2.0) * h; + d[i] = GSL_FN_EVAL (f, a[i]); + } + + for (k = 1; k < 4; k++) + { + for (i = 0; i < 3 - k; i++) + { + d[i] = (d[i + 1] - d[i]) / (a[i + k] - a[i]); + } + } + + /* Adapt procedure described on pg. 282 of CdB to find best value of + step size. */ + + a2 = fabs (d[0] + d[1] + d[2]); + + if (a2 < 100.0 * GSL_SQRT_DBL_EPSILON) + { + a2 = 100.0 * GSL_SQRT_DBL_EPSILON; + } + + h = sqrt (GSL_SQRT_DBL_EPSILON / (2.0 * a2)); + + if (h > 100.0 * GSL_SQRT_DBL_EPSILON) + { + h = 100.0 * GSL_SQRT_DBL_EPSILON; + } + + *result = (GSL_FN_EVAL (f, x) - GSL_FN_EVAL (f, x - h)) / h; + *abserr = fabs (10.0 * a2 * h); + + return GSL_SUCCESS; +} + +int +gsl_diff_forward (const gsl_function * f, + double x, double *result, double *abserr) +{ + /* Construct a divided difference table with a fairly large step + size to get a very rough estimate of f''. Use this to estimate + the step size which will minimize the error in calculating f'. */ + + int i, k; + double h = GSL_SQRT_DBL_EPSILON; + double a[3], d[3], a2; + + /* Algorithm based on description on pg. 204 of Conte and de Boor + (CdB) - coefficients of Newton form of polynomial of degree 2. */ + + for (i = 0; i < 3; i++) + { + a[i] = x + i * h; + d[i] = GSL_FN_EVAL (f, a[i]); + } + + for (k = 1; k < 4; k++) + { + for (i = 0; i < 3 - k; i++) + { + d[i] = (d[i + 1] - d[i]) / (a[i + k] - a[i]); + } + } + + /* Adapt procedure described on pg. 282 of CdB to find best value of + step size. */ + + a2 = fabs (d[0] + d[1] + d[2]); + + if (a2 < 100.0 * GSL_SQRT_DBL_EPSILON) + { + a2 = 100.0 * GSL_SQRT_DBL_EPSILON; + } + + h = sqrt (GSL_SQRT_DBL_EPSILON / (2.0 * a2)); + + if (h > 100.0 * GSL_SQRT_DBL_EPSILON) + { + h = 100.0 * GSL_SQRT_DBL_EPSILON; + } + + *result = (GSL_FN_EVAL (f, x + h) - GSL_FN_EVAL (f, x)) / h; + *abserr = fabs (10.0 * a2 * h); + + return GSL_SUCCESS; +} + +int +gsl_diff_central (const gsl_function * f, + double x, double *result, double *abserr) +{ + /* Construct a divided difference table with a fairly large step + size to get a very rough estimate of f'''. Use this to estimate + the step size which will minimize the error in calculating f'. */ + + int i, k; + double h = GSL_SQRT_DBL_EPSILON; + double a[4], d[4], a3; + + /* Algorithm based on description on pg. 204 of Conte and de Boor + (CdB) - coefficients of Newton form of polynomial of degree 3. */ + + for (i = 0; i < 4; i++) + { + a[i] = x + (i - 2.0) * h; + d[i] = GSL_FN_EVAL (f, a[i]); + } + + for (k = 1; k < 5; k++) + { + for (i = 0; i < 4 - k; i++) + { + d[i] = (d[i + 1] - d[i]) / (a[i + k] - a[i]); + } + } + + /* Adapt procedure described on pg. 282 of CdB to find best + value of step size. */ + + a3 = fabs (d[0] + d[1] + d[2] + d[3]); + + if (a3 < 100.0 * GSL_SQRT_DBL_EPSILON) + { + a3 = 100.0 * GSL_SQRT_DBL_EPSILON; + } + + h = pow (GSL_SQRT_DBL_EPSILON / (2.0 * a3), 1.0 / 3.0); + + if (h > 100.0 * GSL_SQRT_DBL_EPSILON) + { + h = 100.0 * GSL_SQRT_DBL_EPSILON; + } + + *result = (GSL_FN_EVAL (f, x + h) - GSL_FN_EVAL (f, x - h)) / (2.0 * h); + *abserr = fabs (100.0 * a3 * h * h); + + return GSL_SUCCESS; +} diff --git a/gsl-1.9/diff/gsl_diff.h b/gsl-1.9/diff/gsl_diff.h new file mode 100644 index 0000000..4080f7e --- /dev/null +++ b/gsl-1.9/diff/gsl_diff.h @@ -0,0 +1,50 @@ +/* diff/gsl_diff.h + * + * Copyright (C) 2000 David Morrison + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_DIFF_H__ +#define __GSL_DIFF_H__ +#include <gsl/gsl_math.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_diff_central (const gsl_function *f, + double x, + double *result, double *abserr); + +int gsl_diff_backward (const gsl_function *f, + double x, + double *result, double *abserr); + +int gsl_diff_forward (const gsl_function *f, + double x, + double *result, double *abserr); + +__END_DECLS + +#endif /* __GSL_DIFF_H__ */ diff --git a/gsl-1.9/diff/test.c b/gsl-1.9/diff/test.c new file mode 100644 index 0000000..0e6f696 --- /dev/null +++ b/gsl-1.9/diff/test.c @@ -0,0 +1,195 @@ +/* diff/test.c + * + * Copyright (C) 2000 David Morrison + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include <config.h> +#include <stdlib.h> +#include <stdio.h> +#include <math.h> +#include <gsl/gsl_math.h> +#include <gsl/gsl_diff.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_test.h> +#include <gsl/gsl_ieee_utils.h> + +double +f1 (double x, void *params) +{ + return exp (x); +} + +double +df1 (double x, void *params) +{ + return exp (x); +} + +double +f2 (double x, void *params) +{ + if (x >= 0.0) + { + return x * sqrt (x); + } + else + { + return 0.0; + } +} + +double +df2 (double x, void *params) +{ + if (x >= 0.0) + { + return 1.5 * sqrt (x); + } + else + { + return 0.0; + } +} + +double +f3 (double x, void *params) +{ + if (x != 0.0) + { + return sin (1 / x); + } + else + { + return 0.0; + } +} + +double +df3 (double x, void *params) +{ + if (x != 0.0) + { + return -cos (1 / x) / (x * x); + } + else + { + return 0.0; + } +} + +double +f4 (double x, void *params) +{ + return exp (-x * x); +} + +double +df4 (double x, void *params) +{ + return -2.0 * x * exp (-x * x); +} + +double +f5 (double x, void *params) +{ + return x * x; +} + +double +df5 (double x, void *params) +{ + return 2.0 * x; +} + +double +f6 (double x, void *params) +{ + return 1.0 / x; +} + +double +df6 (double x, void *params) +{ + return -1.0 / (x * x); +} + +typedef int (diff_fn) (const gsl_function * f, double x, double * res, double *abserr); + +void +test (diff_fn * diff, gsl_function * f, gsl_function * df, double x, + const char * desc) +{ + double result, abserr; + double expected = GSL_FN_EVAL (df, x); + (*diff) (f, x, &result, &abserr); + gsl_test_abs (result, expected, abserr, desc); + gsl_test (fabs(result-expected) > abserr, "%s, valid error estimate", desc); +} + +int +main () +{ + gsl_function F1, DF1, F2, DF2, F3, DF3, F4, DF4, F5, DF5, F6, DF6; + + gsl_ieee_env_setup (); + + F1.function = &f1; + DF1.function = &df1; + + F2.function = &f2; + DF2.function = &df2; + + F3.function = &f3; + DF3.function = &df3; + + F4.function = &f4; + DF4.function = &df4; + + F5.function = &f5; + DF5.function = &df5; + + F6.function = &f6; + DF6.function = &df6; + + test (&gsl_diff_central, &F1, &DF1, 1.0, "exp(x), x=1, central diff"); + test (&gsl_diff_forward, &F1, &DF1, 1.0, "exp(x), x=1, forward diff"); + test (&gsl_diff_backward, &F1, &DF1, 1.0, "exp(x), x=1, backward diff"); + + test (&gsl_diff_central, &F2, &DF2, 0.1, "x^(3/2), x=0.1, central diff"); + test (&gsl_diff_forward, &F2, &DF2, 0.1, "x^(3/2), x=0.1, forward diff"); + test (&gsl_diff_backward, &F2, &DF2, 0.1, "x^(3/2), x=0.1, backward diff"); + + test (&gsl_diff_central, &F3, &DF3, 0.45, "sin(1/x), x=0.45, central diff"); + test (&gsl_diff_forward, &F3, &DF3, 0.45, "sin(1/x), x=0.45, forward diff"); + test (&gsl_diff_backward, &F3, &DF3, 0.45, "sin(1/x), x=0.45, backward diff"); + + test (&gsl_diff_central, &F4, &DF4, 0.5, "exp(-x^2), x=0.5, central diff"); + test (&gsl_diff_forward, &F4, &DF4, 0.5, "exp(-x^2), x=0.5, forward diff"); + test (&gsl_diff_backward, &F4, &DF4, 0.5, "exp(-x^2), x=0.5, backward diff"); + + test (&gsl_diff_central, &F5, &DF5, 0.0, "x^2, x=0, central diff"); + test (&gsl_diff_forward, &F5, &DF5, 0.0, "x^2, x=0, forward diff"); + test (&gsl_diff_backward, &F5, &DF5, 0.0, "x^2, x=0, backward diff"); + + test (&gsl_diff_central, &F6, &DF6, 10.0, "1/x, x=10, central diff"); + test (&gsl_diff_forward, &F6, &DF6, 10.0, "1/x, x=10, forward diff"); + test (&gsl_diff_backward, &F6, &DF6, 10.0, "1/x, x=10, backward diff"); + + exit (gsl_test_summary ()); +} + + |