Hi, On Mon, Jul 7, 2014 at 4:34 PM, Zhiyuan Dong <zhiyuan.d...@gmail.com> wrote: > Hi, I am learning R by reading R source code.
That's very brave of you. You might also try reading some of the documentation and contributed documentation, like: http://adv-r.had.co.nz/C-interface.html and http://cran.r-project.org/doc/manuals/r-devel/R-exts.html Sarah 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? > > Thanks much!!! > > Best, > > Zhiyuan > -- Sarah Goslee http://www.functionaldiversity.org ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel