0001 function options = wspgSetParms(varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 if nargin == 0 && nargout == 0
0020 fprintf(' Default parameters for l1Set.m:\n');
0021 fprintf(' fid : [ positive integer | 1 ]\n');
0022 fprintf(' verbosity : [ integer: 1, 2, or 3 | 3 ]\n');
0023 fprintf(' iterations : [ positive integer | 10*m ]\n');
0024 fprintf(' nPrevVals : [ positive integer | 10 ]\n');
0025 fprintf(' bpTol : [ positive scalar | 1e-06 ]\n');
0026 fprintf(' optTol : [ positive scalar | 1e-04 ]\n');
0027 fprintf(' decTol : [ positive scalar | 1e-04 ]\n');
0028 fprintf(' stepMin : [ positive scalar | 1e-16 ]\n');
0029 fprintf(' stepMax : [ positive scalar | 1e+05 ]\n');
0030 fprintf(' rootMethod : [ 1=linear, 2=quadratic | 2 ]\n');
0031 fprintf('activeSetIt : [ positive integer | Inf ]\n');
0032 fprintf('subspaceMin : [ 0=no, 1=yes | 0 ]\n');
0033 fprintf(' iscomplex : [ 0=no, 1=yes, NaN=auto | NaN ]\n');
0034 fprintf(' maxMatvec : [ positive integer | Inf ]\n');
0035 fprintf(' weights : [ vector | 1 ]\n');
0036 fprintf(' omega : [ vector | 1 ]\n');
0037 fprintf(' project : [ projection function | @()]\n');
0038 fprintf('primal_norm : [ primal norm eval fun | @()]\n');
0039 fprintf(' dual_norm : [ dual norm eval fun | @()]\n');
0040 fprintf(' Kaczmarz : [ 0=no, 1=proj, 2=rtfind | 0 ]\n');
0041 fprintf(' KaczScale : [ positive scalar | 1 ]\n');
0042 fprintf(' quitPareto : [ 0=no, 1=yes | 0 ]\n');
0043 fprintf(' minPareto : [ positive integer | 3 ]\n');
0044 fprintf(' lineSrchIt : [ positive integer | 1 ]\n');
0045 fprintf(' feasSrchIt : [ positive integer | 10000 ]\n');
0046 fprintf(' ignorePErr : [ 0=no, 1=yes | 0 ]\n');
0047 fprintf('\n');
0048 return;
0049 end
0050
0051 Names = [
0052 'fid '
0053 'verbosity '
0054 'iterations '
0055 'nPrevVals '
0056 'bpTol '
0057 'optTol '
0058 'decTol '
0059 'stepMin '
0060 'stepMax '
0061 'rootMethod '
0062 'activeSetIt '
0063 'subspaceMin '
0064 'iscomplex '
0065 'maxMatvec '
0066 'weights '
0067 'omega '
0068 'project '
0069 'primal_norm '
0070 'dual_norm '
0071 'Kaczmarz '
0072 'KaczScale '
0073 'quitPareto '
0074 'minPareto '
0075 'lineSrchIt '
0076 'feasSrchIt '
0077 'ignorePErr ' ...
0078 ];
0079 [m,n] = size(Names);
0080 names = lower(Names);
0081
0082
0083 options = [];
0084 for j = 1:m
0085 eval(['options.' Names(j,:) '= [];']);
0086 end
0087 i = 1;
0088 while i <= nargin
0089 arg = varargin{i};
0090 if ischar(arg), break; end
0091 if ~isempty(arg)
0092 if ~isa(arg,'struct')
0093 error(sprintf(['Expected argument %d to be a string parameter name ' ...
0094 'or an options structure\ncreated with OPTIMSET.'], i));
0095 end
0096 for j = 1:m
0097 if any(strcmp(fieldnames(arg),deblank(Names(j,:))))
0098 eval(['val = arg.' Names(j,:) ';']);
0099 else
0100 val = [];
0101 end
0102 if ~isempty(val)
0103 eval(['options.' Names(j,:) '= val;']);
0104 end
0105 end
0106 end
0107 i = i + 1;
0108 end
0109
0110
0111 if rem(nargin-i+1,2) ~= 0
0112 error('Arguments must occur in name-value pairs.');
0113 end
0114 expectval = 0;
0115 while i <= nargin
0116 arg = varargin{i};
0117
0118 if ~expectval
0119 if ~ischar(arg)
0120 error(sprintf('Expected argument %d to be a string parameter name.', i));
0121 end
0122
0123 lowArg = lower(arg);
0124 j = strmatch(lowArg,names);
0125 if isempty(j)
0126 error(sprintf('Unrecognized parameter name ''%s''.', arg));
0127 elseif length(j) > 1
0128
0129 k = strmatch(lowArg,names,'exact');
0130 if length(k) == 1
0131 j = k;
0132 else
0133 msg = sprintf('Ambiguous parameter name ''%s'' ', arg);
0134 msg = [msg '(' deblank(Names(j(1),:))];
0135 for k = j(2:length(j))'
0136 msg = [msg ', ' deblank(Names(k,:))];
0137 end
0138 msg = sprintf('%s).', msg);
0139 error(msg);
0140 end
0141 end
0142 expectval = 1;
0143
0144 else
0145 eval(['options.' Names(j,:) '= arg;']);
0146 expectval = 0;
0147
0148 end
0149 i = i + 1;
0150 end
0151
0152 if expectval
0153 error(sprintf('Expected value for parameter ''%s''.', arg));
0154 end
0155