changeset 30236:628f26e122d9

maint: use rows() or columns() instead of size(__, 1 | 2) for clarity. * ccolamd.cc, colamd.cc, Map.m, material.m, isocolors.m, isonormals.m, isosurface.m, light.m, reducepatch.m, reducevolume.m, movfun.m, ilu.m, __alltohandles__.m, dump_demos.m, mk-sparse-tst.sh: Use rows() or columns() instead of size(__, 1 | 2) for clarity.
author Rik <rik@octave.org>
date Mon, 11 Oct 2021 20:09:59 -0700
parents 3646ef5efd27
children 2b74543c85ea
files libinterp/corefcn/ccolamd.cc libinterp/corefcn/colamd.cc scripts/+containers/Map.m scripts/plot/appearance/material.m scripts/plot/draw/isocolors.m scripts/plot/draw/isonormals.m scripts/plot/draw/isosurface.m scripts/plot/draw/light.m scripts/plot/draw/reducepatch.m scripts/plot/draw/reducevolume.m scripts/signal/movfun.m scripts/sparse/ilu.m scripts/sparse/private/__alltohandles__.m scripts/testfun/private/dump_demos.m test/mk-sparse-tst.sh
diffstat 15 files changed, 49 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/ccolamd.cc	Sat Oct 09 13:48:40 2021 +0200
+++ b/libinterp/corefcn/ccolamd.cc	Mon Oct 11 20:09:59 2021 -0700
@@ -187,7 +187,7 @@
             octave_stdout << "knobs(2): " << User_knobs(1)
                           << ", rows with > max (16,"
                           << knobs[CCOLAMD_DENSE_ROW]
-                          << "*sqrt (size(A,2)))"
+                          << "*sqrt (columns(A)))"
                           << " entries removed\n";
           else
             octave_stdout << "knobs(2): " << User_knobs(1)
@@ -446,7 +446,7 @@
             octave_stdout << "knobs(1): " << User_knobs(0)
                           << ", rows/cols with > max (16,"
                           << knobs[CCOLAMD_DENSE_ROW]
-                          << "*sqrt (size(A,2)))"
+                          << "*sqrt (columns(A)))"
                           << " entries removed\n";
           else
             octave_stdout << "knobs(1): " << User_knobs(0)
--- a/libinterp/corefcn/colamd.cc	Sat Oct 09 13:48:40 2021 +0200
+++ b/libinterp/corefcn/colamd.cc	Mon Oct 11 20:09:59 2021 -0700
@@ -313,7 +313,7 @@
           if (knobs[COLAMD_DENSE_ROW] >= 0)
             octave_stdout << "knobs(1): " << User_knobs (0)
                           << ", rows with > max (16,"
-                          << knobs[COLAMD_DENSE_ROW] << "*sqrt (size(A,2)))"
+                          << knobs[COLAMD_DENSE_ROW] << "*sqrt (columns(A)))"
                           << " entries removed\n";
           else
             octave_stdout << "knobs(1): " << User_knobs (0)
--- a/scripts/+containers/Map.m	Sat Oct 09 13:48:40 2021 +0200
+++ b/scripts/+containers/Map.m	Mon Oct 11 20:09:59 2021 -0700
@@ -580,8 +580,8 @@
 %! m = containers.Map ();
 %! assert (m.Count, uint64 (0));
 %! assert (length (m), 0);
-%! assert (size (m, 1), 0);
-%! assert (size (m, 2), 1);
+%! assert (rows (m), 0);
+%! assert (columns (m), 1);
 %! assert (isempty (m));
 %! assert (isempty (keys (m)));
 %! assert (isempty (values (m)));
--- a/scripts/plot/appearance/material.m	Sat Oct 09 13:48:40 2021 +0200
+++ b/scripts/plot/appearance/material.m	Mon Oct 11 20:09:59 2021 -0700
@@ -291,7 +291,7 @@
 %!test
 %! mtypes = material ();
 %! assert (iscell (mtypes));
-%! assert (size (mtypes, 2), 1);
+%! assert (columns (mtypes), 1);
 %! assert (all (cellfun (@ischar, mtypes)));
 
 %!test
