G'day Kevin, On Wed, 18 Mar 2009 21:46:51 -0700 <rkevinbur...@charter.net> wrote:
> I was trying to find source for optimize and I ran across > > function (f, interval, ..., lower = min(interval), upper = > max(interval), maximum = FALSE, tol = .Machine$double.eps^0.25) > { > if (maximum) { > val <- .Internal(fmin(function(arg) -f(arg, ...), lower, > upper, tol)) > list(maximum = val, objective = f(val, ...)) > } > else { > val <- .Internal(fmin(function(arg) f(arg, ...), lower, > upper, tol)) > list(minimum = val, objective = f(val, ...)) > } > } > > Then I did a search for fmin and i came up with: > > /* fmin(f, xmin, xmax tol) */ > SEXP attribute_hidden do_fmin(SEXP call, SEXP op, SEXP args, SEXP rho) > > > So my question is where do I find the intermediary step between > > .Internal(fmin(function(arg) f(arg, ...), lower, upper, tol)) > > and > > SEXP attribute_hidden do_fmin(SEXP call, SEXP op, SEXP args, SEXP rho) @Article{Rnews:Ligges:2006, author = {Uwe Ligges}, title = {{R} {H}elp {D}esk: {Accessing} the Sources}, journal = {R News}, year = 2006, volume = 6, number = 4, pages = {43--45}, month = {October}, url = http, pdf = Rnews2006-4 } http://CRAN.R-project.org/doc/Rnews/Rnews_2006-4.pdf > The number of arguments doesn't match up. I am guessing that lower > and upper somehow get merged into the args. And rho is 'tol'. Right? Unlikely. In "Writing R Extensions" (and the functions I looked up), 'rho' usually denotes an environment that is used to evaluate expressions in. Typically (i.e. in cases that I had need to look at), all arguments are rolled into the SEXP arg for internal functions. HTH. Cheers, Berwin ______________________________________________ R-help@r-project.org 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.