Mercurial > matrix-functions
comparison toolbox/eigsens.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 [X, D, s] = eigsens(A) | |
2 %EIGSENS Eigenvalue condition numbers. | |
3 % EIGSENS(A) is a vector of condition numbers for the eigenvalues | |
4 % of A (reciprocals of the Wilkinson s(lambda) numbers). | |
5 % These condition numbers are the reciprocals of the cosines of the | |
6 % angles between the left and right eigenvectors. | |
7 % [V, D, s] = EIGSENS(A) is equivalent to | |
8 % [V, D] = EIG(A); s = EIGSENS(A); | |
9 | |
10 % Reference: | |
11 % G.H. Golub and C.F. Van Loan, Matrix Computations, Second | |
12 % Edition, Johns Hopkins University Press, Baltimore, Maryland, | |
13 % 1989, sec. 7.2.2. | |
14 | |
15 n = max(size(A)); | |
16 s = zeros(n,1); | |
17 | |
18 [X, D] = eig(A); | |
19 Y = inv(X); | |
20 | |
21 for i=1:n | |
22 s(i) = norm(Y(i,:)) * norm(X(:,i)) / abs( Y(i,:)*X(:,i) ); | |
23 end | |
24 | |
25 if nargout <= 1, X = s; end |