octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Changeset]; The planerot function


From: David Bateman
Subject: [Changeset]; The planerot function
Date: Wed, 26 Mar 2008 22:59:58 +0100
User-agent: Thunderbird 2.0.0.12 (X11/20080306)

Here's another missing core function. The matlab planerot function for
Given's rotations can trivially be implemented in terms of Octave's
givens function. Changeset attached.

D.
# HG changeset patch
# User David Bateman <address@hidden>
# Date 1206548426 -3600
# Node ID dd2532fd99c94d763006e6475cf8f14517e3890a
# Parent  47e49a4f9d39d02421e7a5dcf9b66c1005f6d17f
Add the planerot function

diff --git a/scripts/ChangeLog b/scripts/ChangeLog
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,7 @@ 2008-03-20  Ben Abbott <address@hidden
+2008-03-26  David Bateman  <address@hidden>
+
+       * linear-algebra/planerot.m: Givens rotation function.
+
 2008-03-20  Ben Abbott <address@hidden>
 
        * statistics/base/statistics.m: Calculate median and quantiles in
diff --git a/scripts/linear-algebra/Makefile.in 
b/scripts/linear-algebra/Makefile.in
--- a/scripts/linear-algebra/Makefile.in
+++ b/scripts/linear-algebra/Makefile.in
@@ -35,8 +35,8 @@ INSTALL_DATA = @INSTALL_DATA@
 
 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))
 
diff --git a/scripts/linear-algebra/planerot.m 
b/scripts/linear-algebra/planerot.m
new file mode 100644
--- /dev/null
+++ b/scripts/linear-algebra/planerot.m
@@ -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} address@hidden, @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
+## @address@hidden = @var{g} * @var{x}} and @address@hidden(2) = 0}.
+## @seealso{givens}
+## @end deftypefn
+
+function [G, y] = planerot (x)
+  G = givens (x(1), x(2));
+  y = G * x(:);
+endfunction

reply via email to

[Prev in Thread] Current Thread [Next in Thread]