Robert McDonald
2011-Oct-22 00:19 UTC
[R] Segfault and bad output with fOptions::rnorm.sobol
I have had the following problem with R 2.10, 2.13.1, and 2.13.2, running on Ubuntu linux 10.04, xubuntu 11.10, and a version of Redhat (I think 5). rnorm.sobol is producing impossible random values, and occasionally the routine crashes. Here are samples of the output and the crash message. library(fOptions) Zs <- rnorm.sobol(50, dimension=1) produces this: [,1] [1,] 0.000000e+00 [2,] -3.550884e-28 [3,] -3.550884e-28 [4,] 7.297639e+37 [5,] -6.740677e+01 [6,] 7.297639e+37 [7,] -6.740677e+01 [8,] 3.648857e-09 [9,] NaN etc. Sometimes I get a segfault: Rmetrics Package fOptions (2140.79) loaded. *** caught segfault *** address (nil), cause 'memory not mapped' Traceback: 1: .Fortran("sobol", as.double(qn), as.integer(n), as.integer(dimension), as.double(.getfOptionsEnv(".rnorm.sobol.seed")$quasi), as.integer(.getfOptionsEnv(".rnorm.sobol.seed")$ll), as.integer(.getfOptionsEnv(".rnorm.sobol.seed")$count), as.integer(.getfOptionsEnv(".rnorm.sobol.seed")$sv), as.integer(scrambling), as.integer(.getfOptionsEnv(".rnorm.sobol.seed")$seed), as.integer(init), as.integer(1), PACKAGE = "fOptions") 2: rnorm.sobol(cohortsize, dimension = 1, init = FALSE) 3: eval.with.vis(expr, envir, enclos) 4: eval.with.vis(ei, envir) 5: source("monte.R") Here is my sessionInfo() R version 2.10.1 (2009-12-14) x86_64-pc-linux-gnu locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] fOptions_2100.76 fBasics_2100.78 MASS_7.3-5 timeSeries_2110.87 [5] timeDate_2110.87>Thanks, Bob [[alternative HTML version deleted]]
Robert McDonald
2011-Oct-22 12:48 UTC
[R] Segfault and bad output with fOptions::rnorm.sobol
On Sat, Oct 22, 2011 at 2:45 AM, Patrick Burns <pburns@pburns.seanet.com>wrote:> This should really go to Rmetrics > since it is a bug in their code. > > You could find out more specifically > where the problem is by running it > under valgrind. > > First you have to have valgrind, then > start R with it: > > R -d valgrind > > then do your command. > > Good luck, > PatThank you. Bob [[alternative HTML version deleted]]
Robert McDonald <rmcd1024 <at> gmail.com> writes:> I have had the following problem with R 2.10, 2.13.1, and 2.13.2, running on > Ubuntu linux 10.04, xubuntu 11.10, and a version of Redhat (I think 5). > rnorm.sobol is producing impossible random values, and occasionally the > routine crashes. Here are samples of the output and the crash message. > > library(fOptions) > Zs <- rnorm.sobol(50, dimension=1) >[snip]> other attached packages: > [1] fOptions_2100.76 fBasics_2100.78 MASS_7.3-5 > timeSeries_2110.87 > [5] timeDate_2110.87 > >I think your question is answered by http://cran.r-project.org/web/packages/fOptions/ChangeLog 2010-04-23 chalabi * ChangeLog, DESCRIPTION: updated DESCR and ChangeLog * src/085A-LowDiscrepancy.f: fixed sobol RVS on 64 bit platform * ChangeLog, DESCRIPTION: updated DESC and ChangeLog The middle item seems to address your problem exactly. That fix is 18 months old, so updating might be a good idea ... Ben Bolker