# HG changeset patch # User Rik # Date 1241133198 25200 # Node ID 9cb0c21e97f76ee450280c55ea410b1ae687fa33 # Parent ec159e991ee6739cc78c4c1613a3d7e09c26896c Update section 17.4 (Sums and Products) of arith.txi diff -r ec159e991ee6 -r 9cb0c21e97f7 doc/ChangeLog --- a/doc/ChangeLog Thu Apr 30 18:45:42 2009 -0400 +++ b/doc/ChangeLog Thu Apr 30 16:13:18 2009 -0700 @@ -1,3 +1,6 @@ +2009-04-26 Rik + * interpreter/arith.txi: Update section 17.4 (Sums and Products) of arith.txi + 2009-04-29 Jaroslav Hajek * interpreter/numbers.txi: Update info on ranges. @@ -77,7 +80,7 @@ * interpreter/Makefile.in (DISTFILES): Use doc-cache instead of DOC for doc cache file. -2009-03-08 Søren Hauberg +2009-03-08 S�ren Hauberg * interpreter/stats.txi (Basic Statistical Functions): Add the 'histc' function. @@ -183,7 +186,7 @@ * vr-idx.txi: Delete. * interpreter/Makefile.in (SUB_SOURCE): Remove it from the list. -2009-01-22 Søren Hauberg +2009-01-22 S�ren Hauberg * interpreter/func.txi: Put varargin and varargout in concept index. * interpreter/var.txi: Put ans in concept index. @@ -304,12 +307,12 @@ * interpreter/contrib.txi: correction of the mercurial example * interpreter/container.txi: minor correction of the text -2008-09-25 Søren Hauberg +2008-09-25 S�ren Hauberg * interpreter/image.txi: Update for imread and imwrite instead of loadimge and saveimage. -2008-09-24 Søren Hauberg +2008-09-24 S�ren Hauberg * interpreter/image.txi: Document imfinfo. @@ -358,7 +361,7 @@ * interpreter/numbers.txi: Document intwarning. -2008-08-06 Søren Hauberg +2008-08-06 S�ren Hauberg * interpreter/basics.txi, interpreter/errors.txi, interpreter/expr.txi, interpreter/func.txi, @@ -575,7 +578,7 @@ * refcard/refcard.tex: Update for 3.0. -2007-10-15 Søren Hauberg +2007-10-15 S�ren Hauberg * interpreter/preface.txi, interpreter/basics.txi, interpreter/strings.txi, interpreter/container.txi, @@ -607,7 +610,7 @@ 2007-10-06 John W. Eaton - * interpreter/octave.texi: Add David Bateman and Søren Hauberg as + * interpreter/octave.texi: Add David Bateman and S�ren Hauberg as authors. 2006-09-28 Henry Mollet mollet@pacbell.net @@ -639,7 +642,7 @@ * interpreter/geometry.txi: Check whether TEXINFO_QHULL is set before including certain figures. -2007-08-31 Søren Hauberg +2007-08-31 S�ren Hauberg * interpreter/nonlin.txi: Extended the example. @@ -722,7 +725,7 @@ * interpreter/interp.txi: Also change figures here. * interpreter/Makefile.in: and here. -2007-06-18 Søren Hauberg +2007-06-18 S�ren Hauberg * interpreter/optim.txi: Added some introductory text to each section. @@ -769,7 +772,7 @@ and subsections for hashing to system utilities chapter. -2007-06-12 2007-06-10 Søren Hauberg +2007-06-12 2007-06-10 S�ren Hauberg * interpreter/diffeq.txi: Note that x-dot is the derivative of x. @@ -797,7 +800,7 @@ * interpreter/Makefile.in ($(HTML_IMAGES_PNG)): Use cp instead of INSTALL_DATA to copy files to the HTML directory. -2007-05-28 Søren Hauberg +2007-05-28 S�ren Hauberg * interpreter/errors.txi: Add new sections and some more detailed descriptions on errors and warnings. @@ -805,7 +808,7 @@ interpreter/var.txi: Add references to the new sections in errors.txi. -2007-05-28 Søren Hauberg +2007-05-28 S�ren Hauberg * interpreter/io.txi: Rearrange some sections, and add a few examples. @@ -839,7 +842,7 @@ * interpreter/debug.txi, io.txi, octave.txi: Doc fixes. -2007-05-21 Søren Hauberg +2007-05-21 S�ren Hauberg * interpreter/expr.txi: Describe +=, -=, *=, and /= operators. Add new example. @@ -861,7 +864,7 @@ * interpreter/func.txi: Additional documentation for function locking, dispatch and autoloading. -2007-05-16 Søren Hauberg +2007-05-16 S�ren Hauberg * interpreter/expr.txi: Improve docs. @@ -871,7 +874,7 @@ interpreter/intro.txi, interpreter/numbers.txi, interpreter/octave.texi, interpreter/preface.txi: Doc fixes. -2007-04-18 Søren Hauberg +2007-04-18 S�ren Hauberg * interpreter/package.texi: Document "*" flag for loaded packages. @@ -954,7 +957,7 @@ * Makefile.in (SUB_SOURCE): Include dynamic.txi in the list. -2007-04-18 Søren Hauberg +2007-04-18 S�ren Hauberg * interpreter/package.texi: New file. * octave/texi: @include it, add it to the menus. @@ -979,7 +982,7 @@ * interpreter/stream.txi: Delete. * interpreter/Makefile.in (SUB_SOURCE): Remove it from the list. -2007-04-16 Søren Hauberg +2007-04-16 S�ren Hauberg * intrepreter/stmt.txi: Improve documentation of switch statement. @@ -991,15 +994,15 @@ * interpreter/image.txi: Update docs. -2007-04-11 Søren Hauberg +2007-04-11 S�ren Hauberg * interpreter/container.txi: Document indexing with (). -2007-04-11 Søren Hauberg +2007-04-11 S�ren Hauberg * interpreter/container.txi: Improve cell array documentation. -2007-04-09 Søren Hauberg +2007-04-09 S�ren Hauberg * interpreter/func.txi: Document varargin, varargout, and default argument values. diff -r ec159e991ee6 -r 9cb0c21e97f7 scripts/general/accumarray.m --- a/scripts/general/accumarray.m Thu Apr 30 18:45:42 2009 -0400 +++ b/scripts/general/accumarray.m Thu Apr 30 16:13:18 2009 -0700 @@ -18,7 +18,7 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {} accumarray (@var{subs}, @var{vals}, @var{sz}, @var{fun}, @var{fillval}, @var{issparse}) +## @deftypefn {Function File} {} accumarray (@var{subs}, @var{vals}, @var{sz}, @var{func}, @var{fillval}, @var{issparse}) ## @deftypefnx {Function File} {} accumarray (@var{csubs}, @var{vals}, @dots{}) ## ## Create an array by accumulating the elements of a vector into the @@ -31,7 +31,7 @@ ## of @var{sz} must correspond to the number of columns in @var{subs}. ## ## The default action of @code{accumarray} is to sum the elements with the -## same subscripts. This behavior can be modified by defining the @var{fun} +## same subscripts. This behavior can be modified by defining the @var{func} ## function. This should be a function or function handle that accepts a ## column vector and returns a scalar. The result of the function should not ## depend on the order of the subscripts. @@ -54,7 +54,7 @@ ## @end example ## @end deftypefn -function A = accumarray (subs, val, sz, fun, fillval, isspar) +function A = accumarray (subs, val, sz, func, fillval, isspar) if (nargin < 2 || nargin > 6) print_usage (); @@ -77,8 +77,8 @@ error ("accumarray: sparse matrices limited to 2 dimensions"); endif - if (nargin < 4 || isempty (fun)) - fun = @sum; + if (nargin < 4 || isempty (func)) + func = @sum; ## This is the fast summation case. Unlike the general case, ## this case will be handled using an O(N) algorithm. @@ -154,7 +154,7 @@ for i = 1:ndims idx{i} = subs (cidx, i); endfor - x = cellfun (fun, mat2cell (val(:), diff ([cidx; length(val) + 1]))); + x = cellfun (func, mat2cell (val(:), diff ([cidx; length(val) + 1]))); if (isspar && fillval == 0) A = sparse (idx{1}, idx{2}, x, sz(1), sz(2)); else diff -r ec159e991ee6 -r 9cb0c21e97f7 src/data.cc --- a/src/data.cc Thu Apr 30 18:45:42 2009 -0400 +++ b/src/data.cc Thu Apr 30 16:13:18 2009 -0700 @@ -1539,7 +1539,8 @@ DEFUN (cumprod, args, , "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} cumprod (@var{x}, @var{dim})\n\ +@deftypefn {Built-in Function} {} cumprod (@var{x})\n\ +@deftypefnx {Built-in Function} {} cumprod (@var{x}, @var{dim})\n\ Cumulative product of elements along dimension @var{dim}. If\n\ @var{dim} is omitted, it defaults to 1 (column-wise cumulative\n\ products).\n\ @@ -1547,6 +1548,7 @@ As a special case, if @var{x} is a vector and @var{dim} is omitted,\n\ return the cumulative product of the elements as a vector with the\n\ same orientation as @var{x}.\n\ +@seealso{prod, cumsum}\n\ @end deftypefn") { DATA_REDUCTION (cumprod); @@ -1576,7 +1578,8 @@ DEFUN (cumsum, args, , "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} cumsum (@var{x}, @var{dim})\n\ +@deftypefn {Built-in Function} {} cumsum (@var{x})\n\ +@deftypefnx {Built-in Function} {} cumsum (@var{x}, @var{dim})\n\ @deftypefnx {Built-in Function} {} cumsum (@dots{}, 'native')\n\ Cumulative sum of elements along dimension @var{dim}. If @var{dim}\n\ is omitted, it defaults to 1 (column-wise cumulative sums).\n\ @@ -1585,8 +1588,10 @@ return the cumulative sum of the elements as a vector with the\n\ same orientation as @var{x}.\n\ \n\ -The \"native\" argument implies the summation is performed in native type,\n\ -analogously to @code{sum}.\n\ +The \"native\" argument implies the summation is performed in native type.\n\ + See @code{sum} for a complete description and example of the use of\n\ +\"native\".\n\ +@seealso{sum, cumprod}\n\ @end deftypefn") { NATIVE_REDUCTION (cumsum, cumsum); @@ -1711,12 +1716,14 @@ DEFUN (prod, args, , "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} prod (@var{x}, @var{dim})\n\ +@deftypefn {Built-in Function} {} prod (@var{x})\n\ +@deftypefnx {Built-in Function} {} prod (@var{x}, @var{dim})\n\ Product of elements along dimension @var{dim}. If @var{dim} is\n\ omitted, it defaults to 1 (column-wise products).\n\ \n\ As a special case, if @var{x} is a vector and @var{dim} is omitted,\n\ return the product of the elements.\n\ +@seealso{cumprod, sum}\n\ @end deftypefn") { DATA_REDUCTION (prod); @@ -2555,7 +2562,8 @@ DEFUN (sum, args, , "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} sum (@var{x}, @var{dim})\n\ +@deftypefn {Built-in Function} {} sum (@var{x})\n\ +@deftypefnx {Built-in Function} {} sum (@var{x}, @var{dim})\n\ @deftypefnx {Built-in Function} {} sum (@dots{}, 'native')\n\ Sum of elements along dimension @var{dim}. If @var{dim} is\n\ omitted, it defaults to 1 (column-wise sum).\n\ @@ -2575,6 +2583,7 @@ @result{} true\n\ @end group\n\ @end example\n\ +@seealso{cumsum, sumsq, prod}\n\ @end deftypefn") { NATIVE_REDUCTION (sum, any); @@ -2643,7 +2652,8 @@ DEFUN (sumsq, args, , "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} sumsq (@var{x}, @var{dim})\n\ +@deftypefn {Built-in Function} {} sumsq (@var{x})\n\ +@deftypefnx {Built-in Function} {} sumsq (@var{x}, @var{dim})\n\ Sum of squares of elements along dimension @var{dim}. If @var{dim}\n\ is omitted, it defaults to 1 (column-wise sum of squares).\n\ \n\ @@ -2654,7 +2664,8 @@ @example\n\ sum (x .* conj (x), dim)\n\ @end example\n\ -but it uses less memory and avoids calling conj if @var{x} is real.\n\ +but it uses less memory and avoids calling @code{conj} if @var{x} is real.\n\ +@seealso{sum}\n\ @end deftypefn") { DATA_REDUCTION (sumsq);