Mercurial > hg > octave-lyh
comparison scripts/linear-algebra/qzhess.m @ 11471:994e2a93a8e2
Use uppercase 'A' to refer to matrix inputs in m-files.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sun, 09 Jan 2011 16:01:05 -0800 |
parents | 693e22af08ae |
children | fd0a3ac60b0e |
comparison
equal
deleted
inserted
replaced
11470:eb9e0b597d61 | 11471:994e2a93a8e2 |
---|---|
16 ## You should have received a copy of the GNU General Public License | 16 ## You should have received a copy of the GNU General Public License |
17 ## along with Octave; see the file COPYING. If not, see | 17 ## along with Octave; see the file COPYING. If not, see |
18 ## <http://www.gnu.org/licenses/>. | 18 ## <http://www.gnu.org/licenses/>. |
19 | 19 |
20 ## -*- texinfo -*- | 20 ## -*- texinfo -*- |
21 ## @deftypefn {Function File} {[@var{aa}, @var{bb}, @var{q}, @var{z}] =} qzhess (@var{a}, @var{b}) | 21 ## @deftypefn {Function File} {[@var{aa}, @var{bb}, @var{q}, @var{z}] =} qzhess (@var{A}, @var{B}) |
22 ## Compute the Hessenberg-triangular decomposition of the matrix pencil | 22 ## Compute the Hessenberg-triangular decomposition of the matrix pencil |
23 ## @code{(@var{a}, @var{b})}, returning | 23 ## @code{(@var{A}, @var{B})}, returning |
24 ## @code{@var{aa} = @var{q} * @var{a} * @var{z}}, | 24 ## @code{@var{aa} = @var{q} * @var{A} * @var{z}}, |
25 ## @code{@var{bb} = @var{q} * @var{b} * @var{z}}, with @var{q} and @var{z} | 25 ## @code{@var{bb} = @var{q} * @var{B} * @var{z}}, with @var{q} and @var{z} |
26 ## orthogonal. For example: | 26 ## orthogonal. For example: |
27 ## | 27 ## |
28 ## @example | 28 ## @example |
29 ## @group | 29 ## @group |
30 ## [aa, bb, q, z] = qzhess ([1, 2; 3, 4], [5, 6; 7, 8]) | 30 ## [aa, bb, q, z] = qzhess ([1, 2; 3, 4], [5, 6; 7, 8]) |
44 | 44 |
45 ## Author: A. S. Hodel <scotte@eng.auburn.edu> | 45 ## Author: A. S. Hodel <scotte@eng.auburn.edu> |
46 ## Created: August 1993 | 46 ## Created: August 1993 |
47 ## Adapted-By: jwe | 47 ## Adapted-By: jwe |
48 | 48 |
49 function [aa, bb, q, z] = qzhess (a, b) | 49 function [aa, bb, q, z] = qzhess (A, B) |
50 | 50 |
51 if (nargin != 2) | 51 if (nargin != 2) |
52 print_usage (); | 52 print_usage (); |
53 endif | 53 endif |
54 | 54 |
55 [na, ma] = size (a); | 55 [na, ma] = size (A); |
56 [nb, mb] = size (b); | 56 [nb, mb] = size (B); |
57 if (na != ma || na != nb || nb != mb) | 57 if (na != ma || na != nb || nb != mb) |
58 error ("qzhess: incompatible dimensions"); | 58 error ("qzhess: incompatible dimensions"); |
59 endif | 59 endif |
60 | 60 |
61 ## Reduce to hessenberg-triangular form. | 61 ## Reduce to hessenberg-triangular form. |
62 | 62 |
63 [q, bb] = qr (b); | 63 [q, bb] = qr (B); |
64 aa = q' * a; | 64 aa = q' * A; |
65 q = q'; | 65 q = q'; |
66 z = eye (na); | 66 z = eye (na); |
67 for j = 1:(na-2) | 67 for j = 1:(na-2) |
68 for i = na:-1:(j+2) | 68 for i = na:-1:(j+2) |
69 | 69 |