I've just encountered a segfault when using DierckxSpline::percur function. Below is the minimal example which triggers the error: --- library(DierckxSpline) x <- 1:10 y <- rep(0, 10) pspline <- percur(x, y) --- *** caught segfault *** address (nil), cause 'memory not mapped' Traceback: 1: .Fortran("percur", iopt = as.integer(iopt), m = as.integer(m), x = as.single(x), y = as.single(y), w = as.single(w), k = k, s as.single(s), nest = as.integer(nest), n = as.integer(n), knots Knots, coef = coef, fp = single(1), wrk = wrk, lwrk = lwrk, iwrk iwrk, ier = integer(1)) 2: curfitSS(xyw, s = s, knots = knots, n = n, from = From, to = To, k = k, periodic = periodic, ...) 3: curfit.default(x, periodic = TRUE, ...) 4: curfit(x, periodic = TRUE, ...) 5: percur(x, y) Possible actions: 1: abort (with core dump, if enabled) 2: normal R exit 3: exit R without saving workspace 4: exit R saving workspace Selection: --- Package: DierckxSpline Type: Package Title: R companion to "Curve and Surface Fitting with Splines" Version: 1.1-2 Date: 2007-7-31 Author: Sundar Dorai-Raj Maintainer: Sundar Dorai-Raj <sundar.dorai-raj at pdf.com> Description: This package provides a wrapper to the FITPACK routines written by Paul Dierckx. The original Fortran is available from http://www.netlib.org/dierckx License: GPL (>= 2) Depends: R (>= 2.4.0), stats, lattice, PolynomF Suggests: fda, splines Packaged: Sun Jan 11 13:08:12 2009; spencerg Built: R 2.8.1; i486-pc-linux-gnu; 2009-01-17 10:21:01; unix --- I'm ready to provide any additional info, Andrey
Thanks for this bug report. I've replicated the problem using your excellent example. Unfortunately, this may not be an easy bug to fix. Might it be feasible for you to use either the 'periodicSpline' function in the 'splines' package or a Fourier basis in the 'fda' package? Best Wishes, Spencer Graves ?????? ????????? wrote:> I've just encountered a segfault when using DierckxSpline::percur > function. Below is the minimal example which triggers the error: > > --- > > library(DierckxSpline) > x <- 1:10 > y <- rep(0, 10) > pspline <- percur(x, y) > > --- > > *** caught segfault *** > address (nil), cause 'memory not mapped' > > Traceback: > 1: .Fortran("percur", iopt = as.integer(iopt), m = as.integer(m), > x = as.single(x), y = as.single(y), w = as.single(w), k = k, s > as.single(s), nest = as.integer(nest), n = as.integer(n), knots > Knots, coef = coef, fp = single(1), wrk = wrk, lwrk = lwrk, iwrk > iwrk, ier = integer(1)) > 2: curfitSS(xyw, s = s, knots = knots, n = n, from = From, to = To, > k = k, periodic = periodic, ...) > 3: curfit.default(x, periodic = TRUE, ...) > 4: curfit(x, periodic = TRUE, ...) > 5: percur(x, y) > > Possible actions: > 1: abort (with core dump, if enabled) > 2: normal R exit > 3: exit R without saving workspace > 4: exit R saving workspace > Selection: > > --- > > Package: DierckxSpline > Type: Package > Title: R companion to "Curve and Surface Fitting with Splines" > Version: 1.1-2 > Date: 2007-7-31 > Author: Sundar Dorai-Raj > Maintainer: Sundar Dorai-Raj <sundar.dorai-raj at pdf.com> > Description: This package provides a wrapper to the FITPACK routines > written by Paul Dierckx. The original Fortran is > available from http://www.netlib.org/dierckx > License: GPL (>= 2) > Depends: R (>= 2.4.0), stats, lattice, PolynomF > Suggests: fda, splines > Packaged: Sun Jan 11 13:08:12 2009; spencerg > Built: R 2.8.1; i486-pc-linux-gnu; 2009-01-17 10:21:01; unix > > --- > > I'm ready to provide any additional info, > Andrey > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > >
Hello: The following shows how to fit a simple periodic function to data using Fourier bases in the 'fda' package. Fixing the bug you reported in the 'percur' function may not be easy. (To my knowledge, the primary capability in the 'DierckxSpline' package not otherwise available in R is the ability to estimate knot locations with the free-knot spline function, 'curfit.free.knot'. For other purposes, users may be wiser to use other packages.) Hope this helps. Spencer Graves # problem x <- seq(0.2, 0.8, 0.01) y <- cos(2*pi*x^2) + 0.1*rnorm(length(x)) plot(x, y, xlim=0:1) # simple solution library(fda) Fourier1 <- create.fourier.basis() FourierFit <- Data2fd(x, y, Fourier1) plotfit.fd(y, x, FourierFit) # Allow more flexibility Fourier9 <- create.fourier.basis(nbasis=2*9+1) # constant + 9 cosine & sine terms # Naive initial solution FourierSmooth0 <- smooth.basisPar(x, y, Fourier9) plotfit.fd(y, x, FourierSmooth0$fd) # Oops: Need some smoothing # Try again. FourierSmooth1 <- smooth.basisPar(x, y, Fourier9, lambda=1) plotfit.fd(y, x, FourierSmooth1$fd) # Much better. ######################### Thanks for this bug report. I've replicated the problem using your excellent example. Unfortunately, this may not be an easy bug to fix. Might it be feasible for you to use either the 'periodicSpline' function in the 'splines' package or a Fourier basis in the 'fda' package? Best Wishes, Spencer Graves ?????? ????????? wrote:> I've just encountered a segfault when using DierckxSpline::percur > function. Below is the minimal example which triggers the error: > > --- > > library(DierckxSpline) > x <- 1:10 > y <- rep(0, 10) > pspline <- percur(x, y) > > --- > > *** caught segfault *** > address (nil), cause 'memory not mapped' > > Traceback: > 1: .Fortran("percur", iopt = as.integer(iopt), m = as.integer(m), > x = as.single(x), y = as.single(y), w = as.single(w), k = k, s > as.single(s), nest = as.integer(nest), n = as.integer(n), knots > Knots, coef = coef, fp = single(1), wrk = wrk, lwrk = lwrk, iwrk > iwrk, ier = integer(1)) > 2: curfitSS(xyw, s = s, knots = knots, n = n, from = From, to = To, > k = k, periodic = periodic, ...) > 3: curfit.default(x, periodic = TRUE, ...) > 4: curfit(x, periodic = TRUE, ...) > 5: percur(x, y) > > Possible actions: > 1: abort (with core dump, if enabled) > 2: normal R exit > 3: exit R without saving workspace > 4: exit R saving workspace > Selection: > > --- > > Package: DierckxSpline > Type: Package > Title: R companion to "Curve and Surface Fitting with Splines" > Version: 1.1-2 > Date: 2007-7-31 > Author: Sundar Dorai-Raj > Maintainer: Sundar Dorai-Raj <sundar.dorai-raj at pdf.com> > Description: This package provides a wrapper to the FITPACK routines > written by Paul Dierckx. The original Fortran is > available from http://www.netlib.org/dierckx > License: GPL (>= 2) > Depends: R (>= 2.4.0), stats, lattice, PolynomF > Suggests: fda, splines > Packaged: Sun Jan 11 13:08:12 2009; spencerg > Built: R 2.8.1; i486-pc-linux-gnu; 2009-01-17 10:21:01; unix > > --- > > I'm ready to provide any additional info, > Andrey > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > >