[R] double integral with C

Stefano matz at davide.it
Wed Jan 24 15:37:59 CET 2007


Hi all,
This is more a C querie rather than a R one:
I'm writing a C code passing a function F to adapt fortran subroutine. I
need to integrate over two variables of F, call them x1 and x2. Then I
call the C code in R to optimize the integrated F function.
for example F could be defined as
---------------------------------------
static double marg_like(const double *param,
            double x1,
            double x2){...........}
---------------------------------------
Then I integrate over x1 and x2 with
-------------------------------------------------
F77_CALL(adapt)(2,(-5,-5),(5,5),100,1700,F,0.01,10000)
-------------------------------------------------

So here my question: I should I define x1 and x2? For the time being I
defined them as static variables, i.e.
static double x1;
static double x2;

but I'm pretty sure this is wrong

Any hint?
thanks in advance
Stefano



More information about the R-help mailing list