[Rd] double integral with C code

From: Stefano Mazzuco <rough989_at_gmail.com>
Date: Fri 26 Jan 2007 - 10:30:36 GMT


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.



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri Jan 26 21:32:24 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 26 Jan 2007 - 11:31:16 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.