Mercurial > hg > octave-nkf
changeset 20802:5fc798a9b32c
maint: Periodic merge of stable to default.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 09 Oct 2015 19:28:05 -0700 |
parents | 7c0e10f035bd (current diff) 45759620a9a5 (diff) |
children | 56333f6df823 |
files | doc/interpreter/contributors.in libinterp/corefcn/data.cc scripts/io/textread.m scripts/plot/util/__gnuplot_drawnow__.m |
diffstat | 8 files changed, 56 insertions(+), 35 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/interpreter/contributors.in +++ b/doc/interpreter/contributors.in @@ -23,6 +23,7 @@ Roman Belov Markus Bergholz Karl Berry +Ethan Biery David Billinghurst Don Bindner Jakub Bogusz
--- a/doc/interpreter/stmt.txi +++ b/doc/interpreter/stmt.txi @@ -541,7 +541,7 @@ @group fib = ones (1, 10); for i = 3:10 - fib (i) = fib (i-1) + fib (i-2); + fib(i) = fib(i-1) + fib(i-2); endfor @end group @end example
--- a/libinterp/corefcn/data.cc +++ b/libinterp/corefcn/data.cc @@ -487,14 +487,14 @@ ${1 \\over 2} \\le \\left| f \\right| < 1$\n\ @end tex\n\ @ifnottex\n\ -@code{1/2 <= abs(f) < 1}\n\ +@w{@code{1/2 <= abs(f) < 1}}\n\ @end ifnottex\n\ and @var{e} is an integer. If\n\ @tex\n\ $x = 0$, $f = e = 0$.\n\ @end tex\n\ @ifnottex\n\ -@code{x = 0}, @code{f = e = 0}.\n\ +@w{@code{x = 0}}, @w{@code{f = e = 0}}.\n\ @end ifnottex\n\ @seealso{pow2, log, log10, exp}\n\ @end deftypefn") @@ -2593,9 +2593,8 @@ Return the generalized transpose for an N-D array object @var{A}.\n\ \n\ The permutation vector @var{perm} must contain the elements\n\ -@code{1:ndims (A)} (in any order, but each element must appear only once).\n\ -\n\ -The @var{N}th dimension of @var{A} gets remapped to dimension\n\ +@w{@code{1:ndims (A)}} (in any order, but each element must appear only\n\ +once). The @var{N}th dimension of @var{A} gets remapped to dimension\n\ @code{@var{PERM}(@var{N})}. For example:\n\ \n\ @example\n\ @@ -2702,7 +2701,7 @@ @var{a}(@var{idx1}, @var{idx2}, @dots{})\n\ @end example\n\ \n\ -Note that the indices do not have to be numerical. For example,\n\ +Note that the indices do not have to be scalar numbers. For example,\n\ \n\ @example\n\ @group\n\ @@ -2714,6 +2713,18 @@ \n\ @noindent\n\ will return 6, as this is the number of ways to index with @var{b}.\n\ +Or the index could be the string @qcode{\":\"} which represents the colon\n\ +operator. For example,\n\ +\n\ +@example\n\ +@group\n\ +@var{a} = ones (5, 3);\n\ +numel (@var{a}, 2, \":\")\n\ +@end group\n\ +@end example\n\ +\n\ +@noindent\n\ +will return 3 as the second row has three column entries.\n\ \n\ This method is also called when an object appears as lvalue with cs-list\n\ indexing, i.e., @code{object@{@dots{}@}} or @code{object(@dots{}).field}.\n\ @@ -3298,11 +3309,13 @@ @deftypefnx {Built-in Function} {} complex (@var{re}, @var{im})\n\ Return a complex value from real arguments.\n\ \n\ -With 1 real argument @var{x}, return the complex result @code{@var{x} + 0i}.\n\ -\n\ -With 2 real arguments, return the complex result @code{@var{re} + @var{im}}.\n\ +With 1 real argument @var{x}, return the complex result\n\ +@w{@code{@var{x} + 0i}}.\n\ +\n\ +With 2 real arguments, return the complex result\n\ +@w{@code{@var{re} + @var{im}}}.\n\ @code{complex} can often be more convenient than expressions such as\n\ -@code{a + i*b}.\n\ +@w{@code{a + i*b}}.\n\ For example:\n\ \n\ @example\n\ @@ -4820,7 +4833,7 @@ $\\sqrt{-1}$.\n\ @end tex\n\ @ifnottex\n\ -@code{sqrt (-1)}.\n\ +@w{@code{sqrt (-1)}}.\n\ @end ifnottex\n\ \n\ I, and its equivalents i, j, and J, are functions so any of the names may\n\ @@ -5673,7 +5686,7 @@ @deftypefnx {Built-in Function} {} norm (@var{A}, @var{p}, @var{opt})\n\ Compute the p-norm of the matrix @var{A}.\n\ \n\ -If the second argument is missing, @code{p = 2} is assumed.\n\ +If the second argument is missing, @w{@code{p = 2}} is assumed.\n\ \n\ If @var{A} is a matrix (or sparse matrix):\n\ \n\ @@ -6574,8 +6587,9 @@ For equal elements, the indices are such that equal elements are listed\n\ in the order in which they appeared in the original list.\n\ \n\ -Sorting of complex entries is done first by magnitude (@code{abs (@var{z})})\n\ -and for any ties by phase angle (@code{angle (z)}). For example:\n\ +Sorting of complex entries is done first by magnitude\n\ +(@w{@code{abs (@var{z})}}) and for any ties by phase angle\n\ +(@w{@code{angle (z)}}). For example:\n\ \n\ @example\n\ @group\n\ @@ -7720,7 +7734,7 @@ @deftypefn {Built-in Function} {} diff (@var{x})\n\ @deftypefnx {Built-in Function} {} diff (@var{x}, @var{k})\n\ @deftypefnx {Built-in Function} {} diff (@var{x}, @var{k}, @var{dim})\n\ -If @var{x} is a vector of length @math{n}, @code{diff (@var{x})} is the\n\ +If @var{x} is a vector of length @math{n}, @w{@code{diff (@var{x})}} is the\n\ vector of first differences\n\ @tex\n\ $x_2 - x_1, \\ldots{}, x_n - x_{n-1}$.\n\ @@ -7729,20 +7743,20 @@ @var{x}(2) - @var{x}(1), @dots{}, @var{x}(n) - @var{x}(n-1).\n\ @end ifnottex\n\ \n\ -If @var{x} is a matrix, @code{diff (@var{x})} is the matrix of column\n\ +If @var{x} is a matrix, @w{@code{diff (@var{x})}} is the matrix of column\n\ differences along the first non-singleton dimension.\n\ \n\ -The second argument is optional. If supplied, @code{diff (@var{x},\n\ -@var{k})}, where @var{k} is a non-negative integer, returns the\n\ -@var{k}-th differences. It is possible that @var{k} is larger than\n\ -the first non-singleton dimension of the matrix. In this case,\n\ +The second argument is optional. If supplied,\n\ +@w{@code{diff (@var{x}, @var{k})}}, where @var{k} is a non-negative integer,\n\ +returns the @var{k}-th differences. It is possible that @var{k} is larger\n\ +than the first non-singleton dimension of the matrix. In this case,\n\ @code{diff} continues to take the differences along the next\n\ non-singleton dimension.\n\ \n\ The dimension along which to take the difference can be explicitly\n\ stated with the optional variable @var{dim}. In this case the\n\ @var{k}-th order differences are calculated along this dimension.\n\ -In the case where @var{k} exceeds @code{size (@var{x}, @var{dim})}\n\ +In the case where @var{k} exceeds @w{@code{size (@var{x}, @var{dim})}}\n\ an empty matrix is returned.\n\ @seealso{sort, merge}\n\ @end deftypefn")
--- a/scripts/general/methods.m +++ b/scripts/general/methods.m @@ -47,10 +47,14 @@ mtds_list = ostrsplit (mtds_str, ';'); endif elseif (isjava (obj)) - ## FIXME: Function prototype that excepts java obj exists, but doesn't - ## work if obj is java.lang.String. Convert obj to classname. - obj = class (obj); - mtds_str = javaMethod ("getMethods", "org.octave.ClassHelper", obj); + ## FIXME: Function prototype accepts java obj, but doesn't work if obj + ## is e.g., java.lang.String. Convert obj to classname then. + try + mtds_str = javaMethod ("getMethods", "org.octave.ClassHelper", obj); + catch + obj = class (obj); + mtds_str = javaMethod ("getMethods", "org.octave.ClassHelper", obj); + end_try_catch mtds_list = strsplit (mtds_str, ';'); else error ("methods: Invalid input argument");
--- a/scripts/io/textread.m +++ b/scripts/io/textread.m @@ -143,10 +143,10 @@ ## Beware of zero valued headerline, fskipl would skip to EOF if (varargin{headerlines + 1} > 0) fskipl (fid, varargin{headerlines + 1}); - varargin(headerlines:headerlines+1) = []; elseif (varargin{headerlines + 1} < 0) warning ("textread: negative headerline value ignored"); endif + varargin(headerlines:headerlines+1) = []; endif st_pos = ftell (fid);
--- a/scripts/io/textscan.m +++ b/scripts/io/textscan.m @@ -202,11 +202,11 @@ if (args{headerlines + 1} > 0) ## Beware of zero valued headerline, fskipl would skip to EOF fskipl (fid, args{headerlines + 1}); - args(headerlines:headerlines+1) = []; st_pos = ftell (fid); elseif (args{headerlines + 1} < 0) warning ("textscan.m: negative headerline value ignored"); endif + args(headerlines:headerlines+1) = []; endif ## Read a first file chunk. Rest follows after endofline processing [str, count] = fscanf (fid, "%c", BUFLENGTH);
--- a/scripts/plot/util/__gnuplot_drawnow__.m +++ b/scripts/plot/util/__gnuplot_drawnow__.m @@ -185,8 +185,8 @@ || any (strcmp (term, {"canvas", "emf", "gif", "jpeg", ... "pbm", "png", "pngcairo", "svg"})))) ## Convert to inches - gnuplot_pos /= 72; - gnuplot_size /= 72; + gnuplot_pos = gnuplot_pos / get (0, "screenpixelsperinch"); + gnuplot_size = gnuplot_size / get (0, "screenpixelsperinch"); endif if (all (gnuplot_size > 0)) terminals_with_size = {"canvas", "emf", "epslatex", "fig", ...
--- a/scripts/statistics/base/quantile.m +++ b/scripts/statistics/base/quantile.m @@ -113,8 +113,8 @@ print_usage (); endif - if (! (isnumeric (x) || islogical (x))) - error ("quantile: X must be a numeric vector or matrix"); + if (! (isnumeric (x) || islogical (x)) || isempty (x)) + error ("quantile: X must be a non-empty numeric vector or matrix"); endif if (isempty (p)) @@ -321,6 +321,9 @@ %! yexp = median (x, dim); %! assert (yobs, yexp); +## Bug #45455 +%!assert (quantile ([1 3 2], 0.5, 1), [1 3 2]) + ## Test input validation %!error quantile () %!error quantile (1, 2, 3, 4, 5) @@ -358,8 +361,7 @@ p = p(:); ## Save length and set shape of samples. - ## FIXME: does sort guarantee that NaN's come at the end? - x = sort (x); + x = sort (x, 1); m = sum (! isnan (x)); [xr, xc] = size (x); @@ -431,7 +433,7 @@ endswitch ## Duplicate single values. - imm1 = (mm == 1); + imm1 = (mm(1,:) == 1); x(2,imm1) = x(1,imm1); ## Interval indices.