[R] calling optim from external C/C++ program
ripley@stats.ox.ac.uk
ripley at stats.ox.ac.uk
Tue Apr 30 19:10:29 CEST 2002
On Tue, 30 Apr 2002, Vadim Ogranovich wrote:
> I looked at optim.c in R 1.5.0 and realized that what I actually needed is
> to call either vnmin() or lbfgsb(). The interfaces of these functions are
> not R-specific (built-in types only) so if I could build R into a shared
> library or use the executable itself as a shared library it would do for my
> purposes. Is this possible? Where could I start from?
As I said those interfaces are documented in R-exts, and you can fairly
easily make a standalone version from optim.c and src/appl/lbfgs.c.
You will need to watch calls to error() and R_FINITE and the like, but
suitable substitutes are easy to create (and standalone Rmath may help).
>
> Thanks, Vadim
>
> -----Original Message-----
> From: Prof Brian D Ripley [mailto:ripley at stats.ox.ac.uk]
> Sent: Monday, April 29, 2002 11:16 PM
> To: Vadim Ogranovich
> Cc: r-help at stat.math.ethz.ch; 'cyg at sympatico.ca'
> Subject: Re: [R] calling optim from external C/C++ program
>
>
> On Mon, 29 Apr 2002, Vadim Ogranovich wrote:
>
> > Hi,
> >
> > Does anyone have an example of calling optim() from a standalone C/C++
> > program? If possible please include the linker options (I am using gcc
> > version 2.96 20000731 (Red Hat Linux 7.1 2.96-98))
>
> It's not possible. An important part of optim() is in R. R 1.5.0 makes
> the underlying optimizers available to C code linked into R, but they are
> only part of optim().
>
> There is also no such thing as gcc 2.96: see gcc.gnu.org. You would be
> well-advised to use a released version of gcc.
>
> --
> Brian D. Ripley, ripley at stats.ox.ac.uk
> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel: +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272860 (secr)
> Oxford OX1 3TG, UK Fax: +44 1865 272595
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
> -.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
> _._
>
> --------------------------------------------------
> DISCLAIMER
> This e-mail, and any attachments thereto, is intended only for use by the
> addressee(s) named herein and may contain legally privileged and/or
> confidential information. If you are not the intended recipient of this
> e-mail, you are hereby notified that any dissemination, distribution or
> copying of this e-mail, and any attachments thereto, is strictly prohibited.
> If you have received this e-mail in error, please immediately notify me and
> permanently delete the original and any copy of any e-mail and any printout
> thereof.
>
> E-mail transmission cannot be guaranteed to be secure or error-free. The
> sender therefore does not accept liability for any errors or omissions in
> the contents of this message which arise as a result of e-mail transmission.
>
> NOTICE REGARDING PRIVACY AND CONFIDENTIALITY
>
> Knight Trading Group may, at its discretion, monitor and review the content
> of all e-mail communications.
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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