Mercurial > hg > octave-nkf
comparison src/data.cc @ 9723:f426899f4b9c
fix reduction functions docstrings
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 13 Oct 2009 12:50:06 +0200 |
parents | 192d94cff6c1 |
children | aea3a3a950e1 |
comparison
equal
deleted
inserted
replaced
9722:97d683d8b9ff | 9723:f426899f4b9c |
---|---|
1546 DEFUN (cumprod, args, , | 1546 DEFUN (cumprod, args, , |
1547 "-*- texinfo -*-\n\ | 1547 "-*- texinfo -*-\n\ |
1548 @deftypefn {Built-in Function} {} cumprod (@var{x})\n\ | 1548 @deftypefn {Built-in Function} {} cumprod (@var{x})\n\ |
1549 @deftypefnx {Built-in Function} {} cumprod (@var{x}, @var{dim})\n\ | 1549 @deftypefnx {Built-in Function} {} cumprod (@var{x}, @var{dim})\n\ |
1550 Cumulative product of elements along dimension @var{dim}. If\n\ | 1550 Cumulative product of elements along dimension @var{dim}. If\n\ |
1551 @var{dim} is omitted, it defaults to 1 (column-wise cumulative\n\ | 1551 @var{dim} is omitted, it defaults to the first non-singleton dimension.\n\ |
1552 products).\n\ | 1552 \n\ |
1553 \n\ | |
1554 As a special case, if @var{x} is a vector and @var{dim} is omitted,\n\ | |
1555 return the cumulative product of the elements as a vector with the\n\ | |
1556 same orientation as @var{x}.\n\ | |
1557 @seealso{prod, cumsum}\n\ | 1553 @seealso{prod, cumsum}\n\ |
1558 @end deftypefn") | 1554 @end deftypefn") |
1559 { | 1555 { |
1560 DATA_REDUCTION (cumprod); | 1556 DATA_REDUCTION (cumprod); |
1561 } | 1557 } |
1586 "-*- texinfo -*-\n\ | 1582 "-*- texinfo -*-\n\ |
1587 @deftypefn {Built-in Function} {} cumsum (@var{x})\n\ | 1583 @deftypefn {Built-in Function} {} cumsum (@var{x})\n\ |
1588 @deftypefnx {Built-in Function} {} cumsum (@var{x}, @var{dim})\n\ | 1584 @deftypefnx {Built-in Function} {} cumsum (@var{x}, @var{dim})\n\ |
1589 @deftypefnx {Built-in Function} {} cumsum (@dots{}, 'native')\n\ | 1585 @deftypefnx {Built-in Function} {} cumsum (@dots{}, 'native')\n\ |
1590 Cumulative sum of elements along dimension @var{dim}. If @var{dim}\n\ | 1586 Cumulative sum of elements along dimension @var{dim}. If @var{dim}\n\ |
1591 is omitted, it defaults to 1 (column-wise cumulative sums).\n\ | 1587 is omitted, it defaults to the first non-singleton dimension.\n\ |
1592 \n\ | |
1593 As a special case, if @var{x} is a vector and @var{dim} is omitted,\n\ | |
1594 return the cumulative sum of the elements as a vector with the\n\ | |
1595 same orientation as @var{x}.\n\ | |
1596 \n\ | 1588 \n\ |
1597 The \"native\" argument implies the summation is performed in native type.\n\ | 1589 The \"native\" argument implies the summation is performed in native type.\n\ |
1598 See @code{sum} for a complete description and example of the use of\n\ | 1590 See @code{sum} for a complete description and example of the use of\n\ |
1599 \"native\".\n\ | 1591 \"native\".\n\ |
1600 @seealso{sum, cumprod}\n\ | 1592 @seealso{sum, cumprod}\n\ |
1834 DEFUN (prod, args, , | 1826 DEFUN (prod, args, , |
1835 "-*- texinfo -*-\n\ | 1827 "-*- texinfo -*-\n\ |
1836 @deftypefn {Built-in Function} {} prod (@var{x})\n\ | 1828 @deftypefn {Built-in Function} {} prod (@var{x})\n\ |
1837 @deftypefnx {Built-in Function} {} prod (@var{x}, @var{dim})\n\ | 1829 @deftypefnx {Built-in Function} {} prod (@var{x}, @var{dim})\n\ |
1838 Product of elements along dimension @var{dim}. If @var{dim} is\n\ | 1830 Product of elements along dimension @var{dim}. If @var{dim} is\n\ |
1839 omitted, it defaults to 1 (column-wise products).\n\ | 1831 omitted, it defaults to the first non-singleton dimension.\n\ |
1840 \n\ | |
1841 As a special case, if @var{x} is a vector and @var{dim} is omitted,\n\ | |
1842 return the product of the elements.\n\ | |
1843 @seealso{cumprod, sum}\n\ | 1832 @seealso{cumprod, sum}\n\ |
1844 @end deftypefn") | 1833 @end deftypefn") |
1845 { | 1834 { |
1846 DATA_REDUCTION (prod); | 1835 DATA_REDUCTION (prod); |
1847 } | 1836 } |
2665 @deftypefnx {Built-in Function} {} sum (@var{x}, @var{dim})\n\ | 2654 @deftypefnx {Built-in Function} {} sum (@var{x}, @var{dim})\n\ |
2666 @deftypefnx {Built-in Function} {} sum (@dots{}, 'native')\n\ | 2655 @deftypefnx {Built-in Function} {} sum (@dots{}, 'native')\n\ |
2667 @deftypefnx {Built-in Function} {} sum (@dots{}, 'double')\n\ | 2656 @deftypefnx {Built-in Function} {} sum (@dots{}, 'double')\n\ |
2668 @deftypefnx {Built-in Function} {} sum (@dots{}, 'extra')\n\ | 2657 @deftypefnx {Built-in Function} {} sum (@dots{}, 'extra')\n\ |
2669 Sum of elements along dimension @var{dim}. If @var{dim} is\n\ | 2658 Sum of elements along dimension @var{dim}. If @var{dim} is\n\ |
2670 omitted, it defaults to 1 (column-wise sum).\n\ | 2659 omitted, it defaults to the first non-singleton dimension.\n\ |
2671 \n\ | |
2672 As a special case, if @var{x} is a vector and @var{dim} is omitted,\n\ | |
2673 return the sum of the elements.\n\ | |
2674 \n\ | 2660 \n\ |
2675 If the optional argument 'native' is given, then the sum is performed\n\ | 2661 If the optional argument 'native' is given, then the sum is performed\n\ |
2676 in the same type as the original argument, rather than in the default\n\ | 2662 in the same type as the original argument, rather than in the default\n\ |
2677 double type. For example\n\ | 2663 double type. For example\n\ |
2678 \n\ | 2664 \n\ |
2682 @result{} 2\n\ | 2668 @result{} 2\n\ |
2683 sum ([true, true], 'native')\n\ | 2669 sum ([true, true], 'native')\n\ |
2684 @result{} true\n\ | 2670 @result{} true\n\ |
2685 @end group\n\ | 2671 @end group\n\ |
2686 @end example\n\ | 2672 @end example\n\ |
2673 \n\ | |
2687 On the contrary, if 'double' is given, the sum is performed in double precision\n\ | 2674 On the contrary, if 'double' is given, the sum is performed in double precision\n\ |
2688 even for single precision inputs.\n\ | 2675 even for single precision inputs.\n\ |
2676 \n\ | |
2689 For double precision inputs, 'extra' indicates that a more accurate algorithm\n\ | 2677 For double precision inputs, 'extra' indicates that a more accurate algorithm\n\ |
2690 than straightforward summation is to be used. For single precision inputs, 'extra' is\n\ | 2678 than straightforward summation is to be used. For single precision inputs, 'extra' is\n\ |
2691 the same as 'double'. Otherwise, 'extra' has no effect.\n\ | 2679 the same as 'double'. Otherwise, 'extra' has no effect.\n\ |
2692 @seealso{cumsum, sumsq, prod}\n\ | 2680 @seealso{cumsum, sumsq, prod}\n\ |
2693 @end deftypefn") | 2681 @end deftypefn") |
2880 DEFUN (sumsq, args, , | 2868 DEFUN (sumsq, args, , |
2881 "-*- texinfo -*-\n\ | 2869 "-*- texinfo -*-\n\ |
2882 @deftypefn {Built-in Function} {} sumsq (@var{x})\n\ | 2870 @deftypefn {Built-in Function} {} sumsq (@var{x})\n\ |
2883 @deftypefnx {Built-in Function} {} sumsq (@var{x}, @var{dim})\n\ | 2871 @deftypefnx {Built-in Function} {} sumsq (@var{x}, @var{dim})\n\ |
2884 Sum of squares of elements along dimension @var{dim}. If @var{dim}\n\ | 2872 Sum of squares of elements along dimension @var{dim}. If @var{dim}\n\ |
2885 is omitted, it defaults to 1 (column-wise sum of squares).\n\ | 2873 is omitted, it defaults to the first non-singleton dimension.\n\ |
2886 \n\ | |
2887 As a special case, if @var{x} is a vector and @var{dim} is omitted,\n\ | |
2888 return the sum of squares of the elements.\n\ | |
2889 \n\ | 2874 \n\ |
2890 This function is conceptually equivalent to computing\n\ | 2875 This function is conceptually equivalent to computing\n\ |
2891 @example\n\ | 2876 @example\n\ |
2892 sum (x .* conj (x), dim)\n\ | 2877 sum (x .* conj (x), dim)\n\ |
2893 @end example\n\ | 2878 @end example\n\ |