> On 13 May 2004 at 16:30, Brittany Erin Laine wrote:
> 
> > Is there any way that I can see the step by step code for functions in
> > the base package? For instance the dexp function. I am a student
> > working on writing my own function for something that is similar to
> > this dexp function and I would like to see the step by step code.
> > 
> > Brittany Laine
> > GTA WVU Statistics Department
> > 331 Hodges

As several people have pointed out the dexp function in R immediately
calls .Internal and drops down to C code.  For many of the d-p-q
functions like dexp, pexp, and qexp there are short C functions
defined in the src/nmath directory that do the calculation for a
single element of the response vector.  The C code that is called
directly by the .Internal is rather complicated but its only purpose
is to provide for the vectorization of the R function.  The real
evaluation goes on in dexp.c.  In fact, other than checking for error
conditions it amounts to a single statement

    return (give_log ?
            (-x / scale) - log(scale) :
            exp(-x / scale) / scale);

This is all to say that you probably don't want to go through the
step-by-step evaluation of the C code in a symbolic debugger because
most of the code that you will step through is devoted to the
vectorization.  Go directly to the corresponding C function in the
src/nmath directory.

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to