1 ## Copyright (C) 2002 Etienne Grossmann <etienne@egdn.net>
2 ## Copyright (C) 2009 Levente Torok <TorokLev@gmail.com>
4 ## This program is free software; you can redistribute it and/or modify it under
5 ## the terms of the GNU General Public License as published by the Free Software
6 ## Foundation; either version 3 of the License, or (at your option) any later
9 ## This program is distributed in the hope that it will be useful, but WITHOUT
10 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 ## You should have received a copy of the GNU General Public License along with
15 ## this program; if not, see <http://www.gnu.org/licenses/>.
17 ## [a, b, ga, gb, nev] = semi_bracket (f, dx, a, narg, args)
19 ## Find an interval containing a local minimum of the function
20 ## g : h in reals ---> f (x+h*dx) where x = args{narg}
23 ## nev is the number of function evaluations
25 function [a, b, ga, gb, n] = __bracket_min (f, dx, narg, args)
27 [a,b, ga,gb, n] = __semi_bracket (f, dx, 0, narg, args);
29 if a != 0, return; end
31 [a2,b2, ga2,gb2, n2] = __semi_bracket (f, -dx, 0, narg, args);