summaryrefslogtreecommitdiff
path: root/gsl-1.9/cheb
diff options
context:
space:
mode:
Diffstat (limited to 'gsl-1.9/cheb')
-rw-r--r--gsl-1.9/cheb/ChangeLog54
-rw-r--r--gsl-1.9/cheb/Makefile.am17
-rw-r--r--gsl-1.9/cheb/Makefile.in543
-rw-r--r--gsl-1.9/cheb/deriv.c63
-rw-r--r--gsl-1.9/cheb/eval.c206
-rw-r--r--gsl-1.9/cheb/gsl_chebyshev.h129
-rw-r--r--gsl-1.9/cheb/init.c101
-rw-r--r--gsl-1.9/cheb/integ.c65
-rw-r--r--gsl-1.9/cheb/test.c208
9 files changed, 1386 insertions, 0 deletions
diff --git a/gsl-1.9/cheb/ChangeLog b/gsl-1.9/cheb/ChangeLog
new file mode 100644
index 0000000..7465d7e
--- /dev/null
+++ b/gsl-1.9/cheb/ChangeLog
@@ -0,0 +1,54 @@
+2007-01-29 Brian Gough <bjg@network-theory.co.uk>
+
+ * eval.c (gsl_cheb_eval_mode_e): compute error consistently with
+ other routines
+
+2004-12-29 Brian Gough <bjg@network-theory.co.uk>
+
+ * gsl_chebyshev.h: added const to declaration of
+ gsl_cheb_eval_mode to match definition
+
+2004-12-24 Brian Gough <bjg@network-theory.co.uk>
+
+ * eval.c (gsl_cheb_eval_n_err): use eval_order instead of
+ cs->order for error estimate
+
+2004-12-23 Brian Gough <bjg@network-theory.co.uk>
+
+ * eval.c (gsl_cheb_eval_mode): added missing function
+
+2004-08-27 Brian Gough <bjg@network-theory.co.uk>
+
+ * test.c (main): make the hard-coded tolerances a variable, ftol
+
+2003-06-09 Brian Gough <bjg@network-theory.co.uk>
+
+ * test.c (main): added some tests for the coefficients
+
+2003-02-09 Brian Gough <bjg@network-theory.co.uk>
+
+ * gsl_chebyshev.h: added missing #include for gsl_math (to declare
+ gsl_function) fixes Debian Bug#179665
+
+Fri May 24 19:23:47 2002 Brian Gough <bjg@network-theory.co.uk>
+
+ * init.c (gsl_cheb_free): added missing free() for cs->f
+
+Fri Aug 24 19:18:23 2001 Brian Gough <bjg@network-theory.co.uk>
+
+ * test.c (main): renamed fsin to f_sin to avoid conflicts with
+ irix math libs.
+
+Sun May 6 09:49:28 2001 Brian Gough <bjg@network-theory.co.uk>
+
+ * eval.c (gsl_cheb_eval_err): take roundoff into account when
+ computing evaluation error (important when result is near zero).
+ (gsl_cheb_eval_n_err): ditto
+
+Tue Apr 24 17:08:29 2001 Brian Gough <bjg@network-theory.co.uk>
+
+ * made deriv/integ functions thread safe
+
+ * split out from specfunc directory
+
+
diff --git a/gsl-1.9/cheb/Makefile.am b/gsl-1.9/cheb/Makefile.am
new file mode 100644
index 0000000..cf28e27
--- /dev/null
+++ b/gsl-1.9/cheb/Makefile.am
@@ -0,0 +1,17 @@
+noinst_LTLIBRARIES = libgslcheb.la
+
+pkginclude_HEADERS = gsl_chebyshev.h
+
+INCLUDES= -I$(top_builddir)
+
+libgslcheb_la_SOURCES = deriv.c eval.c init.c integ.c
+
+TESTS = $(check_PROGRAMS)
+
+check_PROGRAMS = test
+
+test_LDADD = libgslcheb.la ../ieee-utils/libgslieeeutils.la ../test/libgsltest.la ../sys/libgslsys.la ../err/libgslerr.la ../utils/libutils.la
+
+test_SOURCES = test.c
+
+
diff --git a/gsl-1.9/cheb/Makefile.in b/gsl-1.9/cheb/Makefile.in
new file mode 100644
index 0000000..b2a8bda
--- /dev/null
+++ b/gsl-1.9/cheb/Makefile.in
@@ -0,0 +1,543 @@
+# 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 = cheb
+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)
+libgslcheb_la_LIBADD =
+am_libgslcheb_la_OBJECTS = deriv.lo eval.lo init.lo integ.lo
+libgslcheb_la_OBJECTS = $(am_libgslcheb_la_OBJECTS)
+am_test_OBJECTS = test.$(OBJEXT)
+test_OBJECTS = $(am_test_OBJECTS)
+test_DEPENDENCIES = libgslcheb.la ../ieee-utils/libgslieeeutils.la \
+ ../test/libgsltest.la ../sys/libgslsys.la ../err/libgslerr.la \
+ ../utils/libutils.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 = $(libgslcheb_la_SOURCES) $(test_SOURCES)
+DIST_SOURCES = $(libgslcheb_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 = libgslcheb.la
+pkginclude_HEADERS = gsl_chebyshev.h
+INCLUDES = -I$(top_builddir)
+libgslcheb_la_SOURCES = deriv.c eval.c init.c integ.c
+TESTS = $(check_PROGRAMS)
+test_LDADD = libgslcheb.la ../ieee-utils/libgslieeeutils.la ../test/libgsltest.la ../sys/libgslsys.la ../err/libgslerr.la ../utils/libutils.la
+test_SOURCES = test.c
+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 cheb/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps cheb/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
+libgslcheb.la: $(libgslcheb_la_OBJECTS) $(libgslcheb_la_DEPENDENCIES)
+ $(LINK) $(libgslcheb_la_LDFLAGS) $(libgslcheb_la_OBJECTS) $(libgslcheb_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
+
+# 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/cheb/deriv.c b/gsl-1.9/cheb/deriv.c
new file mode 100644
index 0000000..57c22df
--- /dev/null
+++ b/gsl-1.9/cheb/deriv.c
@@ -0,0 +1,63 @@
+/* cheb/deriv.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman
+ *
+ * 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_chebyshev.h>
+
+int gsl_cheb_calc_deriv(gsl_cheb_series * deriv, const gsl_cheb_series * f)
+{
+ const size_t n = f->order + 1;
+ const double con = 2.0 / (f->b - f->a);
+ size_t i;
+
+ if(deriv->order != f->order)
+ {
+ GSL_ERROR ("order of chebyshev series must be equal", GSL_ENOMEM);
+ }
+
+ /* set the other parameters in the chebyshev struct */
+
+ deriv->a = f->a;
+ deriv->b = f->b;
+
+#ifdef ERR
+ deriv->err = n * n * f->c[n-1]; /* error in derivative is n^2 c_n */
+#endif
+
+ /* FIXME: should probably set deriv->f[] as well */
+
+ deriv->c[n-1] = 0.0;
+
+ if(n > 1) {
+ deriv->c[n-2] = 2.0 *(n-1.0) * f->c[n-1];
+
+ for(i = n-3; i>0; i--)
+ deriv->c[i] = deriv->c[i+2] + 2.0 *(i+1.0) * f->c[i+1];
+
+ deriv->c[0] = deriv->c[2] + 2.0 * f->c[1];
+
+ for(i = 0 ; i<n ; i++)
+ deriv->c[i] *= con;
+ }
+
+ return GSL_SUCCESS;
+}
diff --git a/gsl-1.9/cheb/eval.c b/gsl-1.9/cheb/eval.c
new file mode 100644
index 0000000..9d5acda
--- /dev/null
+++ b/gsl-1.9/cheb/eval.c
@@ -0,0 +1,206 @@
+/* cheb/eval.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman
+ *
+ * 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_chebyshev.h>
+
+/* For efficiency there are separate implementations of each of these
+ functions */
+
+double
+gsl_cheb_eval (const gsl_cheb_series * cs, const double x)
+{
+ size_t i;
+ double d1 = 0.0;
+ double d2 = 0.0;
+
+ double y = (2.0 * x - cs->a - cs->b) / (cs->b - cs->a);
+ double y2 = 2.0 * y;
+
+ for (i = cs->order; i >= 1; i--)
+ {
+ double temp = d1;
+ d1 = y2 * d1 - d2 + cs->c[i];
+ d2 = temp;
+ }
+
+ return y * d1 - d2 + 0.5 * cs->c[0];
+}
+
+double
+gsl_cheb_eval_n (const gsl_cheb_series * cs, const size_t n, const double x)
+{
+ size_t i;
+ double d1 = 0.0;
+ double d2 = 0.0;
+
+ size_t eval_order = GSL_MIN (n, cs->order);
+
+ double y = (2.0 * x - cs->a - cs->b) / (cs->b - cs->a);
+ double y2 = 2.0 * y;
+
+ for (i = eval_order; i >= 1; i--)
+ {
+ double temp = d1;
+ d1 = y2 * d1 - d2 + cs->c[i];
+ d2 = temp;
+ }
+
+ return y * d1 - d2 + 0.5 * cs->c[0];
+}
+
+
+int
+gsl_cheb_eval_err (const gsl_cheb_series * cs, const double x,
+ double *result, double *abserr)
+{
+ size_t i;
+ double d1 = 0.0;
+ double d2 = 0.0;
+
+ double y = (2. * x - cs->a - cs->b) / (cs->b - cs->a);
+ double y2 = 2.0 * y;
+
+ double absc = 0.0;
+
+ for (i = cs->order; i >= 1; i--)
+ {
+ double temp = d1;
+ d1 = y2 * d1 - d2 + cs->c[i];
+ d2 = temp;
+ }
+
+ *result = y * d1 - d2 + 0.5 * cs->c[0];
+
+ /* Estimate cumulative numerical error */
+
+ for (i = 0; i <= cs->order; i++)
+ {
+ absc += fabs(cs->c[i]);
+ }
+
+ /* Combine truncation error and numerical error */
+
+ *abserr = fabs (cs->c[cs->order]) + absc * GSL_DBL_EPSILON;
+
+ return GSL_SUCCESS;
+}
+
+int
+gsl_cheb_eval_n_err (const gsl_cheb_series * cs,
+ const size_t n, const double x,
+ double *result, double *abserr)
+{
+ size_t i;
+ double d1 = 0.0;
+ double d2 = 0.0;
+
+ double y = (2. * x - cs->a - cs->b) / (cs->b - cs->a);
+ double y2 = 2.0 * y;
+
+ double absc = 0.0;
+
+ size_t eval_order = GSL_MIN (n, cs->order);
+
+ for (i = eval_order; i >= 1; i--)
+ {
+ double temp = d1;
+ d1 = y2 * d1 - d2 + cs->c[i];
+ d2 = temp;
+ }
+
+ *result = y * d1 - d2 + 0.5 * cs->c[0];
+
+ /* Estimate cumulative numerical error */
+
+ for (i = 0; i <= eval_order; i++)
+ {
+ absc += fabs(cs->c[i]);
+ }
+
+ /* Combine truncation error and numerical error */
+
+ *abserr = fabs (cs->c[eval_order]) + absc * GSL_DBL_EPSILON;
+
+ return GSL_SUCCESS;
+}
+
+int
+gsl_cheb_eval_mode_e (const gsl_cheb_series * cs,
+ const double x, gsl_mode_t mode,
+ double *result, double *abserr)
+{
+ size_t i;
+ double d1 = 0.0;
+ double d2 = 0.0;
+
+ double y = (2. * x - cs->a - cs->b) / (cs->b - cs->a);
+ double y2 = 2.0 * y;
+
+ double absc = 0.0;
+
+ size_t eval_order;
+
+ if (GSL_MODE_PREC (mode) == GSL_PREC_DOUBLE)
+ eval_order = cs->order;
+ else
+ eval_order = cs->order_sp;
+
+ for (i = eval_order; i >= 1; i--)
+ {
+ double temp = d1;
+ d1 = y2 * d1 - d2 + cs->c[i];
+ d2 = temp;
+ }
+
+ *result = y * d1 - d2 + 0.5 * cs->c[0];
+
+ /* Estimate cumulative numerical error */
+
+ for (i = 0; i <= eval_order; i++)
+ {
+ absc += fabs(cs->c[i]);
+ }
+
+ /* Combine truncation error and numerical error */
+
+ *abserr = fabs (cs->c[eval_order]) + absc * GSL_DBL_EPSILON;
+
+ return GSL_SUCCESS;
+}
+
+double
+gsl_cheb_eval_mode (const gsl_cheb_series * cs,
+ const double x, gsl_mode_t mode)
+{
+ double result, abserr;
+ int status = gsl_cheb_eval_mode_e (cs, x, mode, &result, &abserr);
+
+ if (status != GSL_SUCCESS)
+ {
+ GSL_ERROR_VAL("gsl_cheb_eval_mode", status, result);
+ };
+
+ return result;
+}
+
+
diff --git a/gsl-1.9/cheb/gsl_chebyshev.h b/gsl-1.9/cheb/gsl_chebyshev.h
new file mode 100644
index 0000000..2557908
--- /dev/null
+++ b/gsl-1.9/cheb/gsl_chebyshev.h
@@ -0,0 +1,129 @@
+/* cheb/gsl_chebyshev.h
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman
+ *
+ * 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_CHEBYSHEV_H__
+#define __GSL_CHEBYSHEV_H__
+
+#include <gsl/gsl_math.h>
+#include <gsl/gsl_mode.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
+
+
+/* data for a Chebyshev series over a given interval */
+
+struct gsl_cheb_series_struct {
+
+ double * c; /* coefficients */
+ size_t order; /* order of expansion */
+ double a; /* lower interval point */
+ double b; /* upper interval point */
+
+ /* The following exists (mostly) for the benefit
+ * of the implementation. It is an effective single
+ * precision order, for use in single precision
+ * evaluation. Users can use it if they like, but
+ * only they know how to calculate it, since it is
+ * specific to the approximated function. By default,
+ * order_sp = order.
+ * It is used explicitly only by the gsl_cheb_eval_mode
+ * functions, which are not meant for casual use.
+ */
+ size_t order_sp;
+
+ /* Additional elements not used by specfunc */
+
+ double * f; /* function evaluated at chebyschev points */
+};
+typedef struct gsl_cheb_series_struct gsl_cheb_series;
+
+
+/* Calculate a Chebyshev series of specified order over
+ * a specified interval, for a given function.
+ * Return 0 on failure.
+ */
+gsl_cheb_series * gsl_cheb_alloc(const size_t order);
+
+/* Free a Chebyshev series previously calculated with gsl_cheb_alloc().
+ */
+void gsl_cheb_free(gsl_cheb_series * cs);
+
+/* Calculate a Chebyshev series using the storage provided.
+ * Uses the interval (a,b) and the order with which it
+ * was initially created.
+ *
+ */
+int gsl_cheb_init(gsl_cheb_series * cs, const gsl_function * func,
+ const double a, const double b);
+
+
+/* Evaluate a Chebyshev series at a given point.
+ * No errors can occur for a struct obtained from gsl_cheb_new().
+ */
+double gsl_cheb_eval(const gsl_cheb_series * cs, const double x);
+int gsl_cheb_eval_err(const gsl_cheb_series * cs, const double x,
+ double * result, double * abserr);
+
+
+/* Evaluate a Chebyshev series at a given point, to (at most) the given order.
+ * No errors can occur for a struct obtained from gsl_cheb_new().
+ */
+double gsl_cheb_eval_n(const gsl_cheb_series * cs, const size_t order,
+ const double x);
+int gsl_cheb_eval_n_err(const gsl_cheb_series * cs, const size_t order,
+ const double x, double * result, double * abserr);
+
+
+/* Evaluate a Chebyshev series at a given point, using the default
+ * order for double precision mode(s) and the single precision
+ * order for other modes.
+ * No errors can occur for a struct obtained from gsl_cheb_new().
+ */
+double gsl_cheb_eval_mode(const gsl_cheb_series * cs, const double x, gsl_mode_t mode);
+int gsl_cheb_eval_mode_e(const gsl_cheb_series * cs, const double x, gsl_mode_t mode, double * result, double * abserr);
+
+
+
+/* Compute the derivative of a Chebyshev series.
+ */
+int gsl_cheb_calc_deriv(gsl_cheb_series * deriv, const gsl_cheb_series * cs);
+
+/* Compute the integral of a Chebyshev series. The
+ * integral is fixed by the condition that it equals zero at
+ * the left end-point, ie it is precisely
+ * Integrate[cs(t; a,b), {t, a, x}]
+ */
+int gsl_cheb_calc_integ(gsl_cheb_series * integ, const gsl_cheb_series * cs);
+
+
+
+
+__END_DECLS
+
+#endif /* __GSL_CHEBYSHEV_H__ */
diff --git a/gsl-1.9/cheb/init.c b/gsl-1.9/cheb/init.c
new file mode 100644
index 0000000..9b42021
--- /dev/null
+++ b/gsl-1.9/cheb/init.c
@@ -0,0 +1,101 @@
+/* cheb/init.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman
+ *
+ * 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_chebyshev.h>
+
+/*-*-*-*-*-*-*-*-*-*-*-* Allocators *-*-*-*-*-*-*-*-*-*-*-*/
+
+gsl_cheb_series *
+gsl_cheb_alloc(const size_t order)
+{
+ gsl_cheb_series * cs = (gsl_cheb_series *) malloc(sizeof(gsl_cheb_series));
+
+ if(cs == 0) {
+ GSL_ERROR_VAL("failed to allocate gsl_cheb_series struct", GSL_ENOMEM, 0);
+ }
+
+ cs->order = order;
+ cs->order_sp = order;
+
+ cs->c = (double *) malloc((order+1) * sizeof(double));
+
+ if(cs->c == 0) {
+ GSL_ERROR_VAL("failed to allocate cheb coefficients", GSL_ENOMEM, 0);
+ }
+
+ cs->f = (double *) malloc((order+1) * sizeof(double));
+
+ if(cs->f == 0) {
+ GSL_ERROR_VAL("failed to allocate cheb function space", GSL_ENOMEM, 0);
+ }
+
+ return cs;
+}
+
+
+void gsl_cheb_free(gsl_cheb_series * cs)
+{
+ free(cs->f);
+ free(cs->c);
+ free(cs);
+}
+
+/*-*-*-*-*-*-*-*-*-*-*-* Initializer *-*-*-*-*-*-*-*-*-*-*-*/
+
+int gsl_cheb_init(gsl_cheb_series * cs, const gsl_function *func,
+ const double a, const double b)
+{
+ size_t k, j;
+
+ if(a >= b) {
+ GSL_ERROR_VAL("null function interval [a,b]", GSL_EDOM, 0);
+ }
+ cs->a = a;
+ cs->b = b;
+ /* cs->err = 0.0; */
+
+ {
+ double bma = 0.5 * (cs->b - cs->a);
+ double bpa = 0.5 * (cs->b + cs->a);
+ double fac = 2.0/(cs->order +1.0);
+
+ for(k = 0; k<=cs->order; k++) {
+ double y = cos(M_PI * (k+0.5)/(cs->order+1));
+ cs->f[k] = GSL_FN_EVAL(func, (y*bma + bpa));
+ }
+
+ for(j = 0; j<=cs->order; j++) {
+ double sum = 0.0;
+ for(k = 0; k<=cs->order; k++)
+ sum += cs->f[k]*cos(M_PI * j*(k+0.5)/(cs->order+1));
+ cs->c[j] = fac * sum;
+ }
+
+ }
+ return GSL_SUCCESS;
+}
+
+
+
+
+
diff --git a/gsl-1.9/cheb/integ.c b/gsl-1.9/cheb/integ.c
new file mode 100644
index 0000000..0f49dd9
--- /dev/null
+++ b/gsl-1.9/cheb/integ.c
@@ -0,0 +1,65 @@
+/* cheb/integ.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman
+ *
+ * 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_chebyshev.h>
+
+int gsl_cheb_calc_integ(gsl_cheb_series * integ, const gsl_cheb_series * f)
+{
+ const size_t n = f->order + 1;
+ const double con = 0.25 * (f->b - f->a);
+
+ if(integ->order != f->order)
+ {
+ GSL_ERROR ("order of chebyshev series must be equal", GSL_ENOMEM);
+ }
+
+ /* set the other parameters in the chebyshev struct */
+
+ integ->a = f->a;
+ integ->b = f->b;
+
+ /* FIXME: should probably set integ->f[] as well */
+
+ if(n == 1) {
+ integ->c[0] = 0.;
+ }
+ else if(n == 2) {
+ integ->c[1] = con * f->c[0];
+ integ->c[0] = 2.0 * integ->c[1];
+ }
+ else {
+ double sum = 0.0;
+ double fac = 1.0;
+ size_t i;
+ for(i=1; i<=n-2; i++) {
+ integ->c[i] = con * (f->c[i-1] - f->c[i+1])/((double)i);
+ sum += fac * integ->c[i];
+ fac = -fac;
+ }
+ integ->c[n-1] = con * f->c[n-2]/(n-1.0);
+ sum += fac * integ->c[n-1];
+ integ->c[0] = 2.0 * sum;
+ }
+
+ return GSL_SUCCESS;
+}
diff --git a/gsl-1.9/cheb/test.c b/gsl-1.9/cheb/test.c
new file mode 100644
index 0000000..7c27d84
--- /dev/null
+++ b/gsl-1.9/cheb/test.c
@@ -0,0 +1,208 @@
+/* cheb/test.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman
+ *
+ * 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_test.h>
+#include <gsl/gsl_ieee_utils.h>
+#include <gsl/gsl_chebyshev.h>
+
+double f_T0 (double x, void * p) {
+ p = 0;
+ return 1.0;
+}
+
+double f_T1 (double x, void * p) {
+ p = 0;
+ return x;
+}
+
+double f_T2 (double x, void * p) {
+ p = 0;
+ return 2*x*x - 1;
+}
+
+double f_sin (double x, void * p) {
+ p = 0;
+ return sin(x);
+}
+
+int
+main(void)
+{
+ double tol = 100.0 * GSL_DBL_EPSILON;
+ double ftol = 20.0;
+ double x;
+ size_t i;
+
+ gsl_cheb_series * cs = gsl_cheb_alloc(40);
+ gsl_cheb_series * csd = gsl_cheb_alloc(40);
+ gsl_cheb_series * csi = gsl_cheb_alloc(40);
+
+ gsl_function F_sin, F_T0, F_T1, F_T2;
+
+ F_sin.function = f_sin;
+ F_sin.params = 0;
+
+ F_T0.function = f_T0;
+ F_T0.params = 0;
+
+ F_T1.function = f_T1;
+ F_T1.params = 0;
+
+ F_T2.function = f_T2;
+ F_T2.params = 0;
+
+ gsl_ieee_env_setup();
+
+ gsl_cheb_init(cs, &F_T0, -1.0, 1.0);
+
+ for (i = 0; i<cs->order; i++)
+ {
+ double c_exp = (i == 0) ? 2.0 : 0.0;
+ gsl_test_abs (cs->c[i], c_exp, tol, "c[%d] for T_0(x)", i);
+ }
+
+ gsl_cheb_init(cs, &F_T1, -1.0, 1.0);
+
+ for (i = 0; i<cs->order; i++)
+ {
+ double c_exp = (i == 1) ? 1.0 : 0.0;
+ gsl_test_abs (cs->c[i], c_exp, tol, "c[%d] for T_1(x)", i);
+ }
+
+ gsl_cheb_init(cs, &F_T2, -1.0, 1.0);
+
+ for (i = 0; i<cs->order; i++)
+ {
+ double c_exp = (i == 2) ? 1.0 : 0.0;
+ gsl_test_abs (cs->c[i], c_exp, tol, "c[%d] for T_2(x)", i);
+ }
+
+ gsl_cheb_init(cs, &F_sin, -M_PI, M_PI);
+
+ gsl_test_abs (cs->c[0], 0.0, tol, "c[0] for F_sin(x)");
+ gsl_test_abs (cs->c[1], 5.69230686359506e-01, tol, "c[1] for F_sin(x)");
+ gsl_test_abs (cs->c[2], 0.0, tol, "c[2] for F_sin(x)");
+ gsl_test_abs (cs->c[3], -6.66916672405979e-01, tol, "c[3] for F_sin(x)");
+ gsl_test_abs (cs->c[4], 0.0, tol, "c[4] for F_sin(x)");
+ gsl_test_abs (cs->c[5], 1.04282368734237e-01, tol, "c[5] for F_sin(x)");
+
+ for(x=-M_PI; x<M_PI; x += M_PI/100.0) {
+ double r = gsl_cheb_eval(cs, x);
+ gsl_test_abs(r, sin(x), tol, "gsl_cheb_eval, sin(%.3g)", x);
+ }
+
+ for(x=-M_PI; x<M_PI; x += M_PI/100.0) {
+ double r, e;
+ gsl_cheb_eval_err(cs, x, &r, &e);
+ gsl_test_abs(r, sin(x), tol, "gsl_cheb_eval_err, sin(%.3g)", x);
+ gsl_test_factor(fabs(r-sin(x)) + GSL_DBL_EPSILON, e, ftol,
+ "gsl_cheb_eval_err, error sin(%.3g)", x);
+ }
+
+ for(x=-M_PI; x<M_PI; x += M_PI/100.0) {
+ double r = gsl_cheb_eval_n(cs, 25, x);
+ gsl_test_abs(r, sin(x), tol, "gsl_cheb_eval_n, sin(%.3g)", x);
+ }
+
+ for(x=-M_PI; x<M_PI; x += M_PI/100.0) {
+ double r, e;
+ gsl_cheb_eval_n_err(cs, 25, x, &r, &e);
+ gsl_test_abs(r, sin(x), 100.0 * tol, "gsl_cheb_eval_n_err, deriv sin(%.3g)", x);
+ gsl_test_factor(fabs(r-sin(x)) + GSL_DBL_EPSILON, e, ftol,
+ "gsl_cheb_eval_n_err, error sin(%.3g)", x);
+ }
+
+ /* Test derivative */
+
+ gsl_cheb_calc_deriv(csd, cs);
+
+ for(x=-M_PI; x<M_PI; x += M_PI/100.0) {
+ double r = gsl_cheb_eval(csd, x);
+ gsl_test_abs(r, cos(x), 1600 * tol, "gsl_cheb_eval, deriv sin(%.3g)", x);
+ }
+
+#ifdef TEST_DERIVATIVE_ERR
+ for(x=-M_PI; x<M_PI; x += M_PI/100.0) {
+ double r, e;
+ gsl_cheb_eval_err(csd, x, &r, &e);
+ gsl_test_abs(r, cos(x), tol, "gsl_cheb_eval_err, deriv sin(%.3g)", x);
+ gsl_test_factor(fabs(r-cos(x)) + GSL_DBL_EPSILON, e, ftol,
+ "gsl_cheb_eval_err, deriv error sin(%.3g)", x);
+ }
+#endif
+
+ for(x=-M_PI; x<M_PI; x += M_PI/100.0) {
+ double r = gsl_cheb_eval_n(csd, 25, x);
+ gsl_test_abs(r, cos(x), 1600 * tol, "gsl_cheb_eval_n, deriv sin(%.3g)", x);
+ }
+
+#ifdef TEST_DERIVATIVE_ERR
+ for(x=-M_PI; x<M_PI; x += M_PI/100.0) {
+ double r, e;
+ gsl_cheb_eval_n_err(csd, 25, x, &r, &e);
+ gsl_test_abs(r, cos(x), 100.0 * tol, "gsl_cheb_eval_n_err, deriv sin(%.3g)", x);
+ gsl_test_factor(fabs(r-cos(x)) + GSL_DBL_EPSILON, e, ftol,
+ "gsl_cheb_eval_n_err, deriv error sin(%.3g)", x);
+ }
+#endif
+
+ /* Test integral */
+
+ gsl_cheb_calc_integ(csi, cs);
+
+ for(x=-M_PI; x<M_PI; x += M_PI/100.0) {
+ double r = gsl_cheb_eval(csi, x);
+ gsl_test_abs(r, -(1+cos(x)), tol, "gsl_cheb_eval, integ sin(%.3g)", x);
+ }
+
+#ifdef TEST_INTEGRAL_ERR
+ for(x=-M_PI; x<M_PI; x += M_PI/100.0) {
+ double r, e;
+ gsl_cheb_eval_err(csi, x, &r, &e);
+ gsl_test_abs(r, -(1+cos(x)), tol, "gsl_cheb_eval_err, integ sin(%.3g)", x);
+ gsl_test_factor(fabs(r-(-1-cos(x))) + GSL_DBL_EPSILON, e, ftol,
+ "gsl_cheb_eval_err, integ error sin(%.3g)", x);
+ }
+#endif
+
+ for(x=-M_PI; x<M_PI; x += M_PI/100.0) {
+ double r = gsl_cheb_eval_n(csi, 25, x);
+ gsl_test_abs(r, -(1+cos(x)), tol, "gsl_cheb_eval_n, integ sin(%.3g)", x);
+ }
+
+#ifdef TEST_INTEGRAL_ERR
+ for(x=-M_PI; x<M_PI; x += M_PI/100.0) {
+ double r, e;
+ gsl_cheb_eval_n_err(csi, 25, x, &r, &e);
+ gsl_test_abs(r, -(1+cos(x)), 100.0 * tol, "gsl_cheb_eval_n_err, integ sin(%.3g)", x);
+ gsl_test_factor(fabs(r-(-1-cos(x))) + GSL_DBL_EPSILON, e, ftol,
+ "gsl_cheb_eval_n_err, integ error sin(%.3g)", x);
+ }
+#endif
+
+ gsl_cheb_free(csi);
+ gsl_cheb_free(csd);
+ gsl_cheb_free(cs);
+
+ exit (gsl_test_summary());
+}