oracle / fastr

A high-performance implementation of the R programming language, built on GraalVM.
Other
626 stars 64 forks source link

optim error #18

Closed rbotafogo closed 5 years ago

rbotafogo commented 6 years ago

Hello...

I'm trying a code with function optim from the R documentation and I'm getting an error:

fr <- function(x) { ## Rosenbrock Banana function x1 <- x[1] x2 <- x[2] 100 (x2 - x1 x1)^2 + (1 - x1)^2 } grr <- function(x) { ## Gradient of 'fr' x1 <- x[1] x2 <- x[2] c(-400 x1 (x2 - x1 x1) - 2 (1 - x1), 200 (x2 - x1 x1)) } optim(c(-1.2,1), fr)

Error in optim(c(-1.2, 1), fr) : unimplemented function at src/statsR_dummy.c:159

Thanks

steve-s commented 6 years ago

Hi Rodrigo,

thanks for the report. This is a native function "optim" from the stats package. This function hasn't been ported to FastR yet. We'll port it, but I cannot promise you any ETA at this point.

Note: FastR is capable of using native functions from R packages, however, some of the base packages, including stats, are using some non-APIs, which we do not implement. We have to inspect them and rewrite them to not use the non-APIs or completely port them to Java.

steve-s commented 5 years ago

Should be fixed in c14029558c88024729a1839fe6a18829401457f0