Mercurial > matrix-functions
comparison toolbox/clement.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 = clement(n, k) | |
2 %CLEMENT Clement matrix - tridiagonal with zero diagonal entries. | |
3 % CLEMENT(N, K) is a tridiagonal matrix with zero diagonal entries | |
4 % and known eigenvalues. It is singular if N is odd. About 64 | |
5 % percent of the entries of the inverse are zero. The eigenvalues | |
6 % are plus and minus the numbers N-1, N-3, N-5, ..., (1 or 0). | |
7 % For K = 0 (the default) the matrix is unsymmetric, while for | |
8 % K = 1 it is symmetric. | |
9 % CLEMENT(N, 1) is diagonally similar to CLEMENT(N). | |
10 | |
11 % Similar properties hold for TRIDIAG(X,Y,Z) where Y = ZEROS(N,1). | |
12 % The eigenvalues still come in plus/minus pairs but they are not | |
13 % known explicitly. | |
14 % | |
15 % References: | |
16 % P.A. Clement, A class of triple-diagonal matrices for test | |
17 % purposes, SIAM Review, 1 (1959), pp. 50-52. | |
18 % A. Edelman and E. Kostlan, The road from Kac's matrix to Kac's | |
19 % random polynomials. In John~G. Lewis, editor, Proceedings of | |
20 % the Fifth SIAM Conference on Applied Linear Algebra Society | |
21 % for Industrial and Applied Mathematics, Philadelphia, 1994, | |
22 % pp. 503-507. | |
23 % O. Taussky and J. Todd, Another look at a matrix of Mark Kac, | |
24 % Linear Algebra and Appl., 150 (1991), pp. 341-360. | |
25 | |
26 if nargin == 1, k = 0; end | |
27 | |
28 n = n-1; | |
29 | |
30 x = n:-1:1; | |
31 z = 1:n; | |
32 | |
33 if k == 0 | |
34 A = diag(x, -1) + diag(z, 1); | |
35 else | |
36 y = sqrt(x.*z); | |
37 A = diag(y, -1) + diag(y, 1); | |
38 end |