Displaying 20 results from an estimated 1000 matches similar to: "using R's optimization routines from C"
2006 Mar 29
1
calling R's optimization routines from C
Hi,
I have read R's Writing Extensions manual and am still confused about how to
use some of the routines there when I call from C. Specifically, I am writing a
little test function which I will optimize using the nmmin function which
underlies R's optim() with Nelder-Mead. I guess I wonder what library/header
files I should be using. I was using R_ext/Applic.h and linking with libR but I
2008 Oct 31
0
R help for invoking nmmin()
My code is as follows:
#include <iostream>
#include <cmath>
using namespace std;
#define MATHLIB_STANDALONE 1
extern "C"
{
#include "R_ext/Applic.h"
}
typedef struct TT{
double ** tempX;
double * tempY;
int tempN;
} TT, *MM;
double fn(int N, double * beta, void * ex){
double total = 0;
int i = 0,j = 0;
double * betaFn = new double[N];
MM tmp = (MM)ex;
2007 Oct 23
0
API for optimization with Simulated annealing
Dear list,
I was trying to use the R API for optimization method "Simulated annealing"
void samin(int n, double *x, double *Fmin, optimfn fn, int maxit,
int tmax, double temp, int trace, void *ex);
but I encountered the following problem:
The implementation of the function samin (as seen in src/main/optim.c)
passes its void * argument "ex" into the function
2006 Apr 13
1
bus error on calling nmmin
Hi,
I'm trying to get a toy program making use of nmmin to run
successfully. I've gotten to the point of compiling. However, when I
attempt to run my executable, I guess a bus error. I see that someone
else has asked about using nmmin before
<http://tolstoy.newcastle.edu.au/R/help/06/03/23944.html>, but I
haven't come across any replies.
Is there some documentation on how to
2006 Mar 03
1
Fwd: Re: calling R's library using C
Sorry, forgot to switch the header to the R group....
--- Globe Trotter <itsme_410 at yahoo.com> wrote:
> Date: Thu, 2 Mar 2006 19:35:21 -0800 (PST)
> From: Globe Trotter <itsme_410 at yahoo.com>
> Subject: Re: [R] calling R's library using C
> To: Dirk Eddelbuettel <edd at debian.org>
>
> Hi, Dirk:
>
> Thanks for all the help. I thought I would
2007 Oct 13
1
R API - optim
I am trying to use the R API to call optim functions (nmmin, vmmin, lbfgsb,
etc.) through a C program but I couldn't find the shared library to link
under the R-2.6.0 build which is compiled under Linux (REL5).
main.cpp:35: undefined reference to `Rf_initEmbeddedR(int, char**)'
main.cpp:41: undefined reference to `nmmin'
Thanks in advance for any help.
------------------------
2012 Jun 08
0
Working with optim in C
I've searched to find examples of how to work with the C versions of
optim.
I've separated out the function just to test on it alone, and currently I'm
attempting to use fmmin as follows:
!~~CODE ~~!
double optimfn(int n, double *par, void *ex) {
double * lambda = (double*)malloc(sizeof(double)*n);
double sum = 0;
for(int i =0; i < n; i++) { lambda[i] =
2004 Nov 02
0
how to call function in ../src/main
Hi, This is Kotien Wu from NIH/NCI.
We want to use R function for our web:
http://cgap.nci.nih.gov
It works for functions in R/R-1.9.1/src/nmath/standalone very well.
We have function GetPvalueForT.c which has
#define MATHLIB_STANDALONE 1
#include <Rmath.h>
double GetPvalueForT ( double t, double deg ) {
return 2 * pt(t, deg, 0, 0);
}
We create GetPvalueForT.i, which has
/* File :
2006 Mar 01
3
library file for R's nmath routines
Hi,
I am wondering where the library file for R's nmath routines are?
Doing a search on libR gave me the following:
/usr/lib/libRKC16.so.1.2.0
/usr/lib/libRKC.so.1.2.0
/usr/lib/R/lib/libRlapack.so
/usr/lib/R/lib/libR.so
/usr/lib/libRKC.so.1
/usr/lib/libRKC16.so.1
None of these have the functions in nmath.
Any help? Many thanks and best wishes!
GT
2012 Jan 27
2
The following code (using rgamma) hangs
Hi,
I'm seeing something that may be a bug in R's standalone math library,
which is packaged by Debian as r-mathlib. I reported it to the Debian BTS
as http://bugs.debian.org/657573
I'm using Debian squeeze, and the code was tested with r-mathlib 2.11.1-6
(default on stable) and 2.14.1-1 (from testing/unstable).
I summarize this report below. The following code with the R math
2008 Mar 07
1
parameters for lbfgsb (function for optimization)
Can anyone help me with lbfgsb (function for optimization)?
It takes the following parameters:
void lbfgsb (int n, int lmm, double *x, double *lower,
double *upper, int *nbd, double *Fmin, optimfn fn,
optimgr gr, int *fail, void *ex, double factr,
double pgtol, int *fncount, int *grcount,
int maxit, char *msg, int trace, int nREPORT);
What do I put for parameter ex (11th parameter)? I looked at
2006 Apr 04
2
is.numeric (NA + NA) is TRUE, should be FALSE (PR#8745)
Full_Name: c fillekes
Version: Version 2.2.1 (2005-12-20 r36812)
OS: Gentoo Linux kernel 2.6.12
Submission from: (NULL) (129.116.71.233)
"Not Available" is of course not a numeric:
R
> is.numeric (NA)
[1] FALSE
But for some reason, all arithmetic operations on NA's are
in fact numeric, even if it's with other NA's.
> is.numeric (NA+NA)
[1] TRUE
>
2005 Dec 21
0
(Debian Bug 344248): R segfaults when pressing Delete (PR#8421)
On Wed, 2005-12-21 at 15:00 +0100, edd at debian.org wrote:
> --CE+1k2dSO48ffgeK
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
>
> Resend after type in mailheader. I have the bug on my system with
> yesterday's R 2.2.1. A library mismatch is still a likely cause.
>
> Dirk
<SNIP>
> On 21 December 2005 at 01:50, Ethan
2004 Apr 14
1
question about /nmath/standalone
Hello,
I can't link a c code with Mathlib according to introduction of R
manual "Writing R Extensions", page 60.
It is written :
"It is possible to build Mathlib, the R set of mathematical functions
documented in
'Rmath.h?, as a standalone library 'libRmath? under Unix and Windows. (This
includes
the functions documented in Section 5.7 [Numerical analysis
2006 Jun 13
3
Multiple lag.plots per page
Hi,
I'm trying to plot several lag.plots on a page, however the second plot
replaces the first one (although it only takes up the upper half as it
should):
par(mfrow=c(2,1))
a<-sin(1:100)
b<-cos(1:100)
lag.plot(a)
lag.plot(b)
What's the trick to this?
I'm using R 2.2.1 (2005-12-20 r36812) on Ubuntu Linux.
Thanks,
Gad
--
Gad Abraham
Department of Mathematics and
2012 Oct 28
0
lbfgsb from C
Hi,
I wanted to use R's lbfgsb method for minimization from C. Unfortunately,
my toy examples always crashes (segmentation fault). What's wrong with it?
double eval(int n, double* par, void *ex) {
double result = 0;
for (int i=0; i<n; ++i) {
result += par[i]*par[i];
}
printf("result=%.2f\n", result);
return result;
}
void grad(int n, double *par, double *gr,
2006 Mar 27
1
no acceptable C compiler
dear R users
not sure why I am not able to install tkrplot.
> install.pacakges ("tkrplot", dependencies=TRUE)
...
Configure: error: no acceptable C compiler found in $path
...
well,
I am using debian testing 2.6.15,
R Version 2.2.1 (2005-12-20 r36812)
#whereis gcc
gcc: /usr/lib/gcc
thank you
---------------------------------
[[alternative HTML version
2006 Apr 21
1
plot.default 'ylim' error message is wrong (PR#8784)
Full_Name: Lutz Prechelt
Version: 2.2.1
OS: WinXP SP2
Submission from: (NULL) (130.133.8.114)
This command
plot(0, 0, xlim=c(3, 5), ylim=c(0, 10, 17))
should complain about 'ylim' (because it has three elements).
However, it does in fact (in my german error message at least)
complain about 'xlim' instead:
Fehler in plot.window(xlim, ylim, log, asp, ...) :
ung?ltiger
2006 Feb 06
1
Error in fun(...) : couldn't find function "assignInNamespace"
I started my laptop, opened a shell and get this error message:
R : Copyright 2005, The R Foundation for Statistical Computing
Version 2.2.1 (2005-12-20 r36812)
ISBN 3-900051-07-0
lines deleted
Error in fun(...) : couldn't find function "assignInNamespace"
Error: .onLoad failed in 'loadNamespace' for 'Matrix'
Fatal error: unable to restore saved data in .RData
2006 Jun 04
1
Problems using lwd in GDD
hi
I'm using the GDD package (in a 64bits fedora machine using R 2.3.0) to save
in a png file some plots and i noticed that changing the lwd parameter does
not change my line width
I tried the same script in a Windows based R (2.2.1 r36812), using no GDD,
and it worked.
Does anybody has a clue?
My testing script is something dumb like this:
library(GDD)
GDD("pres24.png",