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
|
#ifndef GNEWT_H
#define GNEWT_H
/* Global newton non-linear equation solver */
/*
* Copyright 2018 Graeme W. Gill
* All rights reserved.
*
* This material is licenced under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3 :-
* see the License.txt file for licencing details.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
return values:
0 Success
1 Ran out of itterations
2 Inverting Jacobian failed
*/
int gnewt(
void *fdata, /* Opaque pointer to pass to fcn() and jac() */
void (*fcn)(void *fdata, int n, double *x, double *fvec),
/* Pointer to function we are solving */
void (*jac)(void *fdata, int n, double *x, double **fjac),
/* Function to compute jacobian */
int n, /* Number of functions and variables */
double x[], /* Initial solution estimate, returns final solution */
double rfvec[], /* Optionaly return soln. function values */
double xtol, /* Desired tollerance of root */
double ftol, /* Desired tollerance of the solution */
int maxfcn, /* Maximum number of function itterations */
int maxjac /* Maximum number of jacobian itterations */
);
#ifdef __cplusplus
}
#endif
#endif /* GNEWT_H */
|