--- a/scripts/plot/draw/isocolors.m	Sat Oct 09 13:48:40 2021 +0200
+++ b/scripts/plot/draw/isocolors.m	Mon Oct 11 20:09:59 2021 -0700
@@ -65,8 +65,8 @@
     case 2
       c = varargin{1};
       vp = varargin{2};
-      x = 1:size (c, 2);
-      y = 1:size (c, 1);
+      x = 1:columns (c);
+      y = 1:rows (c);
       z = 1:size (c, 3);
     case 4
       calc_rgb = true;
@@ -74,8 +74,8 @@
       G = varargin{2};
       B = varargin{3};
       vp = varargin{4};
-      x = 1:size (R, 1);
-      y = 1:size (R, 2);
+      x = 1:rows (R);
+      y = 1:columns (R);
       z = 1:size (R, 3);
     case 5
       x = varargin{1};
--- a/scripts/plot/draw/isonormals.m	Sat Oct 09 13:48:40 2021 +0200
+++ b/scripts/plot/draw/isonormals.m	Mon Oct 11 20:09:59 2021 -0700
@@ -80,8 +80,8 @@
     case 2
       val = varargin{1};
       vp = varargin{2};
-      x = 1:size (val, 2);
-      y = 1:size (val, 1);
+      x = 1:columns (val);
+      y = 1:rows (val);
       z = 1:size (val, 3);
 
     case 5
--- a/scripts/plot/draw/isosurface.m	Sat Oct 09 13:48:40 2021 +0200
+++ b/scripts/plot/draw/isosurface.m	Mon Oct 11 20:09:59 2021 -0700
@@ -318,10 +318,10 @@
   endif
 
   if (isempty (x))
-    x = 1:size (v, 2);
+    x = 1:columns (v);
   endif
   if (isempty (y))
-    y = 1:size (v, 1);
+    y = 1:rows (v);
   endif
   if (isempty (z))
     z = 1:size (v, 3);
--- a/scripts/plot/draw/light.m	Sat Oct 09 13:48:40 2021 +0200
+++ b/scripts/plot/draw/light.m	Mon Oct 11 20:09:59 2021 -0700
@@ -158,14 +158,14 @@
 %! ## Lighting modes on surfaces
 %! clf;
 %! Z = peaks ();
-%! [X, Y] = meshgrid (1:size (Z, 2), 1:size (Z, 1));
+%! [X, Y] = meshgrid (1:columns (Z), 1:rows (Z));
 %!
 %! h_axes1 = axes ();
 %! surf (X, Y, Z, "LineStyle", "none", "FaceLighting", "none");
 %! hold on;
