Mercurial > hg > octave-lyh
comparison scripts/optimization/__all_opts__.m @ 8652:b93f17317ca3
fixes to __all_opts__
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 03 Feb 2009 08:32:28 +0100 |
parents | 06f5dd901f30 |
children | e07e93c04080 |
comparison
equal
deleted
inserted
replaced
8651:ea8e65ca234f | 8652:b93f17317ca3 |
---|---|
24 | 24 |
25 function names = __all_opts__ (varargin) | 25 function names = __all_opts__ (varargin) |
26 | 26 |
27 persistent saved_names = {}; | 27 persistent saved_names = {}; |
28 | 28 |
29 ## do not clear this function | |
30 mlock (); | |
31 | |
29 ## guard against recursive calls. | 32 ## guard against recursive calls. |
30 persistent recursive = false; | 33 persistent recursive = false; |
31 | 34 |
32 if (nargin == 0) | 35 if (recursive) |
36 names = {}; | |
37 elseif (nargin == 0) | |
33 names = saved_names; | 38 names = saved_names; |
34 else | 39 else |
35 ## query all options from all known functions. These will call optimset, | 40 ## query all options from all known functions. These will call optimset, |
36 ## which will in turn call us, but we won't answer. | 41 ## which will in turn call us, but we won't answer. |
42 recursive = true; | |
37 names = saved_names; | 43 names = saved_names; |
38 for i = 1:nargin | 44 for i = 1:nargin |
39 try | 45 try |
40 opts = optimset (varargin{i}); | 46 opts = optimset (varargin{i}); |
41 fn = fieldnames (opts).'; | 47 fn = fieldnames (opts).'; |
50 if (length (lnames) < length (names)) | 56 if (length (lnames) < length (names)) |
51 ## This is bad. | 57 ## This is bad. |
52 error ("__all_opts__: duplicate options with inconsistent case."); | 58 error ("__all_opts__: duplicate options with inconsistent case."); |
53 endif | 59 endif |
54 saved_names = names; | 60 saved_names = names; |
61 recursive = false; | |
55 endif | 62 endif |
56 | 63 |
57 endfunction | 64 endfunction |
58 | 65 |