Mercurial > hg > octave-thorsten
changeset 10801:a40e32927b3a
Improve documentation for new repelems function.
Add additional text to repelems documentation.
Place documentation in matrix chapter.
Add seealso link from repmat to repelems.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Mon, 19 Jul 2010 11:10:11 -0700 |
parents | 23b3ae008f5e |
children | c7475803e0c0 |
files | doc/ChangeLog doc/interpreter/matrix.txi scripts/ChangeLog scripts/general/repmat.m src/ChangeLog src/data.cc |
diffstat | 6 files changed, 31 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2010-07-19 Rik <octave@nomad.inbox5.com> + + * interpreter/matrix.txi: Add new function repelems to matrix chapter. + 2010-07-18 Rik <octave@nomad.inbox5.com> * interpreter/doccheck/spellcheck,
--- a/doc/interpreter/matrix.txi +++ b/doc/interpreter/matrix.txi @@ -175,6 +175,8 @@ @DOCSTRING(repmat) +@DOCSTRING(repelems) + @DOCSTRING(rand) @DOCSTRING(randn)
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2010-07-19 Rik <octave@nomad.inbox5.com> + + * general/repmat.m: Add seealso to new repelems function + 2010-07-19 Jaroslav Hajek <highegg@gmail.com> * specfun/nchoosek.m: Optimize.
--- a/scripts/general/repmat.m +++ b/scripts/general/repmat.m @@ -24,6 +24,7 @@ ## Form a block matrix of size @var{m} by @var{n}, with a copy of matrix ## @var{A} as each element. If @var{n} is not specified, form an ## @var{m} by @var{m} block matrix. +## @seealso{repelems} ## @end deftypefn ## Author: Paul Kienzle <pkienzle@kienzle.powernet.co.uk>
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-07-17 Rik <octave@nomad.inbox5.com> + + * data.cc (repelems): Add more documentation about new function. + 2010-07-19 Jaroslav Hajek <highegg@gmail.com> * data.cc (do_repelems): New helper func.
--- a/src/data.cc +++ b/src/data.cc @@ -6530,16 +6530,25 @@ DEFUN (repelems, args, , "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} repelems (@var{x}, @var{r})\n\ -Constructs a vector of repeated elements of @var{x}. @var{r}\n\ -should be a 2-by-n integer matrix.\n\ -The result is a row vector constructed as follows:\n\ +Construct a vector of repeated elements from @var{x}. @var{r}\n\ +is a 2x@var{N} integer matrix specifying which elements to repeat and\n\ +how often to repeat each element.\n\ +\n\ +Entries in the first row, @var{r}(1,j), select an element to repeat.\n\ +The corresponding entry in the second row, @var{r}(2,j), specifies\n\ +the repeat count. If @var{x} is a matrix then the columns of @var{x} are\n\ +imagined to be stacked on top of each other for purposes of the selection\n\ +index. A row vector is always returned.\n\ +\n\ +Conceptually the result is calculated as follows:\n\ \n\ @example\n\ - y = [];\n\ - for i = 1:columns (n)\n\ - y = [y, x(n(1,i)*ones(1, n(2,i)))];\n\ - endfor\n\ +y = [];\n\ +for i = 1:columns (@var{r})\n\ + y = [y, @var{x}(@var{r}(1,i)*ones(1, @var{r}(2,i)))];\n\ +endfor\n\ @end example\n\ +@seealso{repmat}\n\ @end deftypefn") { octave_value retval;