diff -Nru octave-data-smoothing-1.2.0/ChangeLog octave-data-smoothing-1.2.3/ChangeLog --- octave-data-smoothing-1.2.0/ChangeLog 2009-05-08 13:34:27.000000000 +0000 +++ octave-data-smoothing-1.2.3/ChangeLog 1970-01-01 00:00:00.000000000 +0000 @@ -1,131 +0,0 @@ -# Automatically generated file --- DO NOT EDIT -2009-04-28 20:44 jjstickel - - * DESCRIPTION: updated the version number in the description file - for the data-smoothing package - -2009-04-28 20:38 jjstickel - - * DESCRIPTION, inst/ddmat.m, inst/regdatasmooth.m, - inst/rgdtsmcore.m, inst/rgdtsmcorewrap.m: updates to the - input/output options for some of the data-smoothing functions - -2009-02-25 21:03 jjstickel - - * DESCRIPTION, inst/regdatasmooth.m, inst/rgdtsmcore.m, - inst/rgdtsmcorewrap.m: updates to regularization data smoothing - functions and DESCRIPTION file - -2008-08-31 17:53 hauberg - - * trunk/octave-forge/main/comm/DESCRIPTION, DESCRIPTION, - trunk/octave-forge/main/fixed/DESCRIPTION, - trunk/octave-forge/main/image/DESCRIPTION, - trunk/octave-forge/main/odepkg/DESCRIPTION, - trunk/octave-forge/main/vrml/DESCRIPTION: Update version number - -2008-08-24 18:13 hauberg - - * DESCRIPTION: fix syntax error - -2008-08-21 14:24 jjstickel - - * inst/regdatasmooth.m, inst/rgdtsmcore.m, inst/rgdtsmcorewrap.m, - inst/tkrgdatasmdd.m, inst/tkrgdatasmddwrap.m, - inst/tkrgdatasmooth.m, inst/tkrgdatasmscat.m, - inst/tkrgdatasmscatwrap.m, inst/tkrgscatdatasmooth.m: rewritten - regularization smoothing functions - -2008-08-21 14:20 jjstickel - - * DESCRIPTION: rewritten regularization smoothing functions - -2008-04-30 14:19 jjstickel - - * inst/ddmat.m, inst/tkrgdatasmdd.m, inst/tkrgdatasmddwrap.m, - inst/tkrgdatasmooth.m, inst/tkrgdatasmscat.m, - inst/tkrgdatasmscatwrap.m, inst/tkrgscatdatasmooth.m: format help - text as texinfo - -2008-04-29 17:52 hauberg - - * trunk/octave-forge/extra/NaN/DESCRIPTION, - trunk/octave-forge/extra/Windows/DESCRIPTION, - trunk/octave-forge/extra/ad/DESCRIPTION, - trunk/octave-forge/extra/bim/DESCRIPTION, - trunk/octave-forge/extra/civil/DESCRIPTION, - trunk/octave-forge/extra/engine/DESCRIPTION, - trunk/octave-forge/extra/fpl/DESCRIPTION, - trunk/octave-forge/extra/graceplot/DESCRIPTION, - trunk/octave-forge/extra/integration/DESCRIPTION, - trunk/octave-forge/extra/java/DESCRIPTION, - trunk/octave-forge/extra/jhandles/DESCRIPTION, - trunk/octave-forge/extra/mapping/DESCRIPTION, - trunk/octave-forge/extra/msh/DESCRIPTION, - trunk/octave-forge/extra/multicore/DESCRIPTION, - trunk/octave-forge/extra/ocs/DESCRIPTION, - trunk/octave-forge/extra/pdb/DESCRIPTION, - trunk/octave-forge/extra/secs1d/DESCRIPTION, - trunk/octave-forge/extra/secs2d/DESCRIPTION, - trunk/octave-forge/extra/soctcl/DESCRIPTION, - trunk/octave-forge/extra/symband/DESCRIPTION, - trunk/octave-forge/extra/triangular/DESCRIPTION, - trunk/octave-forge/extra/tsa/DESCRIPTION, - trunk/octave-forge/extra/xraylib/DESCRIPTION, - trunk/octave-forge/language/pt_BR/DESCRIPTION, - trunk/octave-forge/main/ann/DESCRIPTION, - trunk/octave-forge/main/audio/DESCRIPTION, - trunk/octave-forge/main/bioinfo/DESCRIPTION, - trunk/octave-forge/main/combinatorics/DESCRIPTION, - trunk/octave-forge/main/comm/DESCRIPTION, - trunk/octave-forge/main/control/DESCRIPTION, DESCRIPTION, - trunk/octave-forge/main/database/DESCRIPTION, - trunk/octave-forge/main/econometrics/DESCRIPTION, - trunk/octave-forge/main/financial/DESCRIPTION, - trunk/octave-forge/main/fixed/DESCRIPTION, - trunk/octave-forge/main/ftp/DESCRIPTION, - trunk/octave-forge/main/ga/DESCRIPTION, - trunk/octave-forge/main/general/DESCRIPTION, - trunk/octave-forge/main/ident/DESCRIPTION, - trunk/octave-forge/main/image/DESCRIPTION, - trunk/octave-forge/main/info-theory/DESCRIPTION, - trunk/octave-forge/main/io/DESCRIPTION, - trunk/octave-forge/main/irsa/DESCRIPTION, - trunk/octave-forge/main/linear-algebra/DESCRIPTION, - trunk/octave-forge/main/miscellaneous/DESCRIPTION, - trunk/octave-forge/main/missing-functions/DESCRIPTION, - trunk/octave-forge/main/nnet/DESCRIPTION, - trunk/octave-forge/main/octcdf/DESCRIPTION, - trunk/octave-forge/main/octgpr/DESCRIPTION, - trunk/octave-forge/main/odebvp/DESCRIPTION, - trunk/octave-forge/main/odepkg/DESCRIPTION, - trunk/octave-forge/main/optim/DESCRIPTION, - trunk/octave-forge/main/optiminterp/DESCRIPTION, - trunk/octave-forge/main/outliers/DESCRIPTION, - trunk/octave-forge/main/parallel/DESCRIPTION, - trunk/octave-forge/main/physical-constants/DESCRIPTION, - trunk/octave-forge/main/plot/DESCRIPTION, - trunk/octave-forge/main/signal/DESCRIPTION, - trunk/octave-forge/main/sockets/DESCRIPTION, - trunk/octave-forge/main/specfun/DESCRIPTION, - trunk/octave-forge/main/special-matrix/DESCRIPTION, - trunk/octave-forge/main/splines/DESCRIPTION, - trunk/octave-forge/main/statistics/DESCRIPTION, - trunk/octave-forge/main/strings/DESCRIPTION, - trunk/octave-forge/main/struct/DESCRIPTION, - trunk/octave-forge/main/symbolic/DESCRIPTION, - trunk/octave-forge/main/time/DESCRIPTION, - trunk/octave-forge/main/video/DESCRIPTION, - trunk/octave-forge/main/vrml/DESCRIPTION, - trunk/octave-forge/main/zenity/DESCRIPTION, - trunk/octave-forge/nonfree/arpack/DESCRIPTION, - trunk/octave-forge/nonfree/spline-gsvspl/DESCRIPTION: Updated - release dates - -2008-04-02 14:04 jjstickel - - * ., COPYING, DESCRIPTION, inst, inst/ddmat.m, inst/tkrgdatasmdd.m, - inst/tkrgdatasmddwrap.m, inst/tkrgdatasmooth.m, - inst/tkrgdatasmscat.m, inst/tkrgdatasmscatwrap.m, - inst/tkrgscatdatasmooth.m: import data-smoothing package - diff -Nru octave-data-smoothing-1.2.0/configure octave-data-smoothing-1.2.3/configure --- octave-data-smoothing-1.2.0/configure 2009-05-08 13:34:27.000000000 +0000 +++ octave-data-smoothing-1.2.3/configure 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -#! /bin/sh -f - -if [ -e src/configure ]; then - cd src - ./configure $* -fi - diff -Nru octave-data-smoothing-1.2.0/debian/changelog octave-data-smoothing-1.2.3/debian/changelog --- octave-data-smoothing-1.2.0/debian/changelog 2011-02-23 22:08:08.000000000 +0000 +++ octave-data-smoothing-1.2.3/debian/changelog 2011-12-10 18:35:47.000000000 +0000 @@ -1,3 +1,19 @@ +octave-data-smoothing (1.2.3-1) unstable; urgency=low + + [ Sébastien Villemot ] + * Imported Upstream version 1.2.3 (Closes: #651064) + * Bump to debhelper compat level 8 + * Bump Standards-Version to 3.9.2, no changes needed + * Add myself to Uploaders + * debian/copyright: upgrade to latest DEP5 + + [ Thomas Weber ] + * Switch architecture to "all", the package contains only .m files. + * Remove debian/clean file; the current package doesn't have any of the + files mentioned there. + + -- Thomas Weber Sat, 10 Dec 2011 19:35:33 +0100 + octave-data-smoothing (1.2.0-3) unstable; urgency=low * debian/control: diff -Nru octave-data-smoothing-1.2.0/debian/clean octave-data-smoothing-1.2.3/debian/clean --- octave-data-smoothing-1.2.0/debian/clean 2011-02-23 21:59:12.000000000 +0000 +++ octave-data-smoothing-1.2.3/debian/clean 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -src/Makeconf src/config.log src/config.status diff -Nru octave-data-smoothing-1.2.0/debian/compat octave-data-smoothing-1.2.3/debian/compat --- octave-data-smoothing-1.2.0/debian/compat 2011-02-23 21:59:12.000000000 +0000 +++ octave-data-smoothing-1.2.3/debian/compat 2011-12-10 18:35:47.000000000 +0000 @@ -1 +1 @@ -7 +8 diff -Nru octave-data-smoothing-1.2.0/debian/control octave-data-smoothing-1.2.3/debian/control --- octave-data-smoothing-1.2.0/debian/control 2011-02-23 22:03:24.000000000 +0000 +++ octave-data-smoothing-1.2.3/debian/control 2011-12-10 18:35:47.000000000 +0000 @@ -2,16 +2,17 @@ Section: math Priority: optional Maintainer: Debian Octave Group -Uploaders: Thomas Weber +Uploaders: Thomas Weber , + Sébastien Villemot DM-Upload-Allowed: yes -Build-Depends: debhelper (>= 7.0.0), cdbs, octave-pkg-dev (>= 0.7.0) -Standards-Version: 3.9.1 +Build-Depends: debhelper (>= 8), cdbs, octave-pkg-dev (>= 0.7.0) +Standards-Version: 3.9.2 Homepage: http://octave.sourceforge.net/data-smoothing Vcs-Git: git://git.debian.org/git/pkg-octave/octave-data-smoothing.git Vcs-Browser: http://git.debian.org/?p=pkg-octave/octave-data-smoothing.git Package: octave-data-smoothing -Architecture: any +Architecture: all Depends: ${misc:Depends}, ${shlibs:Depends}, ${octave:Depends} Description: functions to do data smoothing on noisy data This package provides functions to do noisy data smoothing in Octave, diff -Nru octave-data-smoothing-1.2.0/debian/copyright octave-data-smoothing-1.2.3/debian/copyright --- octave-data-smoothing-1.2.0/debian/copyright 2011-02-23 22:02:23.000000000 +0000 +++ octave-data-smoothing-1.2.3/debian/copyright 2011-12-10 18:35:47.000000000 +0000 @@ -1,29 +1,55 @@ -Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?rev=48 +Format: http://dep.debian.net/deps/dep5/ Upstream-Name: data-smoothing package for Octave -Upstream-Maintainer: Jonathan Stickel -Upstream-Source: http://octave.sourceforge.net/data-smoothing/index.html +Upstream-Contact: Jonathan Stickel +Source: http://octave.sourceforge.net/data-smoothing/ Files: debian/* -Copyright: © 2008 Olafur Jens Sigurdsson -Copyright: © 2011 Thomas Weber +Copyright: 2008 Olafur Jens Sigurdsson + 2011 Thomas Weber License: GPL-3+ Files: inst/ddmat.m -Copyright: © (C) 2003 Paul Eilers +Copyright: 2003 Paul Eilers License: GPL-2+ Files: inst/rgdtsmcore.m inst/rgdtsmcorewrap.m inst/regdatasmooth.m -Copyright: © (C) 2008 Jonathan Stickel +Copyright: 2008 Jonathan Stickel License: GPL-2+ License: GPL-2+ + 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, see . + . On Debian systems, the complete text of the GNU General Public License, version 2, can be found in the file `/usr/share/common-licenses/GPL-2'. License: GPL-3+ + 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 3 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, see . + . On Debian systems, the complete text of the GNU General Public License, version 3, can be found in the file `/usr/share/common-licenses/GPL-3'. diff -Nru octave-data-smoothing-1.2.0/DESCRIPTION octave-data-smoothing-1.2.3/DESCRIPTION --- octave-data-smoothing-1.2.0/DESCRIPTION 2009-05-08 13:18:07.000000000 +0000 +++ octave-data-smoothing-1.2.3/DESCRIPTION 2011-10-06 21:37:42.000000000 +0000 @@ -1,12 +1,12 @@ Name: data-smoothing -Version: 1.2.0 -Date: 2009-04-28 -Author: Jonathan Stickel -Maintainer: Jonathan Stickel +Version: 1.2.3 +Date: 2011-10-06 +Author: Jonathan Stickel +Maintainer: Jonathan Stickel Title: Data smoothing Description: Algorithms for smoothing noisy data Categories: Data-smoothing -Depends: octave (>= 2.9.7), optim (>= 1.0.3) +Depends: octave (>= 3.0.0), optim (>= 1.0.3) Autoload: yes License: GPL version 2 or later Url: http://octave.sf.net diff -Nru octave-data-smoothing-1.2.0/inst/ddmat.m octave-data-smoothing-1.2.3/inst/ddmat.m --- octave-data-smoothing-1.2.0/inst/ddmat.m 2009-05-08 13:18:07.000000000 +0000 +++ octave-data-smoothing-1.2.3/inst/ddmat.m 2011-10-06 00:53:41.000000000 +0000 @@ -1,4 +1,5 @@ ## Copyright (C) 2003 Paul Eilers +## ## 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 @@ -13,31 +14,30 @@ ## along with this program; If not, see . ## -*- texinfo -*- -##@deftypefn {Function File} {@var{D} =} ddmat (@var{x}, @var{o}) +## @deftypefn {Function File} {@var{D} =} ddmat (@var{x}, @var{o}) ## Compute divided differencing matrix of order @var{o} ## ## @itemize @w ## @item Input ## @itemize @w -## @item @var{x}: vector of sampling positions -## @item @var{o}: order of diffferences +## @item @var{x}: vector of sampling positions +## @item @var{o}: order of diffferences ## @end itemize ## @item Output ## @itemize @w -## @item @var{D}: the matrix; @var{D} * Y gives divided differences of order @var{o} +## @item @var{D}: the matrix; @var{D} * Y gives divided differences of order @var{o} ## @end itemize ## @end itemize ## -##References: Anal. Chem. (2003) 75, 3631. +## References: Anal. Chem. (2003) 75, 3631. ## ## @end deftypefn ## corrected the recursion multiplier; JJS 2/25/08 ## added error check that x is a column vector; JJS 4/13/09 - function D = ddmat(x, d) - if ( size(x)(2) != 1 ) + if ( size(x,2) != 1 ) error("x should be a column vector") endif m = length(x); @@ -45,7 +45,7 @@ D = speye(m); else dx = x((d + 1):m) - x(1:(m - d)); - V = spdiags(1 ./ dx, 0, m - d, m - d); + V = sparse(diag(1 ./ dx)); D = d * V * diff(ddmat(x, d - 1)); endif endfunction diff -Nru octave-data-smoothing-1.2.0/inst/regdatasmooth.m octave-data-smoothing-1.2.3/inst/regdatasmooth.m --- octave-data-smoothing-1.2.0/inst/regdatasmooth.m 2009-05-08 13:18:07.000000000 +0000 +++ octave-data-smoothing-1.2.3/inst/regdatasmooth.m 2011-10-06 00:53:41.000000000 +0000 @@ -1,4 +1,5 @@ -## Copyright (C) 2008 Jonathan Stickel +## Copyright (C) 2008 Jonathan Stickel +## ## 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 @@ -57,7 +58,7 @@ ## Please run the demos for example usage. ## ## References: Anal. Chem. (2003) 75, 3631; AIChE J. (2006) 52, 325 -## @seealso{rgdtsmcore} +## @seealso{rgdtsmcorewrap, rgdtsmcore} ## @end deftypefn function [yhat, lambda] = regdatasmooth (x, y, varargin) @@ -76,22 +77,22 @@ for i = 1:nargin-2 arg = varargin{i}; if ischar(arg) - switch arg - case "d" - d = varargin{i+1}; - idx = [idx,i,i+1]; - case "lambda" - lambda = varargin{i+1}; - idx = [idx,i,i+1]; - case "stdev" - stdev = varargin{i+1}; - idx = [idx,i,i+1]; - case "gcv" - idx = [idx,i]; - case "lguess" - guess = log10(varargin{i+1}); - idx = [idx,i,i+1]; - endswitch + switch arg + case "d" + d = varargin{i+1}; + idx = [idx,i,i+1]; + case "lambda" + lambda = varargin{i+1}; + idx = [idx,i,i+1]; + case "stdev" + stdev = varargin{i+1}; + idx = [idx,i,i+1]; + case "gcv" + idx = [idx,i]; + case "lguess" + guess = log10(varargin{i+1}); + idx = [idx,i,i+1]; + endswitch endif endfor endif @@ -100,35 +101,50 @@ ## add warning if more than one gcv, lambda, or stdev options provided? - if (length(x)!=length(y)) + if ( length(x) != length(y) ) error("x and y must be equal length vectors") endif - if ( size(x)(1)==1 ) + if ( size(x,1) == 1 ) x = x'; endif - if ( size(y)(1)==1 ) + if ( size(y,1) == 1 ) y = y'; endif + maxiter = 50; if (lambda) ## do nothing and use the provided lambda - elseif ( stdev ) - opt = optimset("TolFun",1e-6,"MaxFunEvals",20); - log10lambda = fminunc ("rgdtsmcorewrap", guess, opt, x, y, d, {"stdev", stdev}, options{:}); - lambda = 10^log10lambda; else - ## perform cross-validation - opt = optimset("TolFun",1e-4,"MaxFunEvals",20); - log10lambda = fminunc ("rgdtsmcorewrap", guess, opt, x, y, d, {"cve"}, options{:}); + ## find the "optimal" lambda + if ( stdev ) + ## match standard deviation + fhandle = @(log10lambda) rgdtsmcorewrap (log10lambda, x, y, d, {"stdev", stdev}, options{:}); + else + ## perform cross-validation + fhandle = @(log10lambda) rgdtsmcorewrap (log10lambda, x, y, d, {"cve"}, options{:}); + endif + ## "fminunc" works OK, but a derivative-free method (below) is better for this problem + ##opt = optimset("TolFun",1e-6,"MaxFunEvals",maxiter); + ##[log10lambda,fout,exitflag] = fminunc (fhandle, guess, opt); + ##[log10lambda,fout,exitflag] = fminunc_compat (fhandle, guess, opt); + ## derivative-free optimization; should use "fminsearch" for Matlab + ## compatibility, but fminsearch needs updates to be more compatible itself + [log10lambda, fout, niter] = nelder_mead_min (fhandle, guess, "ftol", 1e-6, "maxev", maxiter); + if (niter > maxiter) + exitflag = 0; + else + exitflag = 1; + endif + if (!exitflag) + warning("Iteration limit of %i exceeded\n",maxiter) + endif lambda = 10^log10lambda; endif - %%ys = tkrgdatasmdd(x, y, lambda, d); yhat = rgdtsmcore (x, y, d, lambda, options{:}); endfunction -## rewrite the demos! %!demo %! npts = 100; diff -Nru octave-data-smoothing-1.2.0/inst/rgdtsmcore.m octave-data-smoothing-1.2.3/inst/rgdtsmcore.m --- octave-data-smoothing-1.2.0/inst/rgdtsmcore.m 2009-05-08 13:18:07.000000000 +0000 +++ octave-data-smoothing-1.2.3/inst/rgdtsmcore.m 2011-10-06 21:34:48.000000000 +0000 @@ -1,4 +1,5 @@ -## Copyright (C) 2008 Jonathan Stickel +## Copyright (C) 2008 Jonathan Stickel +## ## 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 @@ -26,22 +27,23 @@ ## Note: the options have changed! ## Currently supported input options are (multiple options are allowed): ## -##@table @code -##@item "xhat", @var{vector} -## A vector of x-values to use for the smooth curve; must be -## monotonically increasing and must at least span the data -##@item "weights", @var{vector} -## A vector of weighting values for fitting each point in the data. -##@item "relative" -## use relative differences for the goodnes of fit term. Conflicts -## with the "weights" option. -##@item "midpointrule" -## use the midpoint rule for the integration terms rather than a direct -## sum; this option conflicts with the option "xhat" -##@end table +## @table @code +## @item "xhat", @var{vector} +## A vector of x-values to use for the smooth curve; must be +## monotonically increasing and must at least span the data +## @item "weights", @var{vector} +## A vector of weighting values for fitting each point in the data. +## @item "relative" +## use relative differences for the goodnes of fit term. Conflicts +## with the "weights" option. +## @item "midpointrule" +## use the midpoint rule for the integration terms rather than a direct +## sum; this option conflicts with the option "xhat" +## @end table ## ## References: Anal. Chem. (2003) 75, 3631; AIChE J. (2006) 52, 325 -##@end deftypefn +## @seealso{regdatasmooth} +## @end deftypefn function [yhat, v] = rgdtsmcore (x, y, d, lambda, varargin) @@ -58,20 +60,20 @@ for i = 1:length(varargin) arg = varargin{i}; if ischar(arg) - switch arg - case "xhat" - xhatprov = 1; - xhat = varargin{i+1}; - case "weights" - weights = 1; - weightv = varargin{i+1}; - case "relative" - relative = 1; - case "midpointrule" - midpr = 1; - otherwise - printf("Option '%s' is not implemented;\n", arg) - endswitch + switch arg + case "xhat" + xhatprov = 1; + xhat = varargin{i+1}; + case "weights" + weights = 1; + weightv = varargin{i+1}; + case "relative" + relative = 1; + case "midpointrule" + midpr = 1; + otherwise + printf("Option '%s' is not implemented;\n", arg) + endswitch endif endfor endif @@ -101,7 +103,7 @@ ## construct M, D M = speye(Nhat); - idx = interp1(xhat,1:Nhat,x,"nearest"); # works for unequal spaced xhat + idx = interp1(xhat,1:Nhat,x,"nearest"); # works for unequally spaced xhat M = M(idx,:); D = ddmat(xhat,d); @@ -111,17 +113,17 @@ W = diag(weightv); elseif (relative) ## use relative differences - Yinv = spdiag(1./y); + Yinv = sparse(diag(1./y)); W = Yinv^2; else W = speye(N); endif ## use midpoint rule integration (rather than simple sums) if (midpr) - Bhat = spdiag(-ones(N-1,1),-1) + spdiag(ones(N-1,1),1); + Bhat = sparse(diag(-ones(N-1,1),-1)) + sparse(diag(ones(N-1,1),1)); Bhat(1,1) = -1; Bhat(N,N) = 1; - B = 1/2*spdiag(Bhat*x); + B = 1/2*sparse(diag(Bhat*x)); if ( floor(d/2) == d/2 ) # test if d is even dh = d/2; Btilda = B(dh+1:N-dh,dh+1:N-dh); @@ -153,4 +155,8 @@ v = (M*yhat - y)'*(M*yhat - y)/N / (1 - trace(H)/N)^2; endif + ## test mapping + ##figure(5) + ##plot(x,y,'o',x,M*yhat,'x') + endfunction diff -Nru octave-data-smoothing-1.2.0/inst/rgdtsmcorewrap.m octave-data-smoothing-1.2.3/inst/rgdtsmcorewrap.m --- octave-data-smoothing-1.2.0/inst/rgdtsmcorewrap.m 2009-05-08 13:18:07.000000000 +0000 +++ octave-data-smoothing-1.2.3/inst/rgdtsmcorewrap.m 2011-10-06 00:53:41.000000000 +0000 @@ -1,4 +1,5 @@ -## Copyright (C) 2008 Jonathan Stickel +## Copyright (C) 2008 Jonathan Stickel +## ## 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 @@ -13,12 +14,14 @@ ## along with this program; If not, see . ## -*- texinfo -*- -## @deftypefn {Function File} {@var{cve}|@var{stdevdif} =} rgdtsmcorewrap (@var{log10lambda}, @var{x}, @var{y}, @var{d}, @var{mincell}, @var{options}) +## @deftypefn {Function File} {@var{cve} =} rgdtsmcorewrap (@var{log10lambda}, @var{x}, @var{y}, @var{d}, @var{mincell}, @var{options}) +## @deftypefnx {Function File} {@var{stdevdif} =} rgdtsmcorewrap (@var{log10lambda}, @var{x}, @var{y}, @var{d}, @var{mincell}, @var{options}) ## ## Wrapper function for rgdtsmcore in order to minimize over ## @var{lambda} w.r.t. cross-validation error OR the squared difference ## between the standard deviation of (@var{y}-@var{yhat}) and the given ## standard deviation. This function is called from regdatasmooth. +## @seealso{regdatasmooth} ## @end deftypefn @@ -26,41 +29,40 @@ lambda = 10^(log10lambda); - if ( length(mincell)==2 ) # using stdev to find optimal lambda + if ( length(mincell) == 2 ) # using stdev to find optimal lambda stdev = mincell{2}; - yhat = rgdtsmcore (x, y, d, lambda, varargin{:}); + yhat = rgdtsmcore (x, y, d, lambda, varargin{:}); xhatprov = 0; relative = 0; for i = 1:length(varargin) if strcmp(varargin{i},"relative") - relative = 1; + relative = 1; elseif strcmp(varargin{i},"xhat") - xhatprov = 1; - xhat = varargin{i+1}; + xhatprov = 1; + xhat = varargin{i+1}; endif endfor if (xhatprov) idx = interp1(xhat,1:length(xhat),x,"nearest"); if relative - stdevd = std((y-yhat(idx))./y); + stdevd = std((y-yhat(idx))./y); else - stdevd = std(y-yhat(idx)); + stdevd = std(y-yhat(idx)); endif else if (relative) - stdevd = std((y-yhat)./y); + stdevd = std((y-yhat)./y); else - stdevd = std(y-yhat); + stdevd = std(y-yhat); endif endif out = (stdevd - stdev)^2; else # use gcv to find optimal lambda - [yhat, cve] = rgdtsmcore (x, y, d, lambda, varargin{:}); - out = cve; + [yhat, out] = rgdtsmcore (x, y, d, lambda, varargin{:}); endif endfunction diff -Nru octave-data-smoothing-1.2.0/Makefile octave-data-smoothing-1.2.3/Makefile --- octave-data-smoothing-1.2.0/Makefile 2009-05-08 13:34:27.000000000 +0000 +++ octave-data-smoothing-1.2.3/Makefile 1970-01-01 00:00:00.000000000 +0000 @@ -1,75 +0,0 @@ -## Generic Makefile to allow the octave-forge packages to be build and -## installed using "configure; make all; make install". This Makefile -## includes the capability to install to a temporary location, and install -## an on_uninstall.m file that prevents the user removing this package -## with Octave's package manager. This is useful for for the distribution's -## various package managers and is forced by defining DESTDIR and DISTPKG. - -PKGDIR := $(shell pwd | sed -e 's|^.*/||') -TMPDIR ?= /tmp -PACKAGE ?= $(TMPDIR)/$(PKGDIR).tar.gz -PKG := $(shell echo $(PKGDIR) | sed -e 's|^\(.*\)-.*|\1|') - -all: build package - -build: - @if [ -e src/Makefile ]; then \ - $(MAKE) -C src all; \ - fi - -package: build - @if [ -e src/Makefile ]; then \ - mv src/Makefile src/Makefile.disable; \ - fi; \ - if [ -e src/configure ]; then \ - mv src/configure src/configure.disable; \ - fi; \ - cd ..; tar -czf $(PACKAGE) $(PKGDIR); \ - -install: - @cd ../; \ - if [ "X${DISTPKG}X" != "XX" ]; then \ - stripcmd="unlink(pkg('local_list'));unlink(pkg('global_list'));"; \ - fi; \ - if [ "X$(DESTDIR)X" = "XX" ]; then \ - pkgdir=`octave -H -q --no-site-file --eval "warning('off','all');pkg('install','$(PACKAGE)');l=pkg('list');disp(l{cellfun(@(x)strcmp(x.name,'$(PKG)'),l)}.dir);$$stripcmd;"`; \ - else \ - shareprefix=$(DESTDIR)/`octave -H -q --no-site-file --eval "disp(fullfile(OCTAVE_HOME(),'share','octave'));"`; \ - libexecprefix=$(DESTDIR)/`octave -H -q --no-site-file --eval "disp(fullfile(octave_config_info('libexecdir'),'octave'));"`; \ - octprefix=$$shareprefix/packages; \ - archprefix=$$libexecprefix/packages; \ - if [ ! -e $$octprefix ]; then \ - mkdir -p $$octprefix; \ - fi; \ - if [ ! -e $$archprefix ]; then \ - mkdir -p $$archprefix; \ - fi; \ - octave -H -q --no-site-file --eval "warning('off','all');pkg('prefix','$$octprefix','$$archprefix');pkg('global_list',fullfile('$$shareprefix','octave_packages'));pkg('local_list',fullfile('$$shareprefix','octave_packages'));pkg('install','-nodeps','-verbose','$(PACKAGE)');"; \ - pkgdir=`octave -H -q --no-site-file --eval "warning('off','all');pkg('prefix','$$octprefix','$$archprefix');pkg('global_list',fullfile('$$shareprefix','octave_packages'));pkg('local_list',fullfile('$$shareprefix','octave_packages'));l=pkg('list');disp(l{cellfun(@(x)strcmp(x.name,'$(PKG)'),l)}.dir);$$stripcmd;"`; \ - fi; \ - if [ "X${DISTPKG}X" != "XX" ]; then \ - if [ -e $$pkgdir/packinfo/on_uninstall.m ]; then \ - mv $$pkgdir/packinfo/on_uninstall.m \ - $$pkgdir/packinfo/on_uninstall.m.orig; \ - fi; \ - echo "function on_uninstall (desc)" > $$pkgdir/packinfo/on_uninstall.m; \ - echo " error ('Can not uninstall %s installed by the $(DISTPKG) package manager', desc.name);" >> $$pkgdir/packinfo/on_uninstall.m; \ - echo "endfunction" >> $$pkgdir/packinfo/on_uninstall.m; \ - echo "#! /bin/sh -f" > $$pkgdir/packinfo/dist_admin; \ - echo "if [ \"\$$1\" == \"install\" ]; then" >> $$pkgdir/packinfo/dist_admin; \ - echo " octave -H -q --no-site-file --eval \"pkg('rebuild');\"" >> $$pkgdir/packinfo/dist_admin; \ - echo "else" >> $$pkgdir/packinfo/dist_admin; \ - echo " pkgdir=\`octave -H -q --no-site-file --eval \"pkg('rebuild');l=pkg('list');disp(l{cellfun(@(x)strcmp(x.name,'$(PKG)'),l)}.dir);\"\`" >> $$pkgdir/packinfo/dist_admin; \ - echo " rm \$$pkgdir/packinfo/on_uninstall.m" >> $$pkgdir/packinfo/dist_admin; \ - echo " if [ -e \$$pkgdir/packinfo/on_uninstall.m.orig ]; then" >> $$pkgdir/packinfo/dist_admin; \ - echo " mv \$$pkgdir/packinfo/on_uninstall.m.orig \$$pkgdir/packinfo/on_uninstall.m" >> $$pkgdir/packinfo/dist_admin; \ - echo " cd \$$pkgdir/packinfo" >> $$pkgdir/packinfo/dist_admin; \ - echo " octave -q -H --no-site-file --eval \"l=pkg('list');on_uninstall(l{cellfun(@(x)strcmp(x.name,'$(PKG)'),l)});\"" >> $$pkgdir/packinfo/dist_admin; \ - echo " fi" >> $$pkgdir/packinfo/dist_admin; \ - echo "fi" >> $$pkgdir/packinfo/dist_admin; \ - chmod a+x $$pkgdir/packinfo/dist_admin; \ - fi; - -clean: - rm $(PACKAGE) - $(MAKE) -C src clean