Microsoft R Open 3.4.2 The enhanced R distribution from Microsoft Microsoft packages Copyright (C) 2017 Microsoft Corporation
Using the Intel MKL for parallel mathematical computing (using 12 cores). Default CRAN mirror snapshot taken on 2017-10-15. See: https://mran.microsoft.com/. > f <- function(x) sum( log(diff(x)^2+.01) + (x[1]-1)^2 ) > opt <- nlminb(rep(0, 10), f, lower=-1, upper=3) > xhat <- rep(1, 10) > abs( opt$objective - f(xhat) ) < 1e-4 ## Must be TRUE [1] FALSE > opt$objective - f(xhat) [1] 3.696533 > str(opt) List of 6 $ par : num [1:10] 0.797 0.303 0.285 0.271 0.258 ... $ objective : num -37.7 $ convergence: int 1 $ iterations : int 150 $ evaluations: Named int [1:2] 155 1611 ..- attr(*, "names")= chr [1:2] "function" "gradient" $ message : chr "iteration limit reached without convergence (10)" Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Jan 29, 2019 at 3:59 AM Kasper Kristensen via R-devel < r-devel@r-project.org> wrote: > I've noticed unstable behavior of nlminb on some Linux systems. The > problem can be reproduced by compiling R-3.5.2 using gcc-8.2 and running > the following snippet: > > f <- function(x) sum( log(diff(x)^2+.01) + (x[1]-1)^2 ) > opt <- nlminb(rep(0, 10), f, lower=-1, upper=3) > xhat <- rep(1, 10) > abs( opt$objective - f(xhat) ) < 1e-4 ## Must be TRUE > > The example works perfectly when removing the bounds. However, when bounds > are added the snippet returns 'FALSE'. > > An older R version (3.4.4), compiled using the same gcc-8.2, did not have > the problem. Between the two versions R has changed the flags to compile > Fortran sources: > > < SAFE_FFLAGS = -O2 -fomit-frame-pointer -ffloat-store > --- > > SAFE_FFLAGS = -O2 -fomit-frame-pointer -msse2 -mfpmath=sse > > Reverting to the old SAFE_FFLAGS 'solves' the problem. > > > sessionInfo() > R version 3.5.2 (2018-12-20) > Platform: x86_64-pc-linux-gnu (64-bit) > Running under: Scientific Linux release 6.4 (Carbon) > > Matrix products: default > BLAS/LAPACK: > /zdata/groups/nfsopt/intel/2018update3/compilers_and_libraries_2018.3.222/linux/mkl/lib/intel64_lin/libmkl_gf_lp64.so > > locale: > [1] C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > loaded via a namespace (and not attached): > [1] compiler_3.5.2 > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > [[alternative HTML version deleted]] ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel