[R] optim with gradient
Adrian Trapletti
adrian.trapletti at lmttrading.com
Thu Mar 21 12:00:49 CET 2002
Göran Broström wrote:
> On Thu, 21 Mar 2002, Adrian Trapletti wrote:
>
> [...]
> > If the only goal is to improve speed, then you should consider to do
> > the full optimization within C/Fortran, i.e., to implement the errfunc
> > and the gradient in C and to call optim through the API (a new feature
> > of the upcoming version 1.5.0 as Brian told me). This may increase speed
> > - I just make a rough guess now - by a factor 100.
>
> I can hardly wait! I already make the heavy calculations in Fortran, so it
> should be easy to implement.
I am not sure what you mean by doing the heavy calculations in Fortran. But I
guess the errfunc (and gradient) are defined in R and itself call Fortran
code using .Fortran()? That´s already more performant, but also then you
should avoid that optim calls an R function. It completely "destroys" the
performance.
> Is the feature in R-devel now?
Yes.
>
> And documented?
I don´t know. Ask Brian. But I think it should be pretty easy to figure out
how to call optim and how optim calls your functions from the header file.
Adrian
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list