Mercurial > hg > octave-nkf
diff scripts/optimization/sqp.m @ 13305:63463570d9fe
Add %!endfunction block keyword to test.m
test.m: Accept, but don't process, %!endfunction block keyword
* structfun.m, fminunc.m, fsolve.m, sqp.m, unwrap.m, test.m: Close %!function
declarations with %!endfunction. Until Bug #34497 (unable to clear command line
functions from user workspace) is fixed, use Octave reserved namespace for test
functions.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sun, 09 Oct 2011 07:25:07 -0700 |
parents | 571557ddabb9 |
children | 9cae456085c2 |
line wrap: on
line diff
--- a/scripts/optimization/sqp.m +++ b/scripts/optimization/sqp.m @@ -736,19 +736,21 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Test Code -%!function r = g (x) +%!function r = __g (x) %! r = [sumsq(x)-10; %! x(2)*x(3)-5*x(4)*x(5); %! x(1)^3+x(2)^3+1 ]; +%!endfunction %! -%!function obj = phi (x) +%!function obj = __phi (x) %! obj = exp(prod(x)) - 0.5*(x(1)^3+x(2)^3+1)^2; +%!endfunction %! %!test %! %! x0 = [-1.8; 1.7; 1.9; -0.8; -0.8]; %! -%! [x, obj, info, iter, nf, lambda] = sqp (x0, @phi, @g, []); +%! [x, obj, info, iter, nf, lambda] = sqp (x0, @__phi, @__g, []); %! %! x_opt = [-1.717143501952599; %! 1.595709610928535;