help-octave
[Top][All Lists]

## eig accuracy after similarity transformation

 From: Rolf Fabian Subject: eig accuracy after similarity transformation Date: Mon, 9 Apr 2001 10:57:41 +0200

```Hi,

% dimension
:) N=10;

% we create an upper tri matrix with all N eigenvalues =1
:) A=diag( ones(N,1) )+triu(randn(N),1)  |- ans e.g.
A =
1.000  -0.706  -0.552  -0.154  -0.553   1.004   0.925  -1.900   0.951  1.138
0.000   1.000  -0.664   0.366  -0.373   0.899   1.526   0.924  -0.720  1.803
0.000   0.000   1.000  -0.697   1.062   1.352   1.215   0.298   0.097 -1.577
0.000   0.000   0.000   1.000   0.268   0.614   1.267  -0.401  -1.363  1.022
0.000   0.000   0.000   0.000   1.000   0.792  -0.041   1.094   0.917  0.554
0.000   0.000   0.000   0.000   0.000   1.000  -0.928   0.608   0.140  0.233
0.000   0.000   0.000   0.000   0.000   0.000   1.000   0.518  -0.384 -0.712
0.000   0.000   0.000   0.000   0.000   0.000   0.000   1.000  -0.042  0.192
0.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   1.000 -1.844
0.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000  1.000

% all diagonal elements (eigenval) are 1 exactly
:) eig(A).'             |- ans =
1  1  1  1  1  1  1  1  1  1

% let's create a random unitary transformation matrix RU
:) [ RU,dummy ] = schur( randn(N) );
:) max(max(abs(RU*RU'-eye(N)))) |- ans = 6.6613e-16
%  RU*RU' == Identity, hence RU is definitely unitary

% now we look at calculated eigenval of the
% unitarily similarity transformed matrix A
:) eig( RU'*A*RU )      |- ans =
1.01319 + 0.00000i
1.01051 + 0.00788i
1.01051 - 0.00788i
1.00368 + 0.01245i
1.00368 - 0.01245i
0.99570 + 0.01200i
0.99570 - 0.01200i
0.98972 + 0.00715i
0.98972 - 0.00715i
0.98758 + 0.00000i

What's the origin of this extremely large differences (>1%)
to the expected eigenvalues (all 1) ?

If matrix A is constructed with different eigenvalues
only, the analogous differences of eig( RU'*A*RU )
are observed to be smaller by many orders of magnitude!

Rolf

-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

```