changeset 25020:d0f9826f677d

maint: merge stable to default.
author Rik <rik@octave.org>
date Mon, 26 Mar 2018 21:17:17 -0700
parents 485ea63c5082 (current diff) 3b08577e6816 (diff)
children fdff879d8ae8
files
diffstat 8 files changed, 128 insertions(+), 69 deletions(-) [+]
line wrap: on
line diff
--- a/doc/interpreter/arith.txi	Mon Mar 26 16:41:21 2018 -0700
+++ b/doc/interpreter/arith.txi	Mon Mar 26 21:17:17 2018 -0700
@@ -254,8 +254,6 @@
 
 @DOCSTRING(lcm)
 
-@DOCSTRING(chop)
-
 @DOCSTRING(rem)
 
 @DOCSTRING(mod)
--- a/doc/interpreter/matrix.txi	Mon Mar 26 16:41:21 2018 -0700
+++ b/doc/interpreter/matrix.txi	Mon Mar 26 21:17:17 2018 -0700
@@ -124,9 +124,10 @@
 
 @DOCSTRING(nth_element)
 
-@anchor{XREFtriu}
 @DOCSTRING(tril)
 
+@DOCSTRING(triu)
+
 @DOCSTRING(vec)
 
 @DOCSTRING(vech)
--- a/doc/interpreter/module.mk	Mon Mar 26 16:41:21 2018 -0700
+++ b/doc/interpreter/module.mk	Mon Mar 26 21:17:17 2018 -0700
@@ -368,7 +368,8 @@
 doc_MAINTAINERCLEANFILES += \
   AUTHORS \
   $(BUILT_DOC_IMAGES) \
-  $(BUILT_OCTAVE_TEXI_SRC)
+  $(BUILT_OCTAVE_TEXI_SRC) \
+  $(OCTAVE_QTHELP_FILES)
 
 ## The TeX software suite is used to create both PDF and PS output formats.
 ## In order to avoid race conditions between simultaneous TeX commands, the
--- a/doc/interpreter/system.txi	Mon Mar 26 16:41:21 2018 -0700
+++ b/doc/interpreter/system.txi	Mon Mar 26 21:17:17 2018 -0700
@@ -124,9 +124,10 @@
 
 @DOCSTRING(is_leap_year)
 
-@anchor{XREFtoc}
 @DOCSTRING(tic)
 
+@DOCSTRING(toc)
+
 @DOCSTRING(pause)
 
 @DOCSTRING(datenum)
