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	Mon Jul 19 13:35:42 2010 +0200
+++ b/doc/ChangeLog	Mon Jul 19 11:10:11 2010 -0700
@@ -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	Mon Jul 19 13:35:42 2010 +0200
+++ b/doc/interpreter/matrix.txi	Mon Jul 19 11:10:11 2010 -0700
@@ -175,6 +175,8 @@
 
 @DOCSTRING(repmat)
 
+@DOCSTRING(repelems)
+
 @DOCSTRING(rand)
 
 @DOCSTRING(randn)
--- a/scripts/ChangeLog	Mon Jul 19 13:35:42 2010 +0200
+++ b/scripts/ChangeLog	Mon Jul 19 11:10:11 2010 -0700
@@ -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	Mon Jul 19 13:35:42 2010 +0200
+++ b/scripts/general/repmat.m	Mon Jul 19 11:10:11 2010 -0700
@@ -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	Mon Jul 19 13:35:42 2010 +0200
+++ b/src/ChangeLog	Mon Jul 19 11:10:11 2010 -0700
@@ -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	Mon Jul 19 13:35:42 2010 +0200
+++ b/src/data.cc	Mon Jul 19 11:10:11 2010 -0700
@@ -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;