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
|
template<typename Scalar>
int hybrj1_template(minpack_funcder_nn fcn, void *p, int n, Scalar *x, Scalar *
fvec, Scalar *fjac, int ldfjac, Scalar tol,
Scalar *wa, int lwa)
{
/* Initialized data */
const Scalar factor = 100.;
/* System generated locals */
int fjac_dim1, fjac_offset, i__1;
/* Local variables */
int j, lr, mode, nfev, njev;
Scalar xtol;
int maxfev, nprint;
int info;
/* Parameter adjustments */
--fvec;
--x;
fjac_dim1 = ldfjac;
fjac_offset = 1 + fjac_dim1 * 1;
fjac -= fjac_offset;
--wa;
/* Function Body */
info = 0;
/* check the input parameters for errors. */
if (n <= 0 || ldfjac < n || tol < 0. || lwa < n * (n + 13) / 2) {
/* goto L20; */
return info;
}
/* call hybrj. */
maxfev = (n + 1) * 100;
xtol = tol;
mode = 2;
i__1 = n;
for (j = 1; j <= i__1; ++j) {
wa[j] = 1.;
/* L10: */
}
nprint = 0;
lr = n * (n + 1) / 2;
info = hybrj(fcn, p, n, &x[1], &fvec[1], &fjac[fjac_offset], ldfjac, xtol,
maxfev, &wa[1], mode, factor, nprint, &nfev, &njev, &wa[
n * 6 + 1], lr, &wa[n + 1], &wa[(n << 1) + 1], &wa[n * 3 + 1],
&wa[(n << 2) + 1], &wa[n * 5 + 1]);
if (info == 5) {
info = 4;
}
/* L20: */
return info;
/* last card of subroutine hybrj1. */
} /* hybrj1_ */
|