[R] double integral with C

From: Stefano <matz_at_davide.it>
Date: Wed 24 Jan 2007 - 14:37:59 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



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu Jan 25 16:01:03 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 Thu 25 Jan 2007 - 05:30:29 GMT.

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