On Jul 7, 2014, at 4:34 PM, Zhiyuan Dong <zhiyuan.dong at gmail.com> wrote:
Hi, I am learning R by reading R source code. Here is one question I have
about the optim function in R.
The context : In the optim.R, after all the prep steps, the main function
call call is made via :
.External2(C_optim, par, fn1, gr1, method, con, lower, upper).
So, it seems to me, to follow what is going on from here, that I should
read the optim function in \src\library\stats\src\optim.c
where it has this signature :
SEXP optim(SEXP call, SEXP op, SEXP args, SEXP rho)
I am not sure I follow here : In the .External2 call, we have 7 parameters
: par, fn1, gr1, method, con, lower, upper; This does not seem to match
the signature of
SEXP optim(SEXP call, SEXP op, SEXP args, SEXP rho)
However, it seems (from the source code) that the 7 parameters are somehow
embedded in the 'args' parameter. I am not sure what is going on...Am I
missing something?