# HG changeset patch # User John W. Eaton # Date 1705694618 18000 # Node ID dfa22c226af6f9ca5681c7a31973f72ea8fd61d5 # Parent 298c18eb7645210d98e9b9f0ed6d0d2de1141290# Parent 0e41f7d5ad18d1a18ff12de67e179b16f720a312 maint: merge default to bytecode-interpreter diff -r 298c18eb7645 -r dfa22c226af6 scripts/general/sortrows.m --- a/scripts/general/sortrows.m Fri Jan 19 14:36:34 2024 -0500 +++ b/scripts/general/sortrows.m Fri Jan 19 15:03:38 2024 -0500 @@ -87,10 +87,7 @@ i = sort_rows_idx_generic (default_mode, reverse_mode, A, c); endif - ## Only bother to compute s if needed. - if (isargout (1)) - s = A(i,:); - endif + s = A(i,:); endfunction diff -r 298c18eb7645 -r dfa22c226af6 scripts/linear-algebra/condest.m --- a/scripts/linear-algebra/condest.m Fri Jan 19 14:36:34 2024 -0500 +++ b/scripts/linear-algebra/condest.m Fri Jan 19 15:03:38 2024 -0500 @@ -237,7 +237,7 @@ [Ainv_norm, v, w] = normest1 (Ainvfcn, t, [], varargin{4:end}); cest = Anorm * Ainv_norm; - if (isargout (2)) + if (nargout > 1) v = w / norm (w, 1); endif diff -r 298c18eb7645 -r dfa22c226af6 scripts/linear-algebra/gls.m --- a/scripts/linear-algebra/gls.m Fri Jan 19 14:36:34 2024 -0500 +++ b/scripts/linear-algebra/gls.m Fri Jan 19 15:03:38 2024 -0500 @@ -137,11 +137,9 @@ beta = reshape (b, cx, cy); - if (isargout (2) || isargout (3)) + if (nargout > 1) r = y - x * beta; - if (isargout (2)) - v = (reshape (r, ry*cy, 1))' * (o^2) * reshape (r, ry*cy, 1) / (rx*cy - r); - endif + v = (reshape (r, ry*cy, 1))' * (o^2) * reshape (r, ry*cy, 1) / (rx*cy - r); endif endfunction diff -r 298c18eb7645 -r dfa22c226af6 scripts/linear-algebra/ols.m --- a/scripts/linear-algebra/ols.m Fri Jan 19 14:36:34 2024 -0500 +++ b/scripts/linear-algebra/ols.m Fri Jan 19 15:03:38 2024 -0500 @@ -137,10 +137,8 @@ beta = u \ (u' \ (x' * y)); endif - if (isargout (2) || isargout (3)) + if (nargout > 1) r = y - x * beta; - endif - if (isargout (2)) ## z is of full rank, avoid the SVD in rnk if (p == 0) diff -r 298c18eb7645 -r dfa22c226af6 scripts/ode/decic.m --- a/scripts/ode/decic.m Fri Jan 19 14:36:34 2024 -0500 +++ b/scripts/ode/decic.m Fri Jan 19 15:03:38 2024 -0500 @@ -179,7 +179,7 @@ y0_new(! fixed_y0) = x(1:nl); yp0_new(! fixed_yp0) = x(nl+1:nl+nu); - if (isargout (3)) + if (nargout > 2) resnorm = fcn (t0, y0_new, yp0_new); endif diff -r 298c18eb7645 -r dfa22c226af6 scripts/optimization/fminsearch.m --- a/scripts/optimization/fminsearch.m Fri Jan 19 14:36:34 2024 -0500 +++ b/scripts/optimization/fminsearch.m Fri Jan 19 15:03:38 2024 -0500 @@ -178,7 +178,7 @@ [x, exitflag, output] = nmsmax (fcn, x0, options, varargin{:}); - if (isargout (2)) + if (nargout > 1) fval = feval (fcn, x); endif diff -r 298c18eb7645 -r dfa22c226af6 scripts/optimization/lsqnonneg.m --- a/scripts/optimization/lsqnonneg.m Fri Jan 19 14:36:34 2024 -0500 +++ b/scripts/optimization/lsqnonneg.m Fri Jan 19 15:03:38 2024 -0500 @@ -204,23 +204,23 @@ ## LH12: complete. ## Generate the additional output arguments. - if (isargout (2)) + if (nargout > 1) resnorm = norm (c*x - d) ^ 2; endif - if (isargout (3)) + if (nargout > 2) residual = d - c*x; endif - if (isargout (4)) + if (nargout > 3) if (iter >= max_iter) exitflag = 0; else exitflag = iter; endif endif - if (isargout (5)) + if (nargout > 4) output = struct ("algorithm", "nnls", "iterations", iter); endif - if (isargout (6)) + if (nargout > 5) lambda = zeros (size (x)); lambda (setdiff (1:numel(x), p)) = w; endif diff -r 298c18eb7645 -r dfa22c226af6 scripts/optimization/pqpnonneg.m --- a/scripts/optimization/pqpnonneg.m Fri Jan 19 14:36:34 2024 -0500 +++ b/scripts/optimization/pqpnonneg.m Fri Jan 19 15:03:38 2024 -0500 @@ -211,20 +211,20 @@ ## LH12: complete. ## Generate the additional output arguments. - if (isargout (2)) + if (nargout > 1) minval = 1/2*(x'*c*x) + d'*x; endif - if (isargout (3)) + if (nargout > 2) if (iter >= max_iter) exitflag = 0; else exitflag = iter; endif endif - if (isargout (4)) + if (nargout > 3) output = struct ("algorithm", "nnls-pqp", "iterations", iter); endif - if (isargout (5)) + if (nargout > 4) lambda = zeros (size (x)); lambda (setdiff (1:numel(x), p)) = w; endif diff -r 298c18eb7645 -r dfa22c226af6 scripts/optimization/qp.m --- a/scripts/optimization/qp.m Fri Jan 19 14:36:34 2024 -0500 +++ b/scripts/optimization/qp.m Fri Jan 19 15:03:38 2024 -0500 @@ -437,10 +437,10 @@ x = x0; lambda = []; endif - if (isargout (2)) + if (nargout > 1) obj = 0.5 * x' * H * x + q' * x; endif - if (isargout (3)) + if (nargout > 2) INFO.solveiter = iter; INFO.info = info; endif diff -r 298c18eb7645 -r dfa22c226af6 scripts/plot/util/hgload.m --- a/scripts/plot/util/hgload.m Fri Jan 19 14:36:34 2024 -0500 +++ b/scripts/plot/util/hgload.m Fri Jan 19 15:03:38 2024 -0500 @@ -79,7 +79,7 @@ ## Override properties of top-level objects calc_old_prop = false; - if (isargout (2)) + if (nargout > 1) calc_old_prop = true; old_prop = repmat ({[]}, 1, numel (hg)); endif diff -r 298c18eb7645 -r dfa22c226af6 scripts/polynomial/deconv.m --- a/scripts/polynomial/deconv.m Fri Jan 19 14:36:34 2024 -0500 +++ b/scripts/polynomial/deconv.m Fri Jan 19 15:03:38 2024 -0500 @@ -70,7 +70,7 @@ r = y; endif - if (isargout (2)) + if (nargout > 1) if (ly >= la) r = [zeros(ly - la + 1, 1); r(1:la - 1)]; ## Respect the orientation of Y diff -r 298c18eb7645 -r dfa22c226af6 scripts/polynomial/polyfit.m --- a/scripts/polynomial/polyfit.m Fri Jan 19 14:36:34 2024 -0500 +++ b/scripts/polynomial/polyfit.m Fri Jan 19 15:03:38 2024 -0500 @@ -157,7 +157,7 @@ p = r \ (q' * y); p(k) = p; - if (isargout (2)) + if (nargout > 1) yf = v*p; if (y_is_row_vector) s.yf = yf.'; diff -r 298c18eb7645 -r dfa22c226af6 scripts/set/ismember.m --- a/scripts/set/ismember.m Fri Jan 19 14:36:34 2024 -0500 +++ b/scripts/set/ismember.m Fri Jan 19 15:03:38 2024 -0500 @@ -88,7 +88,7 @@ [real_argout{:}] = ismember (real (a), real (s), varargin{:}); [imag_argout{:}] = ismember (imag (a), imag (s), varargin{:}); tf = real_argout{1} & imag_argout{1}; - if (isargout (2)) + if (nargout > 1) s_idx = zeros (size (real_argout{2})); s_idx(tf) = min (real_argout{2}(tf), imag_argout{2}(tf)); endif diff -r 298c18eb7645 -r dfa22c226af6 scripts/set/unique.m --- a/scripts/set/unique.m Fri Jan 19 14:36:34 2024 -0500 +++ b/scripts/set/unique.m Fri Jan 19 15:03:38 2024 -0500 @@ -231,7 +231,7 @@ endif ## Calculate j output (3rd output) - if (isargout (3)) + if (nargout > 2) j = i; # cheap way to copy dimensions j(i) = cumsum ([1; ! match(:)]); if (! optsorted) @@ -245,7 +245,7 @@ endif ## Calculate i output (2nd output) - if (isargout (2)) + if (nargout > 1) if (optsorted) idx = find (match); if (! optlegacy && optfirst) diff -r 298c18eb7645 -r dfa22c226af6 scripts/strings/strtok.m --- a/scripts/strings/strtok.m Fri Jan 19 14:36:34 2024 -0500 +++ b/scripts/strings/strtok.m Fri Jan 19 15:03:38 2024 -0500 @@ -134,10 +134,10 @@ tmp = [tmp{:}]; endif tok(midx) = tmp(1:2:end); - if (isargout (2)) + if (nargout > 1) rem = cell (size (str)); rem(eidx) = {""}; - rem (midx) = tmp(2:2:end); + rem(midx) = tmp(2:2:end); endif endif diff -r 298c18eb7645 -r dfa22c226af6 scripts/time/datenum.m --- a/scripts/time/datenum.m Fri Jan 19 14:36:34 2024 -0500 +++ b/scripts/time/datenum.m Fri Jan 19 15:03:38 2024 -0500 @@ -240,7 +240,7 @@ days = day + (hour + (minute + second/60)/60)/24; ## Output seconds if asked so that etime can be more accurate - if (isargout (2)) + if (nargout > 1) secs = day*86400 + hour*3600 + minute*60 + second; endif diff -r 298c18eb7645 -r dfa22c226af6 scripts/time/weekday.m --- a/scripts/time/weekday.m Fri Jan 19 14:36:34 2024 -0500 +++ b/scripts/time/weekday.m Fri Jan 19 15:03:38 2024 -0500 @@ -73,7 +73,7 @@ ## Make Saturdays a 7 and not a 0. d(! d) = 7; - if (isargout (2)) + if (nargout > 1) if (strcmpi (format, "long")) names = {"Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" ... "Friday" "Saturday"};