From bautista at cimat.mx  Thu Sep 28 19:36:24 2006
From: bautista at cimat.mx (Patricia Bautista Otero)
Date: Thu, 28 Sep 2006 12:36:24 -0500 (CDT)
Subject: [Rd] Accesing R c-code
Message-ID: <Pine.BSO.4.64.0609281226300.9383@ate.cimat.mx>

Hi r-devel,

I am working on a R extension. My package is writen on C++ and in my code 
I require a R function object. I received the R function object, then a 
point x in which the "function" is going to be evaluated is generated in 
some way, then I evalue the "function" at x and I repete this process 
several thousand of times. Since I am using the function eval(SEXP fn, 
SEXP env) my code is really slow. Due to my major concern is speed, I 
wonder to know when it is posible to access to the parse tree of the R 
function object and build my own c++ parser tree in order to have c++ 
doing the evaluations of the function instead of R, as it is now working 
in my c++ code. What I want to avoid is to have to develope a complete 
parser mainly because it would take me too much time since I am a newe in 
compilers and parsers.

It would also help me to know how R mcmc packages work, because it is more 
or less the same situation. In mcmc packages a target density function is 
required, and I suppose this density function is evaluated many many 
times, but this packages are not too slow.


Then, if anyone is able to provide me any insight into what I might to, I 
would be grateful.

pb




[Rd] Accesing R c-code
Patricia Bautista Otero