- "Using eigs is not the most efficient way to find a few eigenvalues of small, dense matrices. For such problems, it might be quicker to use eig(full(A)). For example, finding three eigenvalues in a 500-by-500 matrix is a relatively small problem that is easily handled with eig."
'eigs and eig'-- which one should I choose?
조회 수: 122 (최근 30일)
이전 댓글 표시
Hi there,
I have two square matrix G1 and G2, both obtain the same size. Now, I want to obtain the princinple eigenvector of matrix set (G1,G2). Which function should I use? eigs or eig? Also I want to know their computational complexity, I guess is around O(n^3)? n is the matrix dimension.
Thanks
댓글 수: 1
Oguz Kaan Hancioglu
2023년 4월 3일
Eigs returns subset of eig command. If you examine all eigenvector both commands are the same. You can call eigs command with the subset dimensions. I don't know anything about the time complexity. Also in eigs comment there is a comment from matlab:
Also there no code generation for eigs.
After you get the eigenvector, you can use vector opearions (such as max) to find princinpal eigenvectors.
Best.
답변 (1개)
Vandit
2023년 4월 4일
The choice of whether to use “eig” or “eigs” function depends on the size of the matrix and the desired accuracy.
"eig" function is used to calculate all the eigenvalues and eigenvectors of a matrix so its computational complexity is O(n^3) for a matrix of size n x n. Therefore, if the size of the matrix is relatively small and you need all the eigenvalues and eigenvectors, you can use the "eig" function to obtain the principal eigenvector of the matrix set.
On the other hand, if the size of the matrix is large and you only need the principal eigenvector or a few eigenvalues and eigenvectors of a matrix then "eigs" function can be more efficient.
The computational cost of the "eigs" function is much lower than that of the "eig" function for large matrices, as it only computes a few eigenvalues and eigenvectors instead of all of them.
You can refer to the syntax of the both the functions using the link given below:
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!