[Rd] double integral with C code

Stefano Mazzuco rough989 at gmail.com
Fri Jan 26 11:30:36 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

P.S. Sorry for having posted this in the R-help section, was an unintended mistake.



More information about the R-devel mailing list