Mercurial > matrix-functions
comparison toolbox/rschur.m @ 2:c124219d7bfa draft
Re-add the 1995 toolbox after noticing the statement in the ~higham/mctoolbox/ webpage.
author | Antonio Pino Robles <data.script93@gmail.com> |
---|---|
date | Thu, 07 May 2015 18:36:24 +0200 |
parents | 8f23314345f4 |
children |
comparison
equal
deleted
inserted
replaced
1:e471a92d17be | 2:c124219d7bfa |
---|---|
1 function A = rschur(n, mu, x, y) | |
2 %RSCHUR An upper quasi-triangular matrix. | |
3 % A = RSCHUR(N, MU, X, Y) is an N-by-N matrix in real Schur form. | |
4 % All the diagonal blocks are 2-by-2 (except for the last one, if N | |
5 % is odd) and the k'th has the form [x(k) y(k); -y(k) x(k)]. | |
6 % Thus the eigenvalues of A are x(k) +/- i*y(k). | |
7 % MU (default 1) controls the departure from normality. | |
8 % Defaults: X(k) = -k^2/10, Y(k) = -k, i.e., the eigenvalues | |
9 % lie on the parabola x = -y^2/10. | |
10 | |
11 % References: | |
12 % F. Chatelin, Eigenvalues of Matrices, John Wiley, Chichester, 1993; | |
13 % Section 4.2.7. | |
14 % F. Chatelin and V. Fraysse, Qualitative computing: Elements | |
15 % of a theory for finite precision computation, Lecture notes, | |
16 % CERFACS, Toulouse, France and THOMSON-CSF, Orsay, France, | |
17 % June 1993. | |
18 | |
19 m = floor(n/2)+1; | |
20 alpha = 10; beta = 1; | |
21 | |
22 if nargin < 4, y = -(1:m)/beta; end | |
23 if nargin < 3, x = -(1:m).^2/alpha; end | |
24 if nargin < 2, mu = 1; end | |
25 | |
26 A = diag( mu*ones(n-1,1), 1 ); | |
27 for i=1:2:2*(m-1) | |
28 j = (i+1)/2; | |
29 A(i:i+1,i:i+1) = [x(j) y(j); -y(j) x(j)]; | |
30 end | |
31 if 2*m ~= n, | |
32 A(n,n) = x(m); | |
33 end |