Mercurial > octave
changeset 32501:5fac69033835 stable
maint: Style check m-files in scripts/ directory before 9.1 release.
* scripts/ode/private/ode_event_handler.m,
scripts/ode/private/odemergeopts.m,
scripts/ode/private/runge_kutta_interpolate.m, scripts/optimization/sqp.m,
scripts/pkg/private/build.m, scripts/plot/appearance/text.m,
scripts/plot/draw/quiver3.m, scripts/set/ismembertol.m,
scripts/signal/unwrap.m, scripts/specfun/betainc.m, scripts/specfun/primes.m,
scripts/statistics/cov.m, scripts/statistics/mad.m, scripts/statistics/mode.m,
scripts/strings/dec2bin.m, scripts/strings/unicode2native.m,
scripts/time/datevec.m:
Style check m-files in scripts/ directory before 9.1 release.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 24 Nov 2023 22:47:19 -0800 |
parents | 24b6c777b7a5 |
children | 8d03b4cd4dd5 bce9463833d2 |
files | scripts/general/interp2.m scripts/miscellaneous/license.m scripts/ode/private/integrate_adaptive.m scripts/ode/private/ode_event_handler.m scripts/ode/private/odemergeopts.m scripts/ode/private/runge_kutta_interpolate.m scripts/optimization/sqp.m scripts/pkg/private/build.m scripts/plot/appearance/text.m scripts/plot/draw/quiver3.m scripts/set/ismembertol.m scripts/signal/unwrap.m scripts/specfun/betainc.m scripts/specfun/primes.m scripts/statistics/cov.m scripts/statistics/mad.m scripts/statistics/mode.m scripts/strings/dec2bin.m scripts/strings/unicode2native.m scripts/time/datevec.m |
diffstat | 20 files changed, 34 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/general/interp2.m Fri Nov 24 15:20:18 2023 -0800 +++ b/scripts/general/interp2.m Fri Nov 24 22:47:19 2023 -0800 @@ -446,7 +446,7 @@ h_x = (XI - reshape (X(idx_x), size (idx_x))) / spread_x; h_y = (YI - reshape (Y(idx_y), size (idx_y))) / spread_y; - # adjust indexes for padding + ## adjust indexes for padding idx_x += -kernel_bounds(1) - 1; idx_y += -kernel_bounds(1) - 1;
--- a/scripts/miscellaneous/license.m Fri Nov 24 15:20:18 2023 -0800 +++ b/scripts/miscellaneous/license.m Fri Nov 24 22:47:19 2023 -0800 @@ -157,7 +157,7 @@ %! list = pkg ("list"); %! for idx = 1: numel (list) %! name = list{idx}.name; -%! if (list{idx}.loaded); +%! if (list{idx}.loaded) %! assert ((license ("inuse", name)).feature, name); %! else %! rv = license ("inuse", name);
--- a/scripts/ode/private/integrate_adaptive.m Fri Nov 24 15:20:18 2023 -0800 +++ b/scripts/ode/private/integrate_adaptive.m Fri Nov 24 22:47:19 2023 -0800 @@ -97,7 +97,7 @@ ## Initialize Refine value refine = options.Refine; - if isempty (refine) + if (isempty (refine)) refine = 1; elseif ((refine != round (refine)) || (refine < 1)) refine = 1;
--- a/scripts/ode/private/ode_event_handler.m Fri Nov 24 15:20:18 2023 -0800 +++ b/scripts/ode/private/ode_event_handler.m Fri Nov 24 22:47:19 2023 -0800 @@ -133,7 +133,7 @@ evtcntnew += 1; endfor ## Sort by time of event - if length (idx) > 1 + if (length (idx) > 1) [tnews, idx_sort] = sort (tnews, "ascend"); idxs = idx(idx_sort); ynews = ynews(idx_sort,:); @@ -144,7 +144,7 @@ ## Check for terminal events and remove any events after terminal. ## Any events at same time as first terminal event will be retained. idx3 = find (terms, 1); # Find first terminal event by time - if ! isempty (idx3) + if (! isempty (idx3)) t_cutoff = tnews(idx3); ## Last index to return evtcntnew = find (tnews == t_cutoff, 1, "last");
--- a/scripts/ode/private/odemergeopts.m Fri Nov 24 15:20:18 2023 -0800 +++ b/scripts/ode/private/odemergeopts.m Fri Nov 24 22:47:19 2023 -0800 @@ -32,8 +32,7 @@ ## but we don't use that here. Should the calls be fixed or should we ## do something with the solver argument here? -function options = odemergeopts (caller, useroptions, options, classes, - attributes, solver); +function options = odemergeopts (caller, useroptions, options, classes, attributes, solver) for [value, key] = options
--- a/scripts/ode/private/runge_kutta_interpolate.m Fri Nov 24 15:20:18 2023 -0800 +++ b/scripts/ode/private/runge_kutta_interpolate.m Fri Nov 24 22:47:19 2023 -0800 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {@var{u_interp} =} odemergeopts (@var{order}, @var{z}, @var{t}, @var{k_vals}) +## @deftypefn {} {@var{u_interp} =} odemergeopts (@var{order}, @var{z}, @var{t}, @var{u}, @var{k_vals}) ## Undocumented internal function. ## @end deftypefn
--- a/scripts/optimization/sqp.m Fri Nov 24 15:20:18 2023 -0800 +++ b/scripts/optimization/sqp.m Fri Nov 24 22:47:19 2023 -0800 @@ -732,7 +732,7 @@ ub = globals.ub - x(ubidx, 1); else ub = []; - end + endif res = [ci; lb; ub];
--- a/scripts/pkg/private/build.m Fri Nov 24 15:20:18 2023 -0800 +++ b/scripts/pkg/private/build.m Fri Nov 24 22:47:19 2023 -0800 @@ -77,10 +77,10 @@ else arch_abi = getarch (); configure_make (desc, build_root, verbose); - if exist (fullfile (build_root, "src", "configure"), "file") + if (exist (fullfile (build_root, "src", "configure"), "file")) unlink (fullfile (build_root, "src", "configure")); endif - if exist (fullfile (build_root, "src", "Makefile"), "file") + if (exist (fullfile (build_root, "src", "Makefile"), "file")) unlink (fullfile (build_root, "src", "Makefile")); endif endif
--- a/scripts/plot/appearance/text.m Fri Nov 24 15:20:18 2023 -0800 +++ b/scripts/plot/appearance/text.m Fri Nov 24 22:47:19 2023 -0800 @@ -245,7 +245,7 @@ %! va = {"bottom", "middle", "top"}; %! x = [0.25 0.5 0.75]; %! y = x; -%! for t = 0:30:359; +%! for t = 0:30:359 %! for nh = 1:numel (ha) %! for nv = 1:numel (va) %! text (x(nh), y(nv), "Hello World", ... @@ -271,7 +271,7 @@ %! "facealpha", 0); %! colors = jet (9); %! ii = 1; -%! for t = 0:45:359; +%! for t = 0:45:359 %! ii = ii +1; %! text (25, 25, 0, "Vertical Alignment = Bottom", ... %! "rotation", t, ...
--- a/scripts/plot/draw/quiver3.m Fri Nov 24 15:20:18 2023 -0800 +++ b/scripts/plot/draw/quiver3.m Fri Nov 24 22:47:19 2023 -0800 @@ -108,6 +108,7 @@ endfunction + %!demo %! clf; %! colormap ("default");
--- a/scripts/set/ismembertol.m Fri Nov 24 15:20:18 2023 -0800 +++ b/scripts/set/ismembertol.m Fri Nov 24 22:47:19 2023 -0800 @@ -93,8 +93,7 @@ endif if (nargin < 3 || ! isnumeric (varargin{1})) - # defaut tolerance - tol = 1e-6; + tol = 1e-6; # default tolerance else tol = varargin{1}; varargin(1) = []; @@ -163,7 +162,7 @@ endif s_idx = reshape (s_idx, sa); tf = reshape (tf, sa); - else # all_indices + else # all_indices s_idx = cell (size(a)); tf = zeros (size(a)); C = unique (s_j); @@ -225,6 +224,7 @@ endfunction + %!demo %! ## Group random data %! A = rand (1000, 2);
--- a/scripts/signal/unwrap.m Fri Nov 24 15:20:18 2023 -0800 +++ b/scripts/signal/unwrap.m Fri Nov 24 22:47:19 2023 -0800 @@ -158,6 +158,7 @@ endif endif + endfunction @@ -192,8 +193,10 @@ front_gap_sizes = (sum (nf_front, 1))(any (nf_front, 1))(:); x(nf_front) = repelems (x(locs_after), ... [1:numel(front_gap_sizes); front_gap_sizes'])'; + endfunction + %!shared i, t, r, w, tol %! i = 0; %! t = [];
--- a/scripts/specfun/betainc.m Fri Nov 24 15:20:18 2023 -0800 +++ b/scripts/specfun/betainc.m Fri Nov 24 22:47:19 2023 -0800 @@ -87,7 +87,7 @@ error ("betainc: all inputs must be real"); endif - if ! (isnumeric (x) && isnumeric (a) && isnumeric (b)) + if (! (isnumeric (x) && isnumeric (a) && isnumeric (b))) error ("betainc: all inputs must be numeric"); endif @@ -124,7 +124,7 @@ ## For x = 0 or 1, the output always reduces to 0 or 1. Input validation ## ensures all interger inputs must be 0 or 1. I = x; - return + return; else I = zeros (size (x), class (x)); endif
--- a/scripts/specfun/primes.m Fri Nov 24 15:20:18 2023 -0800 +++ b/scripts/specfun/primes.m Fri Nov 24 22:47:19 2023 -0800 @@ -58,9 +58,9 @@ cls = class (n); # if n is not double, store its class n = double (n); # and use only double for internal use. - # This conversion is needed for both calculation speed (twice as fast as - # integer) and also for the accuracy of the sieve calculation when given - # integer input, to avoid unwanted rounding in the sieve lengths. + ## This conversion is needed for both calculation speed (twice as fast as + ## integer) and also for the accuracy of the sieve calculation when given + ## integer input, to avoid unwanted rounding in the sieve lengths. if (n > flintmax ()) warning ("primes: input exceeds flintmax. Results may be inaccurate."); @@ -107,7 +107,7 @@ p = sort ([2, 3, 6*find(sievem)-1, 6*find(sievep)+1]); endif - # cast back to the type of the input + ## cast back to the type of the input p = cast (p, cls); endfunction
--- a/scripts/statistics/cov.m Fri Nov 24 15:20:18 2023 -0800 +++ b/scripts/statistics/cov.m Fri Nov 24 22:47:19 2023 -0800 @@ -302,6 +302,7 @@ endswitch endfunction + %!test %! x = rand (10); %! cx1 = cov (x);
--- a/scripts/statistics/mad.m Fri Nov 24 15:20:18 2023 -0800 +++ b/scripts/statistics/mad.m Fri Nov 24 22:47:19 2023 -0800 @@ -97,12 +97,12 @@ ## First check for special empty case. if (isempty (x) && ndims (x) == 2 && size (x) == [0, 0]) - if (isa (x, "single")) + if (isa (x, "single")) m = NaN ("single"); else m = NaN; endif - return + return; endif ## Then find the first non-singleton dimension. @@ -119,6 +119,7 @@ endfunction + %!assert (mad (123), 0) %!assert (mad (Inf), NaN) %!assert (mad ([3, Inf]),Inf)
--- a/scripts/statistics/mode.m Fri Nov 24 15:20:18 2023 -0800 +++ b/scripts/statistics/mode.m Fri Nov 24 22:47:19 2023 -0800 @@ -88,7 +88,7 @@ c(:) = NaN (1, 0); endif endif - return + return; endif if (dim > nd || sz(dim) == 1)
--- a/scripts/strings/dec2bin.m Fri Nov 24 15:20:18 2023 -0800 +++ b/scripts/strings/dec2bin.m Fri Nov 24 22:47:19 2023 -0800 @@ -79,7 +79,7 @@ endif if (all (d >= 0)) - return + return; endif ## If we are here, there are negative inputs, so we need to
--- a/scripts/strings/unicode2native.m Fri Nov 24 15:20:18 2023 -0800 +++ b/scripts/strings/unicode2native.m Fri Nov 24 22:47:19 2023 -0800 @@ -83,7 +83,7 @@ %!testif HAVE_ICONV <*64331> %! assert (! isempty (unicode2native ("abc", ""))); -# short character arrays with invalid UTF-8 +## short character arrays with invalid UTF-8 %!testif HAVE_ICONV <*63930> %! assert (unicode2native (char (230), 'windows-1252'), uint8 (63)); %!testif HAVE_ICONV <*63930> @@ -97,7 +97,7 @@ %! assert (unicode2native (char ([230, 10]), 'windows-1252'), %! uint8 ([63, 10])); -# target encoding with surrogates larger than a byte +## target encoding with surrogates larger than a byte %!testif HAVE_ICONV <*64139> %! assert (typecast (unicode2native ('abcde', %! ['utf-16', nthargout(3, 'computer'), 'e']),
--- a/scripts/time/datevec.m Fri Nov 24 15:20:18 2023 -0800 +++ b/scripts/time/datevec.m Fri Nov 24 22:47:19 2023 -0800 @@ -532,7 +532,7 @@ %!assert <*42241> (datevec ("08/15/2013", "mm"), [1900, 8, 0, 0, 0, 0]) %!assert <*42241> (datevec ("08ABC", "mm"), [1900, 8, 0, 0, 0, 0]) -# 6 mm/dd +## 6 mm/dd %!assert <*42241> (datevec ("08/15"), [yr, 8, 15, 0, 0, 0]) %!assert <*42241> (datevec ("08/15", "mm/dd"), [yr, 8, 15, 0, 0, 0]) %!assert <*42241> (datevec ("08/15/13", "mm/dd"), [yr, 8, 15, 0, 0, 0])