This is a static copy of a profile reportHome
createOptionFeedback (860 calls, 0.055 sec)
Generated 05-Aug-2011 13:03:55 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/shared/optimlib/createOptionFeedback.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
81 | optionFeedback.ObjectiveLimit ... | 860 | 0.022 s | 40.0% |  |
29 | if ~all(hasOptions) | 860 | 0.011 s | 20.0% |  |
24 | hasOptions = isfield(options,s... | 860 | 0.011 s | 20.0% |  |
20 | stopTestOptions = {'TolFun','T... | 860 | 0.011 s | 20.0% |  |
80 | if isempty(options.ObjectiveLi... | 860 | 0 s | 0% |  |
All other lines | | | 0 s | 0% |  |
Totals | | | 0.055 s | 100% | |
Children (called functions)
No childrenCode Analyzer results
No Code Analyzer messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 84 |
Non-code lines (comments, blank lines) | 40 |
Code lines (lines that can run) | 44 |
Code lines that did run | 21 |
Code lines that did not run | 23 |
Coverage (did run/can run) | 47.73 % |
Function listing
time calls line
1 function optionFeedback = createOptionFeedback(options)
2 %CREATEOPTIONFEEDBACK check if options are default and create structure used
3 %by exit messages for Optimization Toolbox solvers.
4 %
5 % This utility takes the input options structure and makes a "mirror"
6 % structure (optionFeedback) that contains fields for the options used in
7 % the exit messages for Optimization Toolbox solvers.
8 %
9 % The fields of optionFeedback contain the strings 'default' or
10 % 'selected' depending on whether or not the user set the
11 % corresponding option. The strings in the structure are then used by
12 % createExitMsg to give feedback to the user on whether the options that
13 % affect the stopping condition had been changed.
14
15 % Copyright 2008-2010 The MathWorks, Inc.
16 % $Revision: 1.1.6.3 $ $Date: 2010/03/22 04:19:45 $
17
18 % First, make sure that options contains all fields
19 % List of all options that are checked in this function
0.01 860 20 stopTestOptions = {'TolFun','TolX','TolCon','MaxIter','MaxFunEvals','MaxSQPIter','ObjectiveLimit'};
21 % Find out which fields are in the options structure
22 % NOTE: perform logical OR with the result from isfield() since it returns
23 % a scalar when options is empty.
0.01 860 24 hasOptions = isfield(options,stopTestOptions) | false(size(stopTestOptions));
25
26 % If some options are missing, fill them in with empties
27 % NOTE: this is faster when all options are in the structure (i.e. optimset
28 % has been used to create options) which is the majority of cases.
0.01 860 29 if ~all(hasOptions)
30 for k = 1:length(hasOptions)
31 if ~hasOptions(k)
32 options.(stopTestOptions{k}) = [];
33 end
34 end
35 end
36
37 % Check if TolFun is the default value
860 38 if isempty(options.TolFun)
860 39 optionFeedback.TolFun = 'default';
40 else
41 optionFeedback.TolFun = 'selected';
42 end
43
44 % Check if TolX is the default value
860 45 if isempty(options.TolX)
860 46 optionFeedback.TolX = 'default';
47 else
48 optionFeedback.TolX = 'selected';
49 end
50
51 % Check if MaxIter is the default value
860 52 if isempty(options.MaxIter)
53 optionFeedback.MaxIter = 'default';
860 54 else
860 55 optionFeedback.MaxIter = 'selected';
860 56 end
57
58 % Check if MaxFunEvals is the default value
860 59 if isempty(options.MaxFunEvals)
60 optionFeedback.MaxFunEvals = 'default';
860 61 else
860 62 optionFeedback.MaxFunEvals = 'selected';
860 63 end
64
65 % Check if TolCon is the default value
860 66 if isempty(options.TolCon)
860 67 optionFeedback.TolCon = 'default';
68 else
69 optionFeedback.TolCon = 'selected';
70 end
71
72 % Check if MaxSQPIter is the default value
860 73 if isempty(options.MaxSQPIter)
860 74 optionFeedback.MaxSQPIter = 'default';
75 else
76 optionFeedback.MaxSQPIter = 'selected';
77 end
78
79 % Check if ObjectiveLimit is the default value
860 80 if isempty(options.ObjectiveLimit)
0.02 860 81 optionFeedback.ObjectiveLimit = 'default';
82 else
83 optionFeedback.ObjectiveLimit = 'selected';
84 end