diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/toolbox/eigsens.m	Thu May 07 18:36:24 2015 +0200
@@ -0,0 +1,25 @@
+function [X, D, s] = eigsens(A)
+%EIGSENS   Eigenvalue condition numbers.
+%          EIGSENS(A) is a vector of condition numbers for the eigenvalues
+%          of A (reciprocals of the Wilkinson s(lambda) numbers).
+%          These condition numbers are the reciprocals of the cosines of the
+%          angles between the left and right eigenvectors.
+%          [V, D, s] = EIGSENS(A) is equivalent to
+%                      [V, D] = EIG(A); s = EIGSENS(A);
+
+%          Reference:
+%          G.H. Golub and C.F. Van Loan, Matrix Computations, Second
+%          Edition, Johns Hopkins University Press, Baltimore, Maryland,
+%          1989, sec. 7.2.2.
+
+n = max(size(A));
+s = zeros(n,1);
+
+[X, D] = eig(A);
+Y = inv(X);
+
+for i=1:n
+    s(i) = norm(Y(i,:)) * norm(X(:,i)) / abs( Y(i,:)*X(:,i) );
+end
+
+if nargout <= 1, X = s; end