changeset 24602:e578e68ba1e0

doc: Update documentation for givens() and planerot(). * givens.cc (Fgivens), planerot.m: Update documentation for both Givens rotation functions. Add a note about why Givens rotation is useful. Add a seealso link to qr.
author Rik <rik@octave.org>
date Mon, 15 Jan 2018 08:07:38 -0800
parents 3d66e5dbb5ad
children 845ec6f4fb96
files libinterp/corefcn/givens.cc scripts/linear-algebra/planerot.m
diffstat 2 files changed, 51 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/givens.cc	Mon Jan 15 12:35:55 2018 +0100
+++ b/libinterp/corefcn/givens.cc	Mon Jan 15 08:07:38 2018 -0800
@@ -48,19 +48,28 @@
 with $x$ and $y$ scalars.
 @end tex
 @ifnottex
-The Givens matrix is a 2 by 2 orthogonal matrix
+The Givens matrix is a 2-by-2 orthogonal matrix
 
-@code{@var{g} = [@var{c} @var{s}; -@var{s}' @var{c}]}
+@example
+@group
+@var{G} = [ @var{c} , @var{s}
+     -@var{s}', @var{c}]
+@end group
+@end example
 
+@noindent
 such that
 
-@code{@var{g} [@var{x}; @var{y}] = [*; 0]}
+@example
+@var{G} * [@var{x}; @var{y}] = [*; 0]
+@end example
 
+@noindent
 with @var{x} and @var{y} scalars.
 @end ifnottex
 
-If two output arguments are requested, return the factors @var{c} and
-@var{s} rather than the Givens rotation matrix.
+If two output arguments are requested, return the factors @var{c} and @var{s}
+rather than the Givens rotation matrix.
 
 For example:
 
@@ -71,7 +80,11 @@
        -0.70711   0.70711
 @end group
 @end example
-@seealso{planerot}
+
+Note: The Givens matrix represents a counterclockwise rotation of a 2-D
+plane and can be used to introduce zeros into a matrix prior to complete
+factorization.
+@seealso{planerot, qr}
 @end deftypefn */)
 {
   if (args.length () != 2)
--- a/scripts/linear-algebra/planerot.m	Mon Jan 15 12:35:55 2018 +0100
+++ b/scripts/linear-algebra/planerot.m	Mon Jan 15 08:07:38 2018 -0800
@@ -18,16 +18,42 @@
 
 ## -*- texinfo -*-
 ## @deftypefn {} {[@var{G}, @var{y}] =} planerot (@var{x})
-## Given a two-element column vector, return the
+## Compute the Givens rotation matrix for the two-element column vector
+## @var{x}.
+##
 ## @tex
-## $2 \times 2$ orthogonal matrix
+## The Givens matrix is a $2\times 2$ orthogonal matrix
+## $$
+##  G = \left[\matrix{c & s\cr -s'& c\cr}\right]
+## $$
+## such that
+## $$
+##  G \left[\matrix{x(1)\cr x(2)}\right] = \left[\matrix{\ast\cr 0}\right]
+## $$
 ## @end tex
 ## @ifnottex
-## 2 by 2 orthogonal matrix
+## The Givens matrix is a 2-by-2 orthogonal matrix
+##
+## @example
+## @group
+## @var{G} = [ @var{c} , @var{s}
+##      -@var{s}', @var{c}]
+## @end group
+## @end example
+##
+## @noindent
+## such that
+##
+## @example
+## @var{y} = @var{G} * [@var{x}(1); @var{x}(2)] @equiv{} [*; 0]
+## @end example
+##
 ## @end ifnottex
-## @var{G} such that
-## @code{@var{y} = @var{g} * @var{x}} and @code{@var{y}(2) = 0}.
-## @seealso{givens}
+##
+## Note: The Givens matrix represents a counterclockwise rotation of a 2-D
+## plane and can be used to introduce zeros into a matrix prior to complete
+## factorization.
+## @seealso{givens, qr}
 ## @end deftypefn
 
 function [G, y] = planerot (x)