Mercurial > matrix-functions
comparison toolbox/wilk.m @ 0:8f23314345f4 draft
Create local repository for matrix toolboxes. Step #0 done.
author | Antonio Pino Robles <data.script93@gmail.com> |
---|---|
date | Wed, 06 May 2015 14:56:53 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:8f23314345f4 |
---|---|
1 function [A, b] = wilk(n) | |
2 %WILK Various specific matrices devised/discussed by Wilkinson. | |
3 % [A, b] = WILK(N) is the matrix or system of order N. | |
4 % N = 3: upper triangular system Ux=b illustrating inaccurate solution. | |
5 % N = 4: lower triangular system Lx=b, ill-conditioned. | |
6 % N = 5: HILB(6)(1:5,2:6)*1.8144. Symmetric positive definite. | |
7 % N = 21: W21+, tridiagonal. Eigenvalue problem. | |
8 | |
9 % References: | |
10 % J.H. Wilkinson, Error analysis of direct methods of matrix inversion, | |
11 % J. Assoc. Comput. Mach., 8 (1961), pp. 281-330. | |
12 % J.H. Wilkinson, Rounding Errors in Algebraic Processes, Notes on Applied | |
13 % Science No. 32, Her Majesty's Stationery Office, London, 1963. | |
14 % J.H. Wilkinson, The Algebraic Eigenvalue Problem, Oxford University | |
15 % Press, 1965. | |
16 | |
17 if n == 3 | |
18 % Wilkinson (1961) p.323. | |
19 A = [ 1e-10 .9 -.4 | |
20 0 .9 -.4 | |
21 0 0 1e-10]; | |
22 b = [ 0 0 1]'; | |
23 | |
24 elseif n == 4 | |
25 % Wilkinson (1963) p.105. | |
26 A = [0.9143e-4 0 0 0 | |
27 0.8762 0.7156e-4 0 0 | |
28 0.7943 0.8143 0.9504e-4 0 | |
29 0.8017 0.6123 0.7165 0.7123e-4]; | |
30 b = [0.6524 0.3127 0.4186 0.7853]'; | |
31 | |
32 elseif n == 5 | |
33 % Wilkinson (1965), p.234. | |
34 A = hilb(6); | |
35 A = A(1:5, 2:6)*1.8144; | |
36 | |
37 elseif n == 21 | |
38 % Taken from gallery.m. Wilkinson (1965), p.308. | |
39 E = diag(ones(n-1,1),1); | |
40 m = (n-1)/2; | |
41 A = diag(abs(-m:m)) + E + E'; | |
42 | |
43 else | |
44 error('Sorry, that value of N is not available.') | |
45 end |