Mercurial > matrix-functions
comparison toolbox/hanowa.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 = hanowa(n, d) | |
2 %HANOWA A matrix whose eigenvalues lie on a vertical line in the complex plane. | |
3 % HANOWA(N, d) is the N-by-N block 2x2 matrix (thus N = 2M must be even) | |
4 % [d*EYE(M) -DIAG(1:M) | |
5 % DIAG(1:M) d*EYE(M)] | |
6 % It has complex eigenvalues lambda(k) = d +/- k*i (1 <= k <= M). | |
7 % Parameter d defaults to -1. | |
8 | |
9 % Reference: | |
10 % E. Hairer, S.P. Norsett and G. Wanner, Solving Ordinary | |
11 % Differential Equations I: Nonstiff Problems, Springer-Verlag, | |
12 % Berlin, 1987. (pp. 86-87) | |
13 | |
14 if nargin == 1, d = -1; end | |
15 | |
16 m = n/2; | |
17 if round(m) ~= m | |
18 error('N must be even.') | |
19 end | |
20 | |
21 A = [ d*eye(m) -diag(1:m) | |
22 diag(1:m) d*eye(m)]; |