renjin
renjin copied to clipboard
Adding arima.c, make build work
The arima.c get copied here, it include ARIMA_transPars function. C_ARIMA_transPars is defined in renjin.R. The build is working now, but for some reason the arima() report ERROR: Could not resolve native method ARIMA_transPars.
@akbertram, do you have any clue what I missed? Thanks in advance.
Can one of the admins verify this patch?
@bddbot add to whitelist
Looks good!
I think you are probably missing an entry in the stat package's NAMESPACE file.
Can you also add a simple test case for the arima
function? See test.stats.runmed.R for a simple example.
Thanks again!
Not quite easy..
After adding stuffs inside arima.c to NAMESPACE, now it report:
arima(lh, order = c(3,0,0), optim.method="Nelder-Mead") ERROR: Sorry! polyroot not yet implemented! java.lang.ClassNotFoundException: org.renjin.primitives.R$primitive$polyroot
Found a do_polyroot function inside complex.c of R source code: SEXP attribute_hidden do_polyroot(SEXP call, SEXP op, SEXP args, SEXP rho)
Not sure how to get this thing work, I don't even know where to put complex.c. Do you have any clue?
Yes, this is a bit trickier. polyroot is an internal base function that basically has two parts:
-
R_cpolyroot
and its subroutines constitute the actual C implementation of the algorithm and is largely independent of any R types or methods. It can be added to themath/nmath
module or perhaps we can create a newmath/complex
module. -
The
do_polyroot()
is the R wrapper for R_cpolyroot. Because it's in the base package, it's difficult to compile the C code directly, so I'd suggest just porting it to Java. In Renjin, internal functions are implemented as static methods and registered in thePrimitives
class. See thecomplex
function as an example.