フィルターのクリア

Eig function for symmetric matrices

35 ビュー (過去 30 日間)
Viviana Arrigoni
Viviana Arrigoni 2016 年 10 月 4 日
コメント済み: Christine Tobler 2018 年 9 月 21 日
Two of the properties of symmetric matrices are that their eigenvalues are always real, and that they are always orthogonally diagonalizable. Given any two distinct eigenvalues, the corresponding eigenvectors are orthonormal. Yet if some eigenvalue L with multiplicity greater than 1 appear, it is necessary to use, for example, Gram Schmidt for ensuring orthogonality between the vectors representing the span of Ker(A - Id L). I was so glad to see that computing the MatLab function eig over symmetric matrices having multiple eigenvalues would output an orthogonal eigenvector matrix, meaning that MatLab doesn't only normalize the vectors, but also it make them orthogonal! I tried it on a few matrices, I just need to know if I was "lucky" with them, and if usually eig doesn't do that, or, elsewise, what procedure is implemented in eig for dealing with this situation. Thank you for your help.

回答 (2 件)

Matt J
Matt J 2016 年 10 月 4 日
I doubt you were just lucky. I've never seen EIG fail to give orthogonalized eigenvectors for symmetric matrices if it can recognize the matrix as symmetric. If there's a chance you'll have numerical error in the creation of the matrix (such that it is not perfectly symmetric), it would be safest to use SVD instead.
  1 件のコメント
Walter Roberson
Walter Roberson 2016 年 10 月 4 日
Or force them to be symmetric by using
A = (A + A.')/2;

サインインしてコメントする。


Steven Lord
Steven Lord 2016 年 10 月 4 日
編集済み: Steven Lord 2016 年 10 月 4 日
According to the documentation page for eig, specifically the section describing the output argument V:
[V,D] = eig(A) returns matrix V, whose columns are the right eigenvectors of A such
that A*V = V*D. The eigenvectors in V are normalized so that the 2-norm
of each is 1.
If A is real symmetric, then the right eigenvectors, V, are orthonormal.
[Edited to fix formatting of quoted text.]
  13 件のコメント
Bruno Luong
Bruno Luong 2018 年 9 月 20 日
Great find of using SCHUR
Christine Tobler
Christine Tobler 2018 年 9 月 21 日
Calling SCHUR for a hermitian matrix should be slower than calling EIG. I still think the problem is that your matrix is not exactly hermitian.
Here's an example:
>> n = 1000;
>> A = randn(n) + 1i*randn(n);
>> A = A*diag(rand(n, 1))*A'; % nearly hermitian
>> norm(A - A')
ans =
7.3104e-13
>> tic; [U, D] = eig(A); toc
Elapsed time is 4.432694 seconds.
>> tic; [U, T] = schur(A); toc
Elapsed time is 3.521355 seconds.
>> tic; [U, D] = eig((A+A')/2); toc
Elapsed time is 0.637474 seconds.
Because A is not hermitian, EIG uses the non-hermitian algorithm, which is based on calling SCHUR, and then recovering the eigenvectors from the Schur vectors. Since A is nearly hermitian, its eigenvectors are nearly identical to the Schur vectors.
However, for a hermitian matrix, the Schur decomposition's matrix T is diagonal. There is no need to compute the upper triangle of T, as is done in SCHUR, and the hermitian algorithm is faster because it doesn't do this.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by