Displaying 1 result from an estimated 1 matches for "testex".
Did you mean:
tested
2006 Mar 29
1
calling R's optimization routines from C
...;
ex.X=malloc(ex.n*sizeof(double));
for(i=0;i<ex.n;i++) ex.X[i]=i;
nmmin(n,xin,x,&Fmin,myfunc,&fail,abstol,intol,&ex,alpha,
beta,gamma,trace,&fncount,maxit);
free(par);
free(x);
free(xin);
free(ex.X);
return 0;
}
I compile using the following:
gcc -o testex testex.c -std=c99 -Wall -pedantic -I/usr/lib/R/include
-L/usr/lib/R/lib -lm -lR
Which actually compiles without error, but I get Segmentation fault when I run
it.
Clearly, I am doing something wrong. Can someone please provide suggestions?
Many thanks and best wishes,
Aaarem