commit octave-forge-splines for openSUSE:Factory
Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package octave-forge-splines for openSUSE:Factory checked in at 2023-10-31 20:25:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/octave-forge-splines (Old) and /work/SRC/openSUSE:Factory/.octave-forge-splines.new.17445 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "octave-forge-splines" Tue Oct 31 20:25:38 2023 rev:7 rq:1121346 version:1.3.5 Changes: -------- --- /work/SRC/openSUSE:Factory/octave-forge-splines/octave-forge-splines.changes 2021-03-17 20:20:06.463330051 +0100 +++ /work/SRC/openSUSE:Factory/.octave-forge-splines.new.17445/octave-forge-splines.changes 2023-10-31 20:25:52.962343217 +0100 @@ -1,0 +2,12 @@ +Mon Oct 30 16:01:00 UTC 2023 - Atri Bhattacharya <badshah400@gmail.com> + +- Update URL to point to 'https://gnu-octave.github.io/packages/' + +------------------------------------------------------------------- +Thu Oct 19 06:39:40 UTC 2023 - Atri Bhattacharya <badshah400@gmail.com> + +- Update to version 1.3.5: + * bug fix in csape + * syntax made compatible with Octave 8 + +------------------------------------------------------------------- Old: ---- splines-1.3.4.tar.gz New: ---- splines-1.3.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ octave-forge-splines.spec ++++++ --- /var/tmp/diff_new_pack.kuAtdJ/_old 2023-10-31 20:25:53.702370399 +0100 +++ /var/tmp/diff_new_pack.kuAtdJ/_new 2023-10-31 20:25:53.706370546 +0100 @@ -1,7 +1,7 @@ # # spec file for package octave-forge-splines # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,12 +18,12 @@ %define octpkg splines Name: octave-forge-%{octpkg} -Version: 1.3.4 +Version: 1.3.5 Release: 0 Summary: Additional spline functions for Octave License: GPL-2.0-or-later AND GPL-3.0-or-later AND SUSE-Public-Domain Group: Productivity/Scientific/Math -URL: https://octave.sourceforge.io +URL: https://gnu-octave.github.io/packages/%{octpkg}/ Source0: https://downloads.sourceforge.net/octave/%{octpkg}-%{version}.tar.gz BuildArch: noarch BuildRequires: octave-devel ++++++ splines-1.3.4.tar.gz -> splines-1.3.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/splines-1.3.4/DESCRIPTION new/splines/DESCRIPTION --- old/splines-1.3.4/DESCRIPTION 2021-02-24 02:14:16.000000000 +0100 +++ new/splines/DESCRIPTION 2023-05-05 17:23:35.000000000 +0200 @@ -1,8 +1,8 @@ Name: splines -Version: 1.3.4 -Date: 2021-02-23 +Version: 1.3.5 +Date: 2023-05-05 Author: various authors -Maintainer: Nir Krakauer <splines@nirkrakauer.net> +Maintainer: Nir Krakauer <nkrakauer@ccny.cuny.edu> Title: Splines. Description: Additional spline functions. Categories: Splines diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/splines-1.3.4/Makefile new/splines/Makefile --- old/splines-1.3.4/Makefile 2021-02-24 02:14:16.000000000 +0100 +++ new/splines/Makefile 1970-01-01 01:00:00.000000000 +0100 @@ -1,235 +0,0 @@ -## Copyright 2015-2016 Carnë Draug -## Copyright 2015-2016 Oliver Heimlich -## Copyright 2017 Julien Bect <jbect@users.sf.net> -## Copyright 2017 Olaf Till <i7tiol@t-online.de> -## -## Copying and distribution of this file, with or without modification, -## are permitted in any medium without royalty provided the copyright -## notice and this notice are preserved. This file is offered as-is, -## without any warranty. - -## Some basic tools (can be overriden using environment variables) -SED ?= sed -TAR ?= tar -GREP ?= grep -CUT ?= cut -TR ?= tr - -## Note the use of ':=' (immediate set) and not just '=' (lazy set). -## http://stackoverflow.com/a/448939/1609556 -package := $(shell $(GREP) "^Name: " DESCRIPTION | $(CUT) -f2 -d" " | \ -$(TR) '[:upper:]' '[:lower:]') -version := $(shell $(GREP) "^Version: " DESCRIPTION | $(CUT) -f2 -d" ") - -## These are the paths that will be created for the releases. -target_dir := target -release_dir := $(target_dir)/$(package)-$(version) -release_tarball := $(target_dir)/$(package)-$(version).tar.gz -html_dir := $(target_dir)/$(package)-html -html_tarball := $(target_dir)/$(package)-html.tar.gz -## Using $(realpath ...) avoids problems with symlinks due to bug -## #50994 in Octaves scripts/pkg/private/install.m. But at least the -## release directory above is needed in the relative form, for 'git -## archive --format=tar --prefix=$(release_dir). -real_target_dir := $(realpath .)/$(target_dir) -installation_dir := $(real_target_dir)/.installation -package_list := $(installation_dir)/.octave_packages -install_stamp := $(installation_dir)/.install_stamp - -## These can be set by environment variables which allow to easily -## test with different Octave versions. -ifndef OCTAVE -OCTAVE := octave -endif -OCTAVE := $(OCTAVE) --no-gui --silent --norc -MKOCTFILE ?= mkoctfile - -## Command used to set permissions before creating tarballs -FIX_PERMISSIONS ?= chmod -R a+rX,u+w,go-w,ug-s - -## Detect which VCS is used -vcs := $(if $(wildcard .hg),hg,$(if $(wildcard .git),git,unknown)) -ifeq ($(vcs),hg) -release_dir_dep := .hg/dirstate -endif -ifeq ($(vcs),git) -release_dir_dep := .git/index -endif - - -## .PHONY indicates targets that are not filenames -## (https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html) -.PHONY: help - -## make will display the command before runnning them. Use @command -## to not display it (makes specially sense for echo). -help: - @echo "Targets:" - @echo " dist - Create $(release_tarball) for release." - @echo " html - Create $(html_tarball) for release." - @echo " release - Create both of the above and show md5sums." - @echo " install - Install the package in $(installation_dir), where it is not visible in a normal Octave session." - @echo " check - Execute package tests." - @echo " doctest - Test the help texts with the doctest package." - @echo " run - Run Octave with the package installed in $(installation_dir) in the path." - @echo " clean - Remove everything made with this Makefile." - - -## -## Recipes for release tarballs (package + html) -## - -.PHONY: release dist html clean-tarballs clean-unpacked-release - -## To make a release, build the distribution and html tarballs. -release: dist html - md5sum $(release_tarball) $(html_tarball) - @echo "Upload @ https://sourceforge.net/p/octave/package-releases/new/" - @echo " and note the changeset the release corresponds to" - -## dist and html targets are only PHONY/alias targets to the release -## and html tarballs. -dist: $(release_tarball) -html: $(html_tarball) - -## An implicit rule with a recipe to build the tarballs correctly. -%.tar.gz: % - $(TAR) -c -f - --posix -C "$(target_dir)/" "$(notdir $<)" | gzip -9n > "$@" - -clean-tarballs: - @echo "## Cleaning release tarballs (package + html)..." - -$(RM) $(release_tarball) $(html_tarball) - @echo - -## Create the unpacked package. -## -## Notes: -## * having ".hg/dirstate" (or ".git/index") as a prerequesite means it is -## only rebuilt if we are at a different commit. -## * the variable RM usually defaults to "rm -f" -## * having this recipe separate from the one that makes the tarball -## makes it easy to have packages in alternative formats (such as zip) -## * note that if a commands needs to be run in a specific directory, -## the command to "cd" needs to be on the same line. Each line restores -## the original working directory. -$(release_dir): $(release_dir_dep) - -$(RM) -r "$@" -ifeq (${vcs},hg) - hg archive --exclude ".hg*" --type files "$@" -endif -ifeq (${vcs},git) - git archive --format=tar --prefix="$@/" HEAD | $(TAR) -x - $(RM) "$@/.gitignore" -endif -## Don't fall back to run the supposed necessary contents of -## 'bootstrap' here. Users are better off if they provide -## 'bootstrap'. Administrators, checking build reproducibility, can -## put in the missing 'bootstrap' file if they feel they know its -## necessary contents. -ifneq (,$(wildcard src/bootstrap)) - cd "$@/src" && ./bootstrap && $(RM) -r "autom4te.cache" -endif -## Uncomment this if your src/Makefile.in has these targets for -## pre-building something for the release (e.g. documentation). -# cd "$@/src" && ./configure && $(MAKE) prebuild && \ -# $(MAKE) distclean && $(RM) Makefile -## - ${FIX_PERMISSIONS} "$@" - -run_in_place = $(OCTAVE) --eval ' pkg ("local_list", "$(package_list)"); ' \ - --eval ' pkg ("load", "$(package)"); ' - -html_options = --eval 'options = get_html_options ("octave-forge");' -## Uncomment this for package documentation. -# html_options = --eval 'options = get_html_options ("octave-forge");' \ -# --eval 'options.package_doc = "$(package).texi";' -$(html_dir): $(install_stamp) - $(RM) -r "$@"; - $(run_in_place) \ - --eval ' pkg load generate_html; ' \ - $(html_options) \ - --eval ' generate_package_html ("$(package)", "$@", options); '; - $(FIX_PERMISSIONS) "$@"; - -clean-unpacked-release: - @echo "## Cleaning unpacked release tarballs (package + html)..." - -$(RM) -r $(release_dir) $(html_dir) - @echo - -## -## Recipes for installing the package. -## - -.PHONY: install clean-install - -octave_install_commands = \ -' llist_path = pkg ("local_list"); \ - mkdir ("$(installation_dir)"); \ - load (llist_path); \ - local_packages(cellfun (@ (x) strcmp ("$(package)", x.name), local_packages)) = []; \ - save ("$(package_list)", "local_packages"); \ - pkg ("local_list", "$(package_list)"); \ - pkg ("prefix", "$(installation_dir)", "$(installation_dir)"); \ - pkg ("install", "-local", "-verbose", "$(release_tarball)"); ' - -## Install unconditionally. Maybe useful for testing installation with -## different versions of Octave. -install: $(release_tarball) - @echo "Installing package under $(installation_dir) ..." - $(OCTAVE) --eval $(octave_install_commands) - touch $(install_stamp) - -## Install only if installation (under target/...) is not current. -$(install_stamp): $(release_tarball) - @echo "Installing package under $(installation_dir) ..." - $(OCTAVE) --eval $(octave_install_commands) - touch $(install_stamp) - -clean-install: - @echo "## Cleaning installation under $(installation_dir) ..." - -$(RM) -r $(installation_dir) - @echo - - -## -## Recipes for testing purposes -## - -.PHONY: run doctest check - -## Start an Octave session with the package directories on the path for -## interactice test of development sources. -run: $(install_stamp) - $(run_in_place) --persist - -## Test example blocks in the documentation. Needs doctest package -## https://octave.sourceforge.io/doctest/index.html -doctest: $(install_stamp) - $(run_in_place) --eval 'pkg load doctest;' \ - --eval "targets = '$(shell (ls inst; ls src | $(GREP) .oct) | $(CUT) -f2 -d@ | $(CUT) -f1 -d.)';" \ - --eval "targets = strsplit (targets, ' '); doctest (targets);" - - -## Test package. -octave_test_commands = \ -' args = {"inst", "src"}; \ - args(cellfun (@ (x) isempty (a = stat (x)) || ! S_ISDIR (a.mode), args)) = []; \ - if (isempty (args)) error ("no \"inst\" or \"src\" directory"); exit (1); \ - else cellfun(@runtests, args); endif ' -check: $(install_stamp) - $(run_in_place) --eval $(octave_test_commands) - - -## -## CLEAN -## - -.PHONY: clean - -clean: clean-tarballs clean-unpacked-release clean-install - @echo "## Removing target directory (if empty)..." - -rmdir $(target_dir) - @echo - @echo "## Cleaning done" - @echo - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/splines-1.3.4/NEWS new/splines/NEWS --- old/splines-1.3.4/NEWS 2021-02-24 02:14:16.000000000 +0100 +++ new/splines/NEWS 2023-05-05 17:23:35.000000000 +0200 @@ -1,3 +1,10 @@ + +Summary of important user-visible changes for splines 1.3.5: +------------------------------------------------------------------- + + ** bug fix in csape + ** syntax made compatible with Octave 8 + Summary of important user-visible changes for splines 1.3.4: ------------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/splines-1.3.4/inst/csape.m new/splines/inst/csape.m --- old/splines-1.3.4/inst/csape.m 2021-02-24 02:14:16.000000000 +0100 +++ new/splines/inst/csape.m 2023-05-05 17:23:35.000000000 +0200 @@ -101,7 +101,7 @@ g = [3*(d(1, :) - valc(1, :)); g; 3*(valc(2, :) - d(end, :))]; c = A \ g; else - dg = 2 * (h(1:n - 2) .+ h(2:n - 1)); + dg = 2 * (h(1:n - 2) + h(2:n - 1)); dg(1) = dg(1) - 0.5 * h(1); dg(n - 2) = dg(n-2) - 0.5 * h(n - 1); @@ -139,49 +139,37 @@ g(1,:) = g(1,:) - h(1) * c(1,:); g(n - 2,:) = g(n-2,:) - h(n - 1) * c(n,:); - if( n == 3) - dg = 2 * h(1); - c(2:n - 1,:) = g / dg; - else - dg = 2 * (h(1:n - 2) .+ h(2:n - 1)); - e = h(2:n - 2); - c(2:n - 1,:) = spdiags([[e(:);0],dg,[0;e(:)]],[-1,0,1],n-2,n-2) \ g; - end + dg = 2 * (h(1:n - 2) + h(2:n - 1)); + e = h(2:n - 2); + c(2:n - 1,:) = spdiags([[e(:);0],dg,[0;e(:)]],[-1,0,1],n-2,n-2) \ g; b(1:n - 1,:) = diff (a) ./ h(1:n - 1,idx)... - h(1:n - 1,idx) / 3 .* (c(2:n,:) + 2 * c(1:n - 1,:)); d = diff (c) ./ (3 * h(1:n - 1, idx)); elseif (strcmp(cond,"periodic")) - - h = [h; h(1)]; - - ## XXX FIXME XXX --- the following gives a smoother periodic transition: - ## a(n,:) = a(1,:) = ( a(n,:) + a(1,:) ) / 2; - a(n,:) = a(1,:); - - tmp = diff (shift ([a; a(2,:)], -1)); - g = 3 * tmp(1:n - 1,:) ./ h(2:n,idx)... - - 3 * diff (a) ./ h(1:n - 1,idx); - - if (n > 3) - dg = 2 * (h(1:n - 1) .+ h(2:n)); - e = h(2:n - 1); - - ## Use Sherman-Morrison formula to extend the solution - ## to the cyclic system. See Numerical Recipes in C, pp 73-75 - gamma = - dg(1); - dg(1) -= gamma; - dg(end) -= h(1) * h(1) / gamma; - z = spdiags([[e(:);0],dg,[0;e(:)]],[-1,0,1],n-1,n-1) \ ... - [[gamma; zeros(n-3,1); h(1)],g]; - fact = (z(1,2:end) + h(1) * z(end,2:end) / gamma) / ... - (1.0 + z(1,1) + h(1) * z(end,1) / gamma); - - c(2:n,:) = z(:,2:end) - z(:,1) * fact; - endif - - c(1,:) = c(n,:); + + D = diff(a) ./ h; + A = sparse (n-1); + v = zeros (n-1, m); + for i = 2:(n-2) + A(i, i-1) = h(i-1); + A(i, i) = 2 * (h(i-1) + h(i)); + A(i, i+1) = h(i); + v(i, :) = 3 * (D(i, :) - D(i-1, :)); + endfor + A(1, 1) = 2 * (h(1) + h(n-1)); + A(1, 2) = h(1); + A(1, n-1) += h(n-1); + v(1, :) = 3 * (D(1, :) - D(n-1, :)); + A(n-1, 1) = h(n-1); + A(n-1, n-2) += h(n-2); + A(n-1, n-1) = 2 * (h(n-2) + h(n-1)); + v(n-1, :) = 3 * (D(n-1, :) - D(n-2, :)); + c = A \ v; #this is a cyclic tridiagonal system -- the Sherwood-Morrison formula + #could be used to solve it if \ is too slow in this case + + c(n,:) = c(1,:); b = diff (a) ./ h(1:n - 1,idx)... - h(1:n - 1,idx) / 3 .* (c(2:n,:) + 2 * c(1:n - 1,:)); b(n,:) = b(1,:); @@ -202,7 +190,7 @@ g(2:n - 3,:) = 3 * diff (a(3:n - 1,:)) ./ h(3:n - 2,idx)... - 3 * diff (a(2:n - 2,:)) ./ h(2:n - 3,idx); - dg = 2 * (h(1:n - 2) .+ h(2:n - 1)); + dg = 2 * (h(1:n - 2) + h(2:n - 1)); dg(1) = dg(1) - h(1); dg(n - 2) = dg(n-2) - h(n - 1); @@ -219,18 +207,21 @@ c(2:n - 1,:) = spdiags([[ldg(:);0],dg,[0;udg(:)]],[-1,0,1],n-2,n-2) \ g; else # n == 3 - - dg= [h(1) + 2 * h(2)]; - c(2:n - 1,:) = g/dg(1); - + #with only 3 points, the not-a-knot cubic spline is not unique; + #we choose the one where the cubic coefficients are zero, + #which is the interpolating quadratic polynomial + c = repmat ((a(1,:) - a(3,:)) / ((x(3) - x(1)) * (x(2) - x(3))) ... + + (a(2,:) - a(1,:)) / ((x(2) - x(1)) * (x(2) - x(3))), [3 1]); + endif + if n == 3 + d = zeros (n, m); + else + c(1,:) = c(2,:) + h(1) / h(2) * (c(2,:) - c(3,:)); + c(n,:) = c(n - 1,:) + h(n - 1) / h(n - 2) * (c(n - 1,:) - c(n - 2,:)); + d = diff (c) ./ (3 * h(1:n - 1, idx)); endif - - c(1,:) = c(2,:) + h(1) / h(2) * (c(2,:) - c(3,:)); - c(n,:) = c(n - 1,:) + h(n - 1) / h(n - 2) * (c(n - 1,:) - c(n - 2,:)); b = diff (a) ./ h(1:n - 1, idx)... - h(1:n - 1, idx) / 3 .* (c(2:n,:) + 2 * c(1:n - 1,:)); - d = diff (c) ./ (3 * h(1:n - 1, idx)); - else msg = sprintf("unknown end condition: %s",cond); error (msg); @@ -242,7 +233,7 @@ endfunction -%!shared x,x2,y,cond,pp,pp1,pp2,h,valc +%!shared x,x2,y,cond,pp,pp1,pp2,h,valc,xi,yi %! x = linspace(0,2*pi,5); y = sin(x); x2 = linspace(0,2*pi,16); %!assert (ppval(csape(x,y),x), y, 10*eps); @@ -253,6 +244,7 @@ %! [ppval(csape(x,y),x);ppval(csape(x,y),x)], 10*eps) %!assert (ppval(csape(x,[y;y]),x2), ... %! [ppval(csape(x,y),x2);ppval(csape(x,y),x2)], 10*eps) +%!assert (ppval(csape([1 2 4],[2, 3, 6]), 3), 13/3, 10*eps); %!test cond='complete'; %!assert (ppval(csape(x,y,cond),x), y, 10*eps); @@ -263,6 +255,7 @@ %! [ppval(csape(x,y,cond),x);ppval(csape(x,y,cond),x)], 10*eps) %!assert (ppval(csape(x,[y;y],cond),x2), ... %! [ppval(csape(x,y,cond),x2);ppval(csape(x,y,cond),x2)], 10*eps) +%!assert (ppval(csape([1 2 4],[2, 3, 6], cond, [2 1]), 3), 215/48, 10*eps); %!test cond='variational'; %!assert (ppval(csape(x,y,cond),x), y, 10*eps); @@ -273,6 +266,8 @@ %! [ppval(csape(x,y,cond),x);ppval(csape(x,y,cond),x)], 10*eps) %!assert (ppval(csape(x,[y;y],cond),x2), ... %! [ppval(csape(x,y,cond),x2);ppval(csape(x,y,cond),x2)], 10*eps) +%!assert (ppval(csape([1 2 3],[2, 3, 5],cond), 1.5), 2.40625, 10*eps); +%!assert (ppval(csape([1 2 4],[2, 3, 6], cond), 3), 4.375, 10*eps); %!test cond='second'; %!assert (ppval(csape(x,y,cond),x), y, 10*eps); @@ -283,6 +278,7 @@ %! [ppval(csape(x,y,cond),x);ppval(csape(x,y,cond),x)], 10*eps) %!assert (ppval(csape(x,[y;y],cond),x2), ... %! [ppval(csape(x,y,cond),x2);ppval(csape(x,y,cond),x2)], 10*eps) +%!assert (ppval(csape([1 2 4],[2, 3, 6], cond, [1 2]), 3), 49/12, 10*eps); %!test cond='periodic'; %!assert (ppval(csape(x,y,cond),x), y, 10*eps); @@ -305,6 +301,9 @@ %! [ppval(csape(x,y,cond),x2);ppval(csape(x,y,cond),x2)], 10*eps) %!assert (ppval(csape(x(1:4),y(1:4),cond),x(1:4)), y(1:4), 10*eps); %!assert (ppval(csape(x(1:4)',y(1:4)',cond),x(1:4)), y(1:4), 10*eps); +%!test assert (ppval(csape([1 2 4],[2, 3, 6], 'not-a-knot'), 3), 13/3, 10*eps); +%!test assert (ppval(csape([1 2 4 5],[2, 3, 6, 5], 'not-a-knot'), 3), 29/6, 10*eps); +%!test assert (ppval(csape([1 2 4 5 6],[2, 3, 6, 5, 6], 'not-a-knot'), 3), 141/28, 10*eps); %!test cond='complete'; %! h = pi/6; n = 3; x = linspace(0,(n-1)*h,n)'; y = sin(x); valc = cos([x(1) x(end)]); pp = csape(x, y, cond, valc); @@ -328,3 +327,26 @@ %! y = [sin(x) cos(x)]; valc = [cos([x(1); x(end)]) -sin([x(1); x(end)])]; pp2 = csape(x, y, cond, valc); %!assert (pp2.coefs([1 3], :), pp.coefs) %!assert (pp2.coefs([2 4], :), pp1.coefs) + +# more tests of correctness for periodic boundary conditions +%!test cond='periodic'; +%! x = [1 2 4 5 6]'; y = [2 3 6 5 6]'; xi = 3; yi = 129/26; pp = csape (x, y, cond); +%!assert (ppval(pp, x), y, 10*eps); +%!assert (ppval(pp, xi), yi, 10*eps); +%!assert (ppval(ppder(pp), x(1)), ppval(ppder(pp), x(end)), 10*eps); +%!assert (ppval(ppder(pp, 2), x(1)), ppval(ppder(pp, 2), x(end)), 10*eps); +%! x = [1 2 4 6]'; y = [2 3 4 2]'; xi = 3; yi = 4 + 1/64; pp = csape (x, y, cond); +%!assert (ppval(pp, x), y, 10*eps); +%!assert (ppval(pp, xi), yi, 10*eps); +%!assert (ppval(ppder(pp), x(1)), ppval(ppder(pp), x(end)), 10*eps); +%!assert (ppval(ppder(pp, 2), x(1)), ppval(ppder(pp, 2), x(end)), 10*eps); +%! x = [1 2 4 5]'; y = [2 3 6 5]'; xi = 3; yi = 5.1; pp = csape (x, y, cond); +%!assert (ppval(pp, x), y, 10*eps); +%!assert (ppval(pp, xi), yi, 10*eps); +%!assert (ppval(ppder(pp), x(1)), ppval(ppder(pp), x(end)), 10*eps); +%!assert (ppval(ppder(pp, 2), x(1)), ppval(ppder(pp, 2), x(end)), 10*eps); +%! x = [1 2 4]'; y = [2 3 2]'; xi = 3; yi = 2.5; pp = csape (x, y, cond); +%!assert (ppval(pp, x), y, 10*eps); +%!assert (ppval(pp, xi), yi, 10*eps); +%!assert (ppval(ppder(pp), x(1)), ppval(ppder(pp), x(end)), 10*eps); +%!assert (ppval(ppder(pp, 2), x(1)), ppval(ppder(pp, 2), x(end)), 10*eps); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/splines-1.3.4/inst/csaps.m new/splines/inst/csaps.m --- old/splines-1.3.4/inst/csaps.m 2021-02-24 02:14:16.000000000 +0100 +++ new/splines/inst/csaps.m 2023-05-05 17:23:35.000000000 +0200 @@ -1,4 +1,4 @@ -## Copyright (C) 2012-2015 Nir Krakauer +## Copyright (C) 2012-2021 Nir Krakauer ## ## 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 @@ -14,8 +14,8 @@ ## along with this program; If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn{Function File}{[@var{yi} @var{p} @var{sigma2} @var{unc_yi} @var{df}] =} csaps(@var{x}, @var{y}, @var{p}, @var{xi}, @var{w}=[]) -## @deftypefnx{Function File}{[@var{pp} @var{p} @var{sigma2}] =} csaps(@var{x}, @var{y}, @var{p}, [], @var{w}=[]) +## @deftypefn{Function File}{[@var{yi} @var{p} @var{sigma2} @var{unc_yi} @var{df}] =} csaps(@var{x}, @var{y}, @var{p}=[], @var{xi}=[], @var{w}=[]) +## @deftypefnx{Function File}{[@var{pp} @var{p} @var{sigma2}] =} csaps(@var{x}, @var{y}, @var{p}=[], [], @var{w}=[]) ## ## Cubic spline approximation (smoothing)@* ## approximate [@var{x},@var{y}], weighted by @var{w} (inverse variance of the @var{y} values; if not given, equal weighting is assumed), at @var{xi} @@ -26,12 +26,13 @@ ## ## @var{x} and @var{w} should be n by 1 in size; @var{y} should be n by m; @var{xi} should be k by 1; the values in @var{x} should be distinct and in ascending order; the values in @var{w} should be nonzero ## +## @var{p} should be a scalar or empty:@* ## @table @asis ## @item @var{p}=0 ## maximum smoothing: straight line ## @item @var{p}=1 ## no smoothing: interpolation -## @item @var{p}<0 or not given +## @item @var{p}<0 or empty ## an intermediate amount of smoothing is chosen @* ## and the corresponding @var{p} between 0 and 1 is returned @* ## (such that the smoothing term and the interpolation term are of the same magnitude) @* @@ -55,18 +56,10 @@ ## Author: Nir Krakauer <nkrakauer@ccny.cuny.edu> -function [ret,p,sigma2,unc_yi,df]=csaps(x,y,p,xi,w) +function [ret,p,sigma2,unc_yi,df]=csaps(x,y,p=[],xi=[],w=[]) -warning ("off", "Octave:broadcast", "local"); - - if(nargin < 5) - w = []; - if(nargin < 4) - xi = []; - if(nargin < 3) - p = []; - endif - endif + if !(isscalar(p) || isempty(p)) + error('p should be a scalar or empty') endif if(columns(x) > 1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/splines-1.3.4/inst/csaps_sel.m new/splines/inst/csaps_sel.m --- old/splines-1.3.4/inst/csaps_sel.m 2021-02-24 02:14:16.000000000 +0100 +++ new/splines/inst/csaps_sel.m 2023-05-05 17:23:35.000000000 +0200 @@ -46,6 +46,8 @@ ## ## Grace Wahba (1983), Bayesian ``confidence intervals'' for the cross-validated smoothing spline, J Royal Statistical Society, 45B:133-150 ## +## Herman J. Woltring (1986), A Fortran package for generalized, cross-validatory spline smoothing and differentiation, Advances in Engineering Software, 8(2):104–113 +## ## @end deftypefn ## @seealso{csaps, spline, csapi, ppval, dedup, bin_values, gcvspl}
participants (1)
-
Source-Sync