7 double f_Chebyquad(int n
, double *x
, void *data
)
13 for (j
= 0; j
!= n
; ++j
) {
15 y
[1][j
] = 2. * x
[j
] - 1.;
17 for (i
= 1; i
!= n
; ++i
)
18 for (j
= 0; j
!= n
; ++j
)
19 y
[i
+1][j
] = 2. * y
[1][j
] * y
[i
][j
] - y
[i
-1][j
];
23 for (i
= 0; i
!= np
; ++i
) {
25 for (j
= 0; j
!= n
; ++j
) sum
+= y
[i
][j
];
27 if (iw
> 0) sum
+= 1. / ((i
- 1) * (i
+ 1));
39 printf("\nMinimizer: Hooke-Jeeves\n");
40 for (n
= 2; n
<= 8; n
+= 2) {
41 for (i
= 0; i
!= n
; ++i
) x
[i
] = (double)(i
+ 1) / n
;
43 y
= kmin_hj(f_Chebyquad
, n
, x
, 0, KMIN_RADIUS
, KMIN_EPS
, KMIN_MAXCALL
);
44 printf("n=%d,min=%.8lg,n_evals=%d\n", n
, y
, n_evals
);