search for: optimgr

Displaying 4 results from an estimated 4 matches for "optimgr".

Did you mean: optimal
2012 Jun 08
0
Working with optim in C
...{ double * lambda = (double*)malloc(sizeof(double)*n); double sum = 0; for(int i =0; i < n; i++) { lambda[i] = (1+tanh(par[i]/2.0))/2.0; } for(int i = 0; i < n; i++) { sum += (par[i]*log(lambda[i]) + (1-par[i]*log(1-lambda[i]))); } return sum; } void optimgr(int n, double *par, double *gr, void *ex) { for(int i = 0; i < n; i++) { gr[i] = log(par[i]) - log(1-par[i]); } } void Test(SEXP SomeValues) { PROTECT(SomeValues = AS_NUMERIC(SomeValues)); double * CValues = NUMERIC_POINTER(SomeValues); void * optEx, *grEx, *...
2007 Oct 23
0
API for optimization with Simulated annealing
...rak And here is the patch: --- R-devel_2007-10-22/src/include/R_ext/Applic.h 2007-08-31 17:53:41.000000000 +0200 +++ R-devel_my_source/src/include/R_ext/Applic.h 2007-10-23 23:02:43.397529120 +0200 @@ -65,6 +65,7 @@ /* main/optim.c */ typedef double optimfn(int, double *, void *); typedef void optimgr(int, double *, double *, void *); +typedef void sagenptry(int, double *, double *, double, void *); void vmmin(int n, double *b, double *Fmin, optimfn fn, optimgr gr, int maxit, int trace, @@ -82,8 +83,8 @@ double *Fmin, optimfn fn, optimgr gr, int *fail, void *ex, double factr,...
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 optim.c codes at R sites and it's a structure that has bunch of objects such as SEXP R_fcall, SEXP R_gca...
2012 Oct 28
0
lbfgsb from C
...int maxit = 10; char msg[1000]; int trace = 0; int nREPORT = 10; /* from http://cran.r-project.org/doc/manuals/R-exts.html#Optimization 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); */ lbfgsb(n, m, init, lower, upper, nbd, &Fmin, &eval, &grad, &fail, ex, factr, pgtol, &fncount, &grco...