-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathoptimc.h
105 lines (77 loc) · 2.1 KB
/
optimc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
* optimc.h
*
* Created on: Mar 16, 2014
* Author: HOME
*/
#ifndef OPTIMC_H_
#define OPTIMC_H_
#include "nls.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct opt_set* opt_object;
opt_object opt_init(int N);
struct opt_set{
int N;
double objfunc;
double eps;
double gtol;
double stol;
double ftol;
double xtol;
double maxstep;
int MaxIter;
int Iter;
int Method;
int retval;
char MethodName[50];
double xopt[1];
};
typedef struct nls_set* nls_object;
nls_object nls_init(int M,int N);
struct nls_set{
int M;
int N;
double eps;
double epsfcn;
double factor;
double gtol;
double ftol;
double xtol;
int MaxIter;
int Maxfev;
int Iter;
int nfev;
int njev;
int ldfjac;
int mode;
int retval;
double xopt[1];
};
void setnlsTOL(nls_object obj,double gtol,double ftol,double xtol);
void optsummary(opt_object obj);
void setMaxIter(opt_object obj,int MaxIter);
void setMaxStep(opt_object obj, double maxstep);
void setTOL(opt_object obj,double gtol,double stol,double ftol,double xtol);
int fminsearch(custom_function *funcpt,int N,double *xi,double *xf);
double fminbnd(custom_funcuni *funcuni,double a, double b);
int fminunc(custom_function *funcpt,custom_gradient *funcgrad,int N,double *xi,double maxstep, int method,double *xf);
int fminnewt(custom_function *funcpt, custom_gradient *funcgrad, int N, double *xi,
double delta,double *dx,double fsval,double maxstep,int method,double *xf);
double brent_local_min(custom_funcuni *funcuni,double a, double b, double t, double eps, double *x);
void optimize(opt_object obj, custom_function *funcpt, custom_gradient *funcgrad, int N, double *xi,
int method);
void free_opt(opt_object object);
int levmar(custom_funcmult *funcmult, custom_jacobian *jacobian,
double *xi,int M, int N,double *xf);
void nls(nls_object obj, custom_funcmult *funcmult, custom_jacobian *jacobian,
double *xi);
void nls_scale(nls_object obj, custom_funcmult *funcmult, custom_jacobian *jacobian,
double *diag,double *xi);
void nlssummary(nls_object obj);
void free_nls(nls_object object);
#ifdef __cplusplus
}
#endif
#endif /* OPTIMC_H_ */