--- a/libinterp/corefcn/data.cc	Mon Mar 26 16:41:21 2018 -0700
+++ b/libinterp/corefcn/data.cc	Mon Mar 26 21:17:17 2018 -0700
@@ -6205,45 +6205,51 @@
        doc: /* -*- texinfo -*-
 @deftypefn  {} {} tic ()
 @deftypefnx {} {@var{id} =} tic ()
-@deftypefnx {} {} toc ()
-@deftypefnx {} {} toc (@var{id})
-@deftypefnx {} {@var{val} =} toc (@dots{})
-Set or check a wall-clock timer.
-
-Calling @code{tic} without an output argument sets the internal timer state.
-Subsequent calls to @code{toc} return the number of seconds since the timer
-was set.
-For example,
+Initialize a wall-clock timer.
+
+Calling @code{tic} without an output argument resets the internal timer.
+Subsequent calls to @code{toc} return the number of seconds since the timer was
+set.
+
+If called with one output argument, @code{tic} creates a new timer instance and
+returns a timer identifier @var{id}.  The @var{id} is a scalar of type
+@code{uint64} that may be passed to @code{toc} to check elapsed time on this
+timer, rather than the default internal timer.
+
+Example 1 : benchmarking code with internal timer
 
 @example
 @group
-tic ();
+tic;
 # many computations later@dots{}
-elapsed_time = toc ();
+elapsed_time = toc;
+@end group
+@end example
+
+Example 2 : mixed timer id and internal timer
+
+@example
+@group
+tic;
+pause (1);
+toc
+@result{} Elapsed time is 1.0089 seconds.
+id = tic;
+pause (2);
+toc (id)
+@result{} Elapsed time is 2.01142 seconds.
+toc
+Elapsed time is 3.02308 seconds.
 @end group
 @end example
 
 @noindent
-will set the variable @code{elapsed_time} to the number of seconds since
-the most recent call to the function @code{tic}.
-
-If called with one output argument, @code{tic} returns a scalar
-of type @code{uint64} that may be later passed to @code{toc}.
-
-@example
-@group
-id = tic; pause (5); toc (id)
-      @result{} 5.0010
-@end group
-@end example
-
-Calling @code{tic} and @code{toc} this way allows nested timing calls.
-
-If you are more interested in the CPU time that your process used, you
-should use the @code{cputime} function instead.  The @code{tic} and
-@code{toc} functions report the actual wall clock time that elapsed
-between the calls.  This may include time spent processing other jobs or
-doing nothing at all.
+Calling @code{tic} and @code{toc} in this way allows nested timing calls.
+
+If you are more interested in the CPU time that your process used, you should
+use the @code{cputime} function instead.  The @code{tic} and @code{toc}
+functions report the actual wall clock time that elapsed between the calls.
+This may include time spent processing other jobs or doing nothing at all.
 @seealso{toc, cputime}
 @end deftypefn */)
 {
@@ -6272,7 +6278,17 @@
        doc: /* -*- texinfo -*-
 @deftypefn  {} {} toc ()
 @deftypefnx {} {} toc (@var{id})
-@deftypefnx {} {@var{val} =} toc (@dots{})
+@deftypefnx {} {@var{elapsed_time} =} toc (@dots{})
+Measure elapsed time on a wall-clock timer.
+
+With no arguments, return the number of seconds elapsed on the internal timer
+since the last call to @code{tic}.
+
+When given the identifier @var{id} of a specific timer, return the number of
+seconds elapsed since the timer @var{id} was initialized.
+
+@xref{XREFtic, , tic}, for examples of the use of @code{tic}/@code{toc}. 
+
 @seealso{tic, cputime}
 @end deftypefn */)
 {
--- a/libinterp/corefcn/tril.cc	Mon Mar 26 16:41:21 2018 -0700
+++ b/libinterp/corefcn/tril.cc	Mon Mar 26 21:17:17 2018 -0700
@@ -329,30 +329,21 @@
 
 DEFUN (tril, args, ,
        doc: /* -*- texinfo -*-
-@deftypefn  {} {} tril (@var{A})
-@deftypefnx {} {} tril (@var{A}, @var{k})
-@deftypefnx {} {} tril (@var{A}, @var{k}, @var{pack})
-@deftypefnx {} {} triu (@var{A})
-@deftypefnx {} {} triu (@var{A}, @var{k})
-@deftypefnx {} {} triu (@var{A}, @var{k}, @var{pack})
-Return a new matrix formed by extracting the lower (@code{tril})
-or upper (@code{triu}) triangular part of the matrix @var{A}, and
-setting all other elements to zero.
+@deftypefn  {} {@var{A_LO} =} tril (@var{A})
+@deftypefnx {} {@var{A_LO} =} tril (@var{A}, @var{k})
+@deftypefnx {} {@var{A_LO} =} tril (@var{A}, @var{k}, @var{pack})
+Return a new matrix formed by extracting the lower triangular part of the
+matrix @var{A}, and setting all other elements to zero.
 
-The second argument is optional, and specifies how many diagonals above or
-below the main diagonal should also be set to zero.
-
-The default value of @var{k} is zero, so that @code{triu} and @code{tril}
-normally include the main diagonal as part of the result.
+The optional second argument specifies how many diagonals above or below the
+main diagonal should also be set to zero.  The default value of @var{k} is
+zero which includes the main diagonal as part of the result.  If the value of
+@var{k} is a nonzero integer then the selection of elements starts at an offset
+of @var{k} diagonals above the main diagonal for positive @var{k} or below the
+main diagonal for negative @var{k}.  The absolute value of @var{k} may not be
+greater than the number of subdiagonals or superdiagonals.
 
-If the value of @var{k} is nonzero integer, the selection of elements starts
-at an offset of @var{k} diagonals above or below the main diagonal; above
-for positive @var{k} and below for negative @var{k}.
-
-The absolute value of @var{k} must not be greater than the number of
-subdiagonals or superdiagonals.
-
-For example:
+Example 1 : exclude main diagonal
 
 @example
 @group
@@ -364,7 +355,8 @@
 @end example
 
 @noindent
-and
+
+Example 2 : include first superdiagonal
 
 @example
 @group
@@ -375,10 +367,10 @@
 @end group
 @end example
 
-If the option @qcode{"pack"} is given as third argument, the extracted
-elements are not inserted into a matrix, but rather stacked column-wise one
-above other.
-@seealso{diag}
+If the optional third argument @qcode{"pack"} is given then the extracted
+elements are not inserted into a matrix, but instead stacked column-wise one
+above another, and returned as a column vector.
+@seealso{triu, istril, diag}
 @end deftypefn */)
 {
   return do_trilu ("tril", args);
@@ -386,11 +378,48 @@
 
 DEFUN (triu, args, ,
        doc: /* -*- texinfo -*-
-@deftypefn  {} {} triu (@var{A})
-@deftypefnx {} {} triu (@var{A}, @var{k})
-@deftypefnx {} {} triu (@var{A}, @var{k}, @var{pack})
-See the documentation for the @code{tril} function (@pxref{tril}).
-@seealso{tril}
+@deftypefn  {} {@var{A_UP} =} triu (@var{A})
+@deftypefnx {} {@var{A_UP} =} triu (@var{A}, @var{k})
+@deftypefnx {} {@var{A_UP} =} triu (@var{A}, @var{k}, @var{pack})
+Return a new matrix formed by extracting the upper triangular part of the
+matrix @var{A}, and setting all other elements to zero.
+
+The optional second argument specifies how many diagonals above or below the
+main diagonal should also be set to zero.  The default value of @var{k} is
+zero which includes the main diagonal as part of the result.  If the value of
+@var{k} is a nonzero integer then the selection of elements starts at an offset
+of @var{k} diagonals above the main diagonal for positive @var{k} or below the
+main diagonal for negative @var{k}.  The absolute value of @var{k} may not be
+greater than the number of subdiagonals or superdiagonals.
+
+Example 1 : exclude main diagonal
+
+@example
+@group
+triu (ones (3), 1)
+     @result{}  0  1  1
+         0  0  1
+         0  0  0
+@end group
+@end example
+
+@noindent
+
+Example 2 : include first subdiagonal
+
+@example
+@group
+triu (ones (3), -1)
+     @result{}  1  1  1
+         1  1  1
+         0  1  1
+@end group
+@end example
+
+If the optional third argument @qcode{"pack"} is given then the extracted
+elements are not inserted into a matrix, but instead stacked column-wise one
+above another, and returned as a column vector.
+@seealso{tril, istriu, diag}
 @end deftypefn */)
 {
   return do_trilu ("triu", args);
--- a/scripts/specfun/betainc.m	Mon Mar 26 16:41:21 2018 -0700
+++ b/scripts/specfun/betainc.m	Mon Mar 26 21:17:17 2018 -0700
@@ -212,6 +212,10 @@
 %! assert (betainc (0, a, b), zeros (20));
 %! assert (betainc (1, a, b), ones (20));
 
+%!test <34405>
+%! assert (betainc (NaN, 1, 2), NaN);
+%! assert (betainc (0.5, 1, Inf), NaN);
+
 ## Test input validation
 %!error betainc ()
 %!error betainc (1)
--- a/scripts/specfun/expint.m	Mon Mar 26 16:41:21 2018 -0700
+++ b/scripts/specfun/expint.m	Mon Mar 26 21:17:17 2018 -0700
@@ -238,6 +238,15 @@
 %! y = expint (x);
 %! assert (y, y_exp, 5*eps);
 
+%!test <53351>
+%! assert (expint (32.5 + 1i),
+%!         1.181108930758065e-16 - 1.966348533426658e-16i, -4*eps);
+%! assert (expint (44 + 1i),
+%!         9.018757389858152e-22 - 1.475771020004195e-21i, -4*eps);
+
+%!test <47738>
+%! assert (expint (10i), 0.0454564330044554 + 0.0875512674239774i, -4*eps);
+
 ## Test preservation or conversion of the class
 %!assert (class (expint (single (1))), "single")
 %!assert (class (expint (int8 (1))), "double")