Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2929_PrioritizedGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.PGE/3.3/go-code/go-levmar/levmar_c.c @ 16080

Last change on this file since 16080 was 16080, checked in by hmaislin, 6 years ago

#2929 initial commit of working PGE version

File size: 1.4 KB
Line 
1#include <stdio.h>
2#include <stdlib.h>
3#include <math.h>
4
5#include "levmar-2.6/levmar.h"
6#include "levmar_h.h"
7
8void callback_func(double *p, double *x, int m, int n, void *data) {
9  Callback_func(p,x,data);
10}
11
12void callback_jacfunc(double *p, double *jac, int m, int n, void *data) {
13  Callback_jacfunc(p,jac,data);
14}
15
16void levmar_der( double* ygiven, double* p, const int m, const int n, void* data ) {
17  double opts[LM_OPTS_SZ], info[LM_INFO_SZ];
18
19  // optimization control parameters; passing to levmar NULL instead of opts reverts to defaults
20  opts[0]=LM_INIT_MU; opts[1]=1E-15; opts[2]=1E-15; opts[3]=1E-20;
21  opts[4]=LM_DIFF_DELTA; // relevant only if the finite difference Jacobian version is used
22
23  // invoke the optimization function
24  dlevmar_der(callback_func, callback_jacfunc, p, ygiven, m, n, 1000, opts, info, NULL, NULL, data); // with analytic Jacobian
25}
26
27void levmar_dif( double* ygiven, double* p, const int m, const int n, void* data ) {
28  double opts[LM_OPTS_SZ], info[LM_INFO_SZ];
29
30  // optimization control parameters; passing to levmar NULL instead of opts reverts to defaults
31  opts[0]=LM_INIT_MU; opts[1]=1E-15; opts[2]=1E-15; opts[3]=1E-20;
32  opts[4]=LM_DIFF_DELTA; // relevant only if the finite difference Jacobian version is used
33
34  // invoke the optimization function
35  dlevmar_dif(callback_func, p, ygiven, m, n, 1000, opts, info, NULL, NULL, data); // without Jacobian
36}
37
38
Note: See TracBrowser for help on using the repository browser.