changeset 22708:843b45bd9912

maint: Periodic merge of stable to default.
author John W. Eaton <jwe@octave.org>
date Tue, 01 Nov 2016 16:37:35 -0400
parents 5a5d6c8647f6 (current diff) 413a19bca7f3 (diff)
children 5c04055aa767
files libinterp/corefcn/data.cc scripts/general/publish.m
diffstat 7 files changed, 47 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/cellfun.cc	Tue Nov 01 07:18:48 2016 -0700
+++ b/libinterp/corefcn/cellfun.cc	Tue Nov 01 16:37:35 2016 -0400
@@ -1027,7 +1027,7 @@
 @example
 @group
 arrayfun (@@atan2, [1, 0], [0, 1])
-     @result{} [ 1.5708   0.0000 ]
+     @result{} [ 1.57080   0.00000 ]
 @end group
 @end example
 
--- a/libinterp/corefcn/data.cc	Tue Nov 01 07:18:48 2016 -0700
+++ b/libinterp/corefcn/data.cc	Tue Nov 01 16:37:35 2016 -0400
@@ -2744,28 +2744,33 @@
 
 DEFUN (size, args, nargout,
        doc: /* -*- texinfo -*-
-@deftypefn  {} {} size (@var{a})
-@deftypefnx {} {} size (@var{a}, @var{dim})
-Return the number of rows and columns of @var{a}.
-
-With one input argument and one output argument, the result is returned
-in a row vector.  If there are multiple output arguments, the number of
-rows is assigned to the first, and the number of columns to the second,
-etc.  For example:
+@deftypefn  {} {@var{sz} =} size (@var{a})
+@deftypefnx {} {@var{dim_sz} =} size (@var{a}, @var{dim})
+@deftypefnx {} {[@var{rows}, @var{cols}, @dots{}, @var{dim_N_sz}] =} size (@dots{})
+Return a row vector with the size (number of elements) of each dimension for
+the object @var{a}.
+
+When given a second argument, @var{dim}, return the size of the corresponding
+dimension.
+
+With a single output argument, @code{size} returns a row vector.  When called
+with multiple output arguments, @code{size} returns the size of dimension N
+in the Nth argument.  The number of rows, dimension 1, is returned in the
+first argument, the number of columns, dimension 2, is returned in the
+second argument, etc.  If there are more dimensions in @var{a} then there are
+output arguments, @code{size} returns the total number of elements in the
+remaining dimensions in the final output argument.
+
+Example 1: single row vector output
 
 @example
 @group
 size ([1, 2; 3, 4; 5, 6])
    @result{} [ 3, 2 ]
-
-[nr, nc] = size ([1, 2; 3, 4; 5, 6])
-    @result{} nr = 3
-    @result{} nc = 2
 @end group
 @end example
 
-If given a second argument, @code{size} will return the size of the
-corresponding dimension.  For example,
+Example 2: number of elements in 2nd dimension (columns)
 
 @example
 @group
@@ -2774,8 +2779,26 @@
 @end group
 @end example
 
-@noindent
-returns the number of columns in the given matrix.
+Example 3: number of output arguments == number of dimensions
+
+@example
+@group
+[nr, nc] = size ([1, 2; 3, 4; 5, 6])
+    @result{} nr = 3
+    @result{} nc = 2
+@end group
+@end example
+
+Example 4: number of output arguments != number of dimensions
+
+@example
+@group
+[nr, remainder] = size (ones (2, 3, 4, 5)
+    @result{} nr = 2
+    @result{} remainder = 60
+@end group
+@end example
+
 @seealso{numel, ndims, length, rows, columns, size_equal, common_size}
 @end deftypefn */)
 {
--- a/libinterp/corefcn/fft.cc	Tue Nov 01 07:18:48 2016 -0700
+++ b/libinterp/corefcn/fft.cc	Tue Nov 01 16:37:35 2016 -0400
@@ -115,7 +115,7 @@
       octave_value_list idx (ndims);
       for (octave_idx_type i = 0; i < ndims; i++)
         idx(i) = idx_vector::colon;
-      idx(dim) = idx_vector (0);
+      idx(dim) = idx_vector (static_cast<octave_idx_type> (0));
 
       return arg.do_index_op (idx);
     }
@@ -301,4 +301,3 @@
 %!
 %! assert (ifft (S), s, 4*N*eps ("single"));
 */
-
--- a/libinterp/parse-tree/pt-eval.cc	Tue Nov 01 07:18:48 2016 -0700
+++ b/libinterp/parse-tree/pt-eval.cc	Tue Nov 01 16:37:35 2016 -0400
@@ -115,8 +115,7 @@
     if (debug_mode)
       do_breakpoint (cmd.is_breakpoint (true));
 
-    if (statement_context == function || statement_context == script
-        || in_loop_command)
+    if (in_loop_command)
       tree_continue_command::continuing = 1;
   }
 
--- a/scripts/general/deal.m	Tue Nov 01 07:18:48 2016 -0700
+++ b/scripts/general/deal.m	Tue Nov 01 16:37:35 2016 -0400
@@ -64,7 +64,7 @@
 ## @example
 ## @group
 ## c = @{[1 2], "Three", 4@};
-## [x, y, z ] = c@{:@}
+## [x, y, z] = c@{:@}
 ## @result{}
 ##    x =
 ##
--- a/scripts/geometry/voronoi.m	Tue Nov 01 07:18:48 2016 -0700
+++ b/scripts/geometry/voronoi.m	Tue Nov 01 16:37:35 2016 -0400
@@ -133,7 +133,7 @@
   edges = zeros (2, 0);
   for i = 1:numel (c)
     facet = c{i};
-    if (isempty (facet)) 
+    if (isempty (facet))
       continue;
     endif
     edges = [edges, [facet; [facet(end), facet(1:end-1)]]];
@@ -152,7 +152,7 @@
     radius = 1.1 * sumsq ([xmin, ymin] - ctr);
     dist = sumsq (p - ctr, 2);
 
-    p_inside = (1:rows (p))(dist < radius); 
+    p_inside = (1:rows (p))(dist < radius);
     edge_inside = any (ismember (edges, p_inside));
     edges = edges(:, edge_inside);
   else
@@ -212,7 +212,7 @@
 %! [vx, vy] = voronoi (x,y);
 %! assert (columns (vx), 3);
 
-%!testif HAVE_QHULL <37270> 
+%!testif HAVE_QHULL <37270>
 %! ## Duplicate points can cause an internal error
 %! x = [1,2,3, 3];  y = [2,3,1, 1];
 %! [vx, vy] = voronoi (x,y);
--- a/scripts/ode/ode23.m	Tue Nov 01 07:18:48 2016 -0700
+++ b/scripts/ode/ode23.m	Tue Nov 01 16:37:35 2016 -0400
@@ -159,7 +159,7 @@
   persistent ode23_ignore_options = ...
     {"BDF", "InitialSlope", "Jacobian", "JPattern",
      "MassSingular", "MaxOrder", "MvPattern", "Vectorized"};
-  
+
   defaults   = rmfield (defaults, ode23_ignore_options);
   classes    = rmfield (classes, ode23_ignore_options);
   attributes = rmfield (attributes, ode23_ignore_options);