[Rd] R optim(method="L-BFGS-B"): unexpected behavior when working with parent environments

2019-05-03 Thread Florian Gerber
Dear all, when using optim() for a function that uses the parent environment, I see the following unexpected behavior: makeFn <- function(){     xx <- ret <- NA     fn <- function(x){    if(!is.na(xx) && x==xx){    cat("x=", xx, ", ret=", ret, " (memory)", fill=TRUE, sep="")  

[Rd] Why is matrix product slower when matrix has very small values?

2019-11-19 Thread Florian Gerber
Hi, I experience surprisingly large timing differences for the multiplication of matrices of the same dimension. An example is given below. How can this be explained? I posted the question on Stackoverflow: https://stackoverflow.com/questions/58886111/r-why-is-matrix-product-slower-when-matrix-has