[R] using R's optimization routines from C

Globe Trotter itsme_410 at yahoo.com
Fri Mar 24 05:57:27 CET 2006


Dear all,

I have been trying to use R's optimization routines from C and I have some
questions. Specifically, I am testing the usage of nmmin which performs
Nelder-Mead optimization in order to learn how to do the above exercise.

I understand from the notes in Chapter 5 that the declaration for both optimfn
as well as nmmin are included in the header file R_ext/Applic.h so I have
included that. Is there anything else (definitions, etc) that needs to be
provided in the preprocessor directive? 

While linking, it appears that nmmin is in libR.so, so I guess I should include
that library when I compile the program, is that right?

I also wanted to use some of the functions in the Rmath library in the same
program. However, when I use it, I get an error in the header files. which says
essentially that there are some redeclarations in the header (specifically,
Rboolean, TRUE and FALSE). I have defined 
#define MATHLIB_STANDALONE 1

is there anyother preprocessor directive I should give and define other things
needed?

Btw, I am using FC-4 and RHEl-4 and I do have the latest versions of R Version
2.2.1  (2005-12-20 r36812). 

I am happy to provide my test programs that I am using to test my usage of the
above optimization routines.

Many thanks for any help you can provide!
Globe




More information about the R-help mailing list