summaryrefslogtreecommitdiff
path: root/gsl-1.9/bspline
diff options
context:
space:
mode:
Diffstat (limited to 'gsl-1.9/bspline')
-rw-r--r--gsl-1.9/bspline/ChangeLog7
-rw-r--r--gsl-1.9/bspline/Makefile.am15
-rw-r--r--gsl-1.9/bspline/Makefile.in547
-rw-r--r--gsl-1.9/bspline/TODO9
-rw-r--r--gsl-1.9/bspline/bspline.c497
-rw-r--r--gsl-1.9/bspline/gsl_bspline.h75
-rw-r--r--gsl-1.9/bspline/test.c112
7 files changed, 1262 insertions, 0 deletions
diff --git a/gsl-1.9/bspline/ChangeLog b/gsl-1.9/bspline/ChangeLog
new file mode 100644
index 0000000..19ddc1c
--- /dev/null
+++ b/gsl-1.9/bspline/ChangeLog
@@ -0,0 +1,7 @@
+2006-11-02 Brian Gough <bjg@network-theory.co.uk>
+
+ * added test program
+
+ * initial checkin from P.Alken
+
+
diff --git a/gsl-1.9/bspline/Makefile.am b/gsl-1.9/bspline/Makefile.am
new file mode 100644
index 0000000..6dc3772
--- /dev/null
+++ b/gsl-1.9/bspline/Makefile.am
@@ -0,0 +1,15 @@
+noinst_LTLIBRARIES = libgslbspline.la
+
+pkginclude_HEADERS = gsl_bspline.h
+
+INCLUDES= -I$(top_builddir)
+
+libgslbspline_la_SOURCES = bspline.c
+
+check_PROGRAMS = test
+
+TESTS = $(check_PROGRAMS)
+
+test_LDADD = libgslbspline.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../blas/libgslblas.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../cblas/libgslcblas.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
+
+test_SOURCES = test.c
diff --git a/gsl-1.9/bspline/Makefile.in b/gsl-1.9/bspline/Makefile.in
new file mode 100644
index 0000000..ac743dc
--- /dev/null
+++ b/gsl-1.9/bspline/Makefile.in
@@ -0,0 +1,547 @@
+# 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 = bspline
+DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in ChangeLog TODO
+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)
+libgslbspline_la_LIBADD =
+am_libgslbspline_la_OBJECTS = bspline.lo
+libgslbspline_la_OBJECTS = $(am_libgslbspline_la_OBJECTS)
+am_test_OBJECTS = test.$(OBJEXT)
+test_OBJECTS = $(am_test_OBJECTS)
+test_DEPENDENCIES = libgslbspline.la ../linalg/libgsllinalg.la \
+ ../permutation/libgslpermutation.la ../blas/libgslblas.la \
+ ../matrix/libgslmatrix.la ../vector/libgslvector.la \
+ ../block/libgslblock.la ../complex/libgslcomplex.la \
+ ../cblas/libgslcblas.la ../ieee-utils/libgslieeeutils.la \
+ ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.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 = $(libgslbspline_la_SOURCES) $(test_SOURCES)
+DIST_SOURCES = $(libgslbspline_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 = libgslbspline.la
+pkginclude_HEADERS = gsl_bspline.h
+INCLUDES = -I$(top_builddir)
+libgslbspline_la_SOURCES = bspline.c
+TESTS = $(check_PROGRAMS)
+test_LDADD = libgslbspline.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../blas/libgslblas.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../cblas/libgslcblas.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.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 bspline/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps bspline/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
+libgslbspline.la: $(libgslbspline_la_OBJECTS) $(libgslbspline_la_DEPENDENCIES)
+ $(LINK) $(libgslbspline_la_LDFLAGS) $(libgslbspline_la_OBJECTS) $(libgslbspline_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/bspline/TODO b/gsl-1.9/bspline/TODO
new file mode 100644
index 0000000..67f8aa8
--- /dev/null
+++ b/gsl-1.9/bspline/TODO
@@ -0,0 +1,9 @@
+Add functions:
+
+gsl_bspline_eval_deriv (see pppack bsplvd) to compute B-spline derivatives
+
+gsl_bspline_smooth to fit smoothing splines to data more efficiently
+than the standard least squares inversion (see pppack l2appr and
+smooth.spline() from GNU R)
+
++ any other useful functions from pppack
diff --git a/gsl-1.9/bspline/bspline.c b/gsl-1.9/bspline/bspline.c
new file mode 100644
index 0000000..847a498
--- /dev/null
+++ b/gsl-1.9/bspline/bspline.c
@@ -0,0 +1,497 @@
+/* bspline/bspline.c
+ *
+ * Copyright (C) 2006 Patrick Alken
+ *
+ * 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 <gsl/gsl_errno.h>
+#include <gsl/gsl_bspline.h>
+
+/*
+ * This module contains routines related to calculating B-splines.
+ * The algorithms used are described in
+ *
+ * [1] Carl de Boor, "A Practical Guide to Splines", Springer
+ * Verlag, 1978.
+ */
+
+static int bspline_eval_all(const double x, gsl_vector *B, size_t *idx,
+ gsl_bspline_workspace *w);
+
+static inline size_t bspline_find_interval(const double x, int *flag,
+ gsl_bspline_workspace *w);
+
+/*
+gsl_bspline_alloc()
+ Allocate space for a bspline workspace. The size of the
+workspace is O(5k + nbreak)
+
+Inputs: k - spline order (cubic = 4)
+ nbreak - number of breakpoints
+
+Return: pointer to workspace
+*/
+
+gsl_bspline_workspace *
+gsl_bspline_alloc(const size_t k, const size_t nbreak)
+{
+ if (k == 0)
+ {
+ GSL_ERROR_NULL("k must be at least 1", GSL_EINVAL);
+ }
+ else if (nbreak < 2)
+ {
+ GSL_ERROR_NULL("nbreak must be at least 2", GSL_EINVAL);
+ }
+ else
+ {
+ gsl_bspline_workspace *w;
+
+ w = (gsl_bspline_workspace *)
+ calloc(1, sizeof(gsl_bspline_workspace));
+ if (w == 0)
+ {
+ GSL_ERROR_NULL("failed to allocate space for workspace", GSL_ENOMEM);
+ }
+
+ w->k = k;
+ w->km1 = k - 1;
+ w->nbreak = nbreak;
+ w->l = nbreak - 1;
+ w->n = w->l + k - 1;
+
+ w->knots = gsl_vector_alloc(w->n + k);
+ if (w->knots == 0)
+ {
+ gsl_bspline_free(w);
+ GSL_ERROR_NULL("failed to allocate space for knots vector", GSL_ENOMEM);
+ }
+
+ w->deltal = gsl_vector_alloc(k);
+ w->deltar = gsl_vector_alloc(k);
+ if (!w->deltal || !w->deltar)
+ {
+ gsl_bspline_free(w);
+ GSL_ERROR_NULL("failed to allocate space for delta vectors", GSL_ENOMEM);
+ }
+
+ w->B = gsl_vector_alloc(k);
+ if (w->B == 0)
+ {
+ gsl_bspline_free(w);
+ GSL_ERROR_NULL("failed to allocate space for temporary spline vector", GSL_ENOMEM);
+ }
+
+ return (w);
+ }
+} /* gsl_bspline_alloc() */
+
+/* Return number of coefficients */
+size_t
+gsl_bspline_ncoeffs (gsl_bspline_workspace * w)
+{
+ return w->n;
+}
+
+/* Return order */
+size_t
+gsl_bspline_order (gsl_bspline_workspace * w)
+{
+ return w->k;
+}
+
+/* Return number of breakpoints */
+size_t
+gsl_bspline_nbreak (gsl_bspline_workspace * w)
+{
+ return w->nbreak;
+}
+
+double
+gsl_bspline_breakpoint (size_t i, gsl_bspline_workspace * w)
+{
+ size_t j = i + w->k - 1;
+ return gsl_vector_get(w->knots, j);
+}
+
+/*
+gsl_bspline_free()
+ Free a bspline workspace
+
+Inputs: w - workspace to free
+
+Return: none
+*/
+
+void
+gsl_bspline_free(gsl_bspline_workspace *w)
+{
+ if (!w)
+ return;
+
+ if (w->knots)
+ gsl_vector_free(w->knots);
+
+ if (w->deltal)
+ gsl_vector_free(w->deltal);
+
+ if (w->deltar)
+ gsl_vector_free(w->deltar);
+
+ if (w->B)
+ gsl_vector_free(w->B);
+
+ free(w);
+} /* gsl_bspline_free() */
+
+/*
+gsl_bspline_knots()
+ Compute the knots from the given breakpoints:
+
+knots(1:k) = breakpts(1)
+knots(k+1:k+l-1) = breakpts(i), i = 2 .. l
+knots(n+1:n+k) = breakpts(l + 1)
+
+where l is the number of polynomial pieces (l = nbreak - 1) and
+n = k + l - 1
+(using matlab syntax for the arrays)
+
+The repeated knots at the beginning and end of the interval
+correspond to the continuity condition there. See pg. 119
+of [1].
+
+Inputs: breakpts - breakpoints
+ w - bspline workspace
+
+Return: success or error
+*/
+
+int
+gsl_bspline_knots(const gsl_vector *breakpts, gsl_bspline_workspace *w)
+{
+ if (breakpts->size != w->nbreak)
+ {
+ GSL_ERROR("breakpts vector has wrong size", GSL_EBADLEN);
+ }
+ else
+ {
+ size_t i; /* looping */
+
+ for (i = 0; i < w->k; ++i)
+ gsl_vector_set(w->knots, i, gsl_vector_get(breakpts, 0));
+
+ for (i = 1; i < w->l; ++i)
+ {
+ gsl_vector_set(w->knots, w->k - 1 + i,
+ gsl_vector_get(breakpts, i));
+ }
+
+ for (i = w->n; i < w->n + w->k; ++i)
+ gsl_vector_set(w->knots, i, gsl_vector_get(breakpts, w->l));
+
+ return GSL_SUCCESS;
+ }
+} /* gsl_bspline_knots() */
+
+/*
+gsl_bspline_knots_uniform()
+ Construct uniformly spaced knots on the interval [a,b] using
+the previously specified number of breakpoints. 'a' is the position
+of the first breakpoint and 'b' is the position of the last
+breakpoint.
+
+Inputs: a - left side of interval
+ b - right side of interval
+ w - bspline workspace
+
+Return: success or error
+
+Notes: 1) w->knots is modified to contain the uniformly spaced
+ knots
+
+ 2) The knots vector is set up as follows (using octave syntax):
+
+ knots(1:k) = a
+ knots(k+1:k+l-1) = a + i*delta, i = 1 .. l - 1
+ knots(n+1:n+k) = b
+*/
+
+int
+gsl_bspline_knots_uniform(const double a, const double b,
+ gsl_bspline_workspace *w)
+{
+ size_t i; /* looping */
+ double delta; /* interval spacing */
+ double x;
+
+ delta = (b - a) / (double) w->l;
+
+ for (i = 0; i < w->k; ++i)
+ gsl_vector_set(w->knots, i, a);
+
+ x = a + delta;
+ for (i = 0; i < w->l - 1; ++i)
+ {
+ gsl_vector_set(w->knots, w->k + i, x);
+ x += delta;
+ }
+
+ for (i = w->n; i < w->n + w->k; ++i)
+ gsl_vector_set(w->knots, i, b);
+
+ return GSL_SUCCESS;
+} /* gsl_bspline_knots_uniform() */
+
+/*
+gsl_bspline_eval()
+ Evaluate the basis functions B_i(x) for all i. This is
+basically a wrapper function for bspline_eval_all()
+which formats the output in a nice way.
+
+Inputs: x - point for evaluation
+ B - (output) where to store B_i(x) values
+ the length of this vector is
+ n = nbreak + k - 2 = l + k - 1 = w->n
+ w - bspline workspace
+
+Return: success or error
+
+Notes: The w->knots vector must be initialized prior to calling
+ this function (see gsl_bspline_knots())
+*/
+
+int
+gsl_bspline_eval(const double x, gsl_vector *B,
+ gsl_bspline_workspace *w)
+{
+ if (B->size != w->n)
+ {
+ GSL_ERROR("B vector length does not match n", GSL_EBADLEN);
+ }
+ else
+ {
+ size_t i; /* looping */
+ size_t idx = 0;
+ size_t start; /* first non-zero spline */
+
+ /* find all non-zero B_i(x) values */
+ bspline_eval_all(x, w->B, &idx, w);
+
+ /* store values in appropriate part of given vector */
+
+ start = idx - w->k + 1;
+ for (i = 0; i < start; ++i)
+ gsl_vector_set(B, i, 0.0);
+
+ for (i = start; i <= idx; ++i)
+ gsl_vector_set(B, i, gsl_vector_get(w->B, i - start));
+
+ for (i = idx + 1; i < w->n; ++i)
+ gsl_vector_set(B, i, 0.0);
+
+ return GSL_SUCCESS;
+ }
+} /* gsl_bspline_eval() */
+
+/****************************************
+ * INTERNAL ROUTINES *
+ ****************************************/
+
+/*
+bspline_eval_all()
+ Evaluate all non-zero B-splines B_i(x) using algorithm (8)
+of chapter X of [1]
+
+The idea is something like this. Given x \in [t_i, t_{i+1}]
+with t_i < t_{i+1} and the t_i are knots, the values of the
+B-splines not automatically zero fit into a triangular
+array as follows:
+ 0
+ 0
+0 B_{i-2,3}
+ B_{i-1,2}
+B_{i,1} B_{i-1,3} ...
+ B_{i,2}
+0 B_{i,3}
+ 0
+ 0
+
+where B_{i,k} is the ith B-spline of order k. The boundary 0s
+indicate that those B-splines not in the table vanish at x.
+
+To compute the non-zero B-splines of a given order k, we use
+Eqs. (4) and (5) of chapter X of [1]:
+
+(4) B_{i,1}(x) = { 1, t_i <= x < t_{i+1}
+ 0, else }
+
+(5) B_{i,k}(x) = (x - t_i)
+ ----------------- B_{i,k-1}(x)
+ (t_{i+k-1} - t_i)
+
+ t_{i+k} - x
+ + ----------------- B_{i+1,k-1}(x)
+ t_{i+k} - t_{i+1}
+
+So (4) gives us the first column of the table and we can use
+the recurrence relation (5) to get the rest of the columns.
+
+Inputs: x - point at which to evaluate splines
+ B - (output) where to store B-spline values (length k)
+ idx - (output) B-spline function index of last output
+ value (B_{idx}(x) is stored in the last slot of 'B')
+ w - bspline workspace
+
+Return: success or error
+
+Notes: 1) the w->knots vector must be initialized before calling
+ this function
+
+ 2) On output, B contains:
+
+ B = [B_{i-k+1,k}, B_{i-k+2,k}, ..., B_{i-1,k}, B_{i,k}]
+
+ where 'i' is stored in 'idx' on output
+
+ 3) based on PPPACK bsplvb
+*/
+
+static int
+bspline_eval_all(const double x, gsl_vector *B, size_t *idx,
+ gsl_bspline_workspace *w)
+{
+ if (B->size != w->k)
+ {
+ GSL_ERROR("B vector not of length k", GSL_EBADLEN);
+ }
+ else
+ {
+ size_t i; /* spline index */
+ size_t j; /* looping */
+ size_t ii; /* looping */
+ int flag = 0; /* error flag */
+ double saved;
+ double term;
+
+ i = bspline_find_interval(x, &flag, w);
+
+ if (flag == -1)
+ {
+ GSL_ERROR("x outside of knot interval", GSL_EINVAL);
+ }
+ else if (flag == 1)
+ {
+ if (x <= gsl_vector_get(w->knots, i) + GSL_DBL_EPSILON)
+ {
+ --i;
+ }
+ else
+ {
+ GSL_ERROR("x outside of knot interval", GSL_EINVAL);
+ }
+ }
+
+ *idx = i;
+
+ gsl_vector_set(B, 0, 1.0);
+
+ for (j = 0; j < w->k - 1; ++j)
+ {
+ gsl_vector_set(w->deltar, j,
+ gsl_vector_get(w->knots, i + j + 1) - x);
+ gsl_vector_set(w->deltal, j,
+ x - gsl_vector_get(w->knots, i - j));
+
+ saved = 0.0;
+
+ for (ii = 0; ii <= j; ++ii)
+ {
+ term = gsl_vector_get(B, ii) /
+ (gsl_vector_get(w->deltar, ii) +
+ gsl_vector_get(w->deltal, j - ii));
+
+ gsl_vector_set(B, ii,
+ saved +
+ gsl_vector_get(w->deltar, ii) * term);
+
+ saved = gsl_vector_get(w->deltal, j - ii) * term;
+ }
+
+ gsl_vector_set(B, j + 1, saved);
+ }
+
+ return GSL_SUCCESS;
+ }
+} /* bspline_eval_all() */
+
+/*
+bspline_find_interval()
+ Find knot interval such that
+
+ t_i <= x < t_{i + 1}
+
+where the t_i are knot values.
+
+Inputs: x - x value
+ flag - (output) error flag
+ w - bspline workspace
+
+Return: i (index in w->knots corresponding to left limit of interval)
+
+Notes: The error conditions are reported as follows:
+
+Condition Return value Flag
+--------- ------------ ----
+x < t_0 0 -1
+t_i <= x < t_{i+1} i 0
+t_{n+k-1} <= x l+k-1 +1
+*/
+
+static inline size_t
+bspline_find_interval(const double x, int *flag,
+ gsl_bspline_workspace *w)
+{
+ size_t i;
+
+ if (x < gsl_vector_get(w->knots, 0))
+ {
+ *flag = -1;
+ return 0;
+ }
+
+ /* find i such that t_i <= x < t_{i+1} */
+ for (i = w->k - 1; i < w->k + w->l - 1; ++i)
+ {
+ const double ti = gsl_vector_get(w->knots, i);
+ const double tip1 = gsl_vector_get(w->knots, i + 1);
+
+ if (tip1 < ti)
+ {
+ GSL_ERROR("knots vector is not increasing", GSL_EINVAL);
+ }
+
+ if (ti <= x && x < tip1)
+ break;
+ }
+
+ if (i == w->k + w->l - 1)
+ *flag = 1;
+ else
+ *flag = 0;
+
+ return i;
+} /* bspline_find_interval() */
diff --git a/gsl-1.9/bspline/gsl_bspline.h b/gsl-1.9/bspline/gsl_bspline.h
new file mode 100644
index 0000000..26794ec
--- /dev/null
+++ b/gsl-1.9/bspline/gsl_bspline.h
@@ -0,0 +1,75 @@
+/* bspline/gsl_bspline.h
+ *
+ * Copyright (C) 2006 Patrick Alken
+ *
+ * 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_BSPLINE_H__
+#define __GSL_BSPLINE_H__
+
+#include <stdlib.h>
+#include <gsl/gsl_math.h>
+#include <gsl/gsl_vector.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
+
+typedef struct
+{
+ size_t k; /* spline order */
+ size_t km1; /* k - 1 (polynomial order) */
+ size_t l; /* number of polynomial pieces on interval */
+ size_t nbreak; /* number of breakpoints (l + 1) */
+ size_t n; /* number of bspline basis functions (l + k - 1) */
+
+ gsl_vector *knots; /* knots vector */
+ gsl_vector *deltal; /* left delta */
+ gsl_vector *deltar; /* right delta */
+ gsl_vector *B; /* temporary spline results */
+} gsl_bspline_workspace;
+
+gsl_bspline_workspace *
+gsl_bspline_alloc(const size_t k, const size_t nbreak);
+
+void gsl_bspline_free(gsl_bspline_workspace *w);
+
+size_t gsl_bspline_ncoeffs (gsl_bspline_workspace * w);
+size_t gsl_bspline_order (gsl_bspline_workspace * w);
+size_t gsl_bspline_nbreak (gsl_bspline_workspace * w);
+double gsl_bspline_breakpoint (size_t i, gsl_bspline_workspace * w);
+
+int
+gsl_bspline_knots(const gsl_vector *breakpts, gsl_bspline_workspace *w);
+
+int gsl_bspline_knots_uniform(const double a, const double b,
+ gsl_bspline_workspace *w);
+
+int
+gsl_bspline_eval(const double x, gsl_vector *B,
+ gsl_bspline_workspace *w);
+
+__END_DECLS
+
+#endif /* __GSL_BSPLINE_H__ */
diff --git a/gsl-1.9/bspline/test.c b/gsl-1.9/bspline/test.c
new file mode 100644
index 0000000..e05dde0
--- /dev/null
+++ b/gsl-1.9/bspline/test.c
@@ -0,0 +1,112 @@
+/* bspline/test.c
+ *
+ * Copyright (C) 2006 Brian Gough
+ *
+ * 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 <gsl/gsl_test.h>
+#include <gsl/gsl_errno.h>
+#include <gsl/gsl_bspline.h>
+#include <gsl/gsl_ieee_utils.h>
+
+void
+test_bspline (gsl_bspline_workspace * bw)
+{
+ gsl_vector *B;
+ size_t i, j;
+ size_t n = 100;
+ size_t ncoeffs = gsl_bspline_ncoeffs (bw);
+ size_t order = gsl_bspline_order (bw);
+ size_t nbreak = gsl_bspline_nbreak (bw);
+ double a = gsl_bspline_breakpoint (0, bw);
+ double b = gsl_bspline_breakpoint (nbreak - 1, bw);
+
+ B = gsl_vector_alloc (ncoeffs);
+
+ for (i = 0; i < n; i++)
+ {
+ double xi = a + (b - a) * (i / (n - 1.0));
+ double sum = 0;
+ gsl_bspline_eval (xi, B, bw);
+
+ for (j = 0; j < ncoeffs; j++)
+ {
+ double Bj = gsl_vector_get (B, j);
+ int s = (Bj < 0 || Bj > 1);
+ gsl_test (s,
+ "basis-spline coefficient %u is in range [0,1] for x=%g",
+ j, xi);
+ sum += Bj;
+ }
+
+ gsl_test_rel (sum, 1.0, order * GSL_DBL_EPSILON,
+ "basis-spline order %u is normalized for x=%g", order,
+ xi);
+ }
+
+ gsl_vector_free (B);
+}
+
+
+
+int
+main (int argc, char **argv)
+{
+ int status = 0;
+ size_t order, breakpoints, i;
+
+ gsl_ieee_env_setup ();
+
+ argc = 0; /* prevent warnings about unused parameters */
+ argv = 0;
+
+ for (order = 1; order < 10; order++)
+ {
+ for (breakpoints = 2; breakpoints < 100; breakpoints++)
+ {
+ double a = -1.23 * order, b = 45.6 * order;
+ gsl_bspline_workspace *bw = gsl_bspline_alloc (order, breakpoints);
+ gsl_bspline_knots_uniform (a, b, bw);
+ test_bspline (bw);
+ gsl_bspline_free (bw);
+ }
+ }
+
+
+ for (order = 1; order < 10; order++)
+ {
+ for (breakpoints = 2; breakpoints < 100; breakpoints++)
+ {
+ double a = -1.23 * order, b = 45.6 * order;
+ gsl_bspline_workspace *bw = gsl_bspline_alloc (order, breakpoints);
+ gsl_vector *k = gsl_vector_alloc (breakpoints);
+ for (i = 0; i < breakpoints; i++)
+ {
+ double f, x;
+ f = sqrt (i / (breakpoints - 1.0));
+ x = (1 - f) * a + f * b;
+ gsl_vector_set (k, i, x);
+ };
+ gsl_bspline_knots (k, bw);
+ test_bspline (bw);
+ gsl_vector_free (k);
+ gsl_bspline_free (bw);
+ }
+ }
+
+ exit (gsl_test_summary ());
+}