]> gitweb.michael.orlitzky.com - octave.git/blob - optimization/test_functions/extended_powell1.m
Add the cholesky_inf() function.
[octave.git] / optimization / test_functions / extended_powell1.m
1 function f = extended_powell1(x)
2 %
3 % The extended Powell function. See Dennis & Schnabel, Appendix B,
4 % problem #2.
5 %
6 % This function has a minimum at x=(0,0,...,0) with f(x) == 0. The
7 % suggested starting point is x0=(3, -1, 0, 1,..., 3, -1, 0, 1).
8 % Since the number of arguments is variable, we take a vector
9 % instead of its individual components.
10 %
11 n = length(x);
12
13 if (odd(n))
14 % 'm' below must be an integer.
15 f = NA;
16 return;
17 end
18
19 m = n / 4;
20 f = 0;
21
22 % The extended Powell is simply a sum of Powell
23 % applications.
24 for k = [ 1 : m ]
25 y1 = x(4*k - 3);
26 y2 = x(4*k - 2);
27 y3 = x(4*k - 1);
28 y4 = x(4*k);
29
30 f_k = powell(y1,y2,y3,y4);
31 f = f + f_k;
32 end
33 end