-%! surf (X + round (1.2 * size (Z, 2)), Y, Z, "LineStyle", "none", ...
+%! surf (X + round (1.2 * columns (Z)), Y, Z, "LineStyle", "none", ...
 %!       "FaceLighting", "flat");
-%! surf (X + round (2.4 * size (Z, 2)), Y, Z, "LineStyle", "none", ...
+%! surf (X + round (2.4 * columns (Z)), Y, Z, "LineStyle", "none", ...
 %!       "FaceLighting", "gouraud");
 %! axis tight
 %! axis equal
--- a/scripts/plot/draw/reducepatch.m	Sat Oct 09 13:48:40 2021 +0200
+++ b/scripts/plot/draw/reducepatch.m	Mon Oct 11 20:09:59 2021 -0700
@@ -394,16 +394,16 @@
 ## two inputs (structure, reduction_factor > 1), two outputs
 %!test
 %! [faces_reduced, vertices_reduced] = reducepatch (fv, 20);
-%! assert (size (faces_reduced, 1), 20, 3);
-%! assert (size (faces_reduced, 2), 3);
-%! assert (size (vertices_reduced, 2), 3);
+%! assert (rows (faces_reduced), 20, 3);
+%! assert (columns (faces_reduced), 3);
+%! assert (columns (vertices_reduced), 3);
 
 ## three inputs (faces, vertices, reduction_factor < 1), two outputs
 %!test
 %! [faces_reduced, vertices_reduced] = reducepatch (faces, vertices, .5);
-%! assert (size (faces_reduced, 1), num_faces * .5, 3);
-%! assert (size (faces_reduced, 2), 3);
-%! assert (size (vertices_reduced, 2), 3);
+%! assert (rows (faces_reduced), num_faces * .5, 3);
+%! assert (columns (faces_reduced), 3);
+%! assert (columns (vertices_reduced), 3);
 
 ## two inputs (structure, reduction_factor < 1) + one string, no outputs
 ## (update patch object in figure)
@@ -427,16 +427,16 @@
 ## two inputs (structure, reduction_factor < 1) + one string, two outputs
 %!test
 %! [faces_reduced, vertices_reduced] = reducepatch (fv, .4, "fast");
-%! assert (size (faces_reduced, 1), num_faces * .4, 3);
-%! assert (size (faces_reduced, 2), 3);
-%! assert (size (vertices_reduced, 2), 3);
+%! assert (rows (faces_reduced), num_faces * .4, 3);
+%! assert (columns (faces_reduced), 3);
+%! assert (columns (vertices_reduced), 3);
 
 ## one input (structure) + two (empty) strings, two outputs
 %!test
 %! [faces_reduced, vertices_reduced] = reducepatch (fv, "f", "");
-%! assert (size (faces_reduced, 1), num_faces * .5, 3);
-%! assert (size (faces_reduced, 2), 3);
-%! assert (size (vertices_reduced, 2), 3);
+%! assert (rows (faces_reduced), num_faces * .5, 3);
+%! assert (columns (faces_reduced), 3);
+%! assert (columns (vertices_reduced), 3);
 
 ## test for each error
 %!error <Invalid call> reducepatch ()
@@ -452,11 +452,11 @@
 %!error <REDUCTION_FACTOR must be a positive scalar> reducepatch (fv, -5)
 %!error <VERTICES must be an Mx3 matrix> reducepatch (faces, .7, "v")
 %!error <reducepatch: Currently patches must consist of triangles only>
-%! faces_new = NaN (size (faces, 1), 4);
+%! faces_new = NaN (rows (faces), 4);
 %! faces_new(:,1:3) = faces;
 %! faces_new(1,4) = 5;
 %! reducepatch (faces_new, vertices);
 %!error <reducepatch: not enough VERTICES for given FACES>
 %! faces_new = faces;
-%! faces_new(1,3) = size (vertices, 1) + 1;
+%! faces_new(1,3) = rows (vertices) + 1;
 %! reducepatch (faces_new, vertices);
--- a/scripts/plot/draw/reducevolume.m	Sat Oct 09 13:48:40 2021 +0200
+++ b/scripts/plot/draw/reducevolume.m	Mon Oct 11 20:09:59 2021 -0700
@@ -137,10 +137,10 @@
 
   if (naout == 4)
     if (isempty (x))
-      x = 1:size (v, 2);
+      x = 1:columns (v);
     endif
     if (isempty (y))
-      y = 1:size (v, 1);
+      y = 1:rows (v);
     endif
     if (isempty (z))
       z = 1:size (v, 3);
--- a/scripts/signal/movfun.m	Sat Oct 09 13:48:40 2021 +0200
+++ b/scripts/signal/movfun.m	Mon Oct 11 20:09:59 2021 -0700
@@ -161,7 +161,7 @@
 ##
 ## @example
 ## @group
-## @var{fcn} = @@(x) basefcn (x)(:,size(x,2) * (@var{D}-1) + (1:size(x,2)));
+## @var{fcn} = @@(x) basefcn (x)(:,columns(x) * (@var{D}-1) + (1:columns(x)));
 ## @var{y} = movfun (@@fcn, @dots{});
 ## @end group
 ## @end example
--- a/scripts/sparse/ilu.m	Sat Oct 09 13:48:40 2021 +0200
+++ b/scripts/sparse/ilu.m	Mon Oct 11 20:09:59 2021 -0700
@@ -279,7 +279,7 @@
 %! opts.milu = "row";
 %! opts.droptol = dtol;
 %! [L, U] = ilu (A, opts);
-%! e = ones (size (A, 2),1);
+%! e = ones (columns (A),1);
 %! assert (norm (A*e - L*U*e), 1e-14, 1e-14);
 %!test
 %! opts.type = "crout";
--- a/scripts/sparse/private/__alltohandles__.m	Sat Oct 09 13:48:40 2021 +0200
+++ b/scripts/sparse/private/__alltohandles__.m	Mon Oct 11 20:09:59 2021 -0700
@@ -68,7 +68,7 @@
     error ([solver_name, ": A must be a square matrix or a function handle"]);
   else
     A_is_numeric = true;
-    if (size (A, 2) != size (b, 1))
+    if (columns (A) != rows (b))
       error ("__alltohandles__: dimension of B is not consistent with A");
     endif
   endif
--- a/scripts/testfun/private/dump_demos.m	Sat Oct 09 13:48:40 2021 +0200
+++ b/scripts/testfun/private/dump_demos.m	Mon Oct 11 20:09:59 2021 -0700
@@ -339,14 +339,14 @@
 "    style = 'profile';                                                       "
 "  end                                                                        "
 "                                                                             "
-"  idx = 1:size (cmap, 1);                                                    "
+"  idx = 1:rows (cmap);                                                       "
 "  switch (lower (style))                                                     "
 "    case 'profile'                                                           "
 "      htmp = plot (idx, cmap(:,1), 'r', ...                                  "
 "                   idx, cmap(:,2), 'g', ...                                  "
 "                   idx, cmap(:,3), 'b');                                     "
 "      set (gca (), 'ytick', 0:0.1:1);                                        "
-"      set (gca (), 'xlim', [0 size(cmap,1)]);                                "
+"      set (gca (), 'xlim', [0 rows(cmap)]);                                  "
 "    case 'composite'                                                         "
 "      htmp = image (idx);                                                    "
 "      set (gca, 'ytick', []);                                                "
--- a/test/mk-sparse-tst.sh	Sat Oct 09 13:48:40 2021 +0200
+++ b/test/mk-sparse-tst.sh	Mon Oct 11 20:09:59 2021 -0700
@@ -403,7 +403,7 @@
 %!test
 %! [tb,tc] = spdiags (as);
 %! assert (spdiags (tb,tc,sparse (zeros (size (as)))), as);
-%! assert (spdiags (tb,tc,size (as,1),size (as,2)), as);
+%! assert (spdiags (tb,tc,rows (as),columns (as)), as);
 
 EOF
 }
@@ -857,8 +857,8 @@
 %!assert (as(ridx,:), sparse (af(ridx,:)))
 %!assert (as(:,cidx), sparse (af(:,cidx)))
 %!assert (as(:,:), sparse (af(:,:)))
-%!assert (as((size (as,1):-1:1),:), sparse (af((size (af,1):-1:1),:)))
-%!assert (as(:,(size (as,2):-1:1)), sparse (af(:, (size (af,2):-1:1))))
+%!assert (as((rows (as):-1:1),:), sparse (af((size (af,1):-1:1),:)))
+%!assert (as(:,(columns (as):-1:1)), sparse (af(:, (size (af,2):-1:1))))
 
 %% Indexing tests
 %!assert (full (as([1,1],:)), af([1,1],:))
@@ -869,20 +869,20 @@
 
 %% Assignment test
 %!test
-%! ts = as; ts(:,:) = ts(fliplr (1:size (as,1)),:);
-%! tf = af; tf(:,:) = tf(fliplr (1:size (af,1)),:);
+%! ts = as; ts(:,:) = ts(fliplr (1:rows (as)),:);
+%! tf = af; tf(:,:) = tf(fliplr (1:rows (af)),:);
 %! assert (ts, sparse (tf));
 %!test
-%! ts = as; ts(fliplr (1:size (as,1)),:) = ts;
-%! tf = af; tf(fliplr (1:size (af,1)),:) = tf;
+%! ts = as; ts(fliplr (1:rows (as)),:) = ts;
+%! tf = af; tf(fliplr (1:rows (af)),:) = tf;
 %! assert (ts, sparse (tf));
 %!test
-%! ts = as; ts(:,fliplr (1:size (as,2))) = ts;
-%! tf = af; tf(:,fliplr (1:size (af,2))) = tf;
+%! ts = as; ts(:,fliplr (1:columns (as))) = ts;
+%! tf = af; tf(:,fliplr (1:columns (af))) = tf;
 %! assert (ts, sparse (tf));
 %!test
-%! ts(fliplr (1:size (as,1))) = as(:,1);
-%! tf(fliplr (1:size (af,1))) = af(:,1);
+%! ts(fliplr (1:rows (as))) = as(:,1);
+%! tf(fliplr (1:rows (af))) = af(:,1);
 %! assert (ts, sparse (tf));
 
 %% Deletion tests