changeset 7653:d9eb2aec6d84

Add the planerot function
author David Bateman <dbateman@free.fr>
date Thu, 27 Mar 2008 13:18:58 -0400
parents b5731e43283a
children 48edf48cd4dc
files scripts/ChangeLog scripts/linear-algebra/Makefile.in scripts/linear-algebra/planerot.m
diffstat 3 files changed, 44 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Wed Mar 26 23:01:16 2008 -0400
+++ b/scripts/ChangeLog	Thu Mar 27 13:18:58 2008 -0400
@@ -1,3 +1,7 @@
+2008-03-27  David Bateman  <dbateman@free.fr>
+
+	* linear-algebra/planerot.m: Givens rotation function.
+
 2008-03-26  John W. Eaton  <jwe@octave.org>
 
 	* set/ismember.m: Set size of idx output correctly for empty args.
--- a/scripts/linear-algebra/Makefile.in	Wed Mar 26 23:01:16 2008 -0400
+++ b/scripts/linear-algebra/Makefile.in	Thu Mar 27 13:18:58 2008 -0400
@@ -35,8 +35,8 @@
 
 SOURCES = __norm__.m commutation_matrix.m cond.m condest.m cross.m \
   dmult.m dot.m duplication_matrix.m housh.m krylov.m krylovb.m logm.m \
-  null.m onenormest.m orth.m qzhess.m rank.m rref.m subspace.m trace.m \
-  vec.m vech.m
+  null.m onenormest.m orth.m planerot.m qzhess.m rank.m rref.m subspace.m \
+  trace.m vec.m vech.m
 
 DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/linear-algebra/planerot.m	Thu Mar 27 13:18:58 2008 -0400
@@ -0,0 +1,38 @@
+## Copyright (C) 2008  David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{g}, @var{y}] =} planerot (@var{x})
+## Given a two-element column vector, returns the
+## @iftex
+## @tex
+## $2\\times 2$ orthogonal matrix
+## @end tex
+## @end iftex
+## @ifnottex
+## 2 by 2 orthogonal matrix
+## @end ifnottex
+## @var{G} such that
+## @code{@var{y} = @var{g} * @var{x}} and @code{@var{y}(2) = 0}.
+## @seealso{givens}
+## @end deftypefn
+
+function [G, y] = planerot (x)
+  G = givens (x(1), x(2));
+  y = G * x(:);
+endfunction