필터 지우기
필터 지우기

Eigenvalue for a big matrix

조회 수: 38 (최근 30일)
Mücahit Özalp
Mücahit Özalp 2021년 5월 14일
편집: Mücahit Özalp 2024년 7월 13일 20:52
이 질문에 Walter Roberson 님이 플래그를 지정함
  댓글 수: 1
Matt J
Matt J 2021년 5월 14일
편집: Matt J 2021년 5월 14일
Not sure if this helps, but there appear to be some papers out there dealing with eigendecomposition of block tridiagonal matrices, e.g.,

댓글을 달려면 로그인하십시오.

답변 (1개)

Maneet Kaur Bagga
Maneet Kaur Bagga 2024년 5월 8일
Hi,
From the above question it is my understanding that, you want to compute the smallest 10 eigen values of a large sparse matrix in MATLAB, following could be the possible workaround for the same:
To minimize the memory usage the matrix "D" should be a sparse matrix and specify options tailored for large scale problems:
D = kron(E0,A) + kron(E1,B) + kron(E1.',B); % D should be sparse
% Assuming D is your large sparse matrix
opts.tol = 1e-3; % Adjust tolerance to manage computation time and memory
opts.maxit = 300; % Limit the maximum number of iterations
opts.isreal = true; % Set based on your matrix, can affect performance
opts.issym = true; % If D is symmetric, this can significantly improve efficiency
% Find the smallest 10 eigenvalues
[EigVec, EigVal] = eigs(D, 10, 'smallestabs', opts);
Assuming you have the "Parallel Computing Toolbox", you can utilize multiple cores to speed up the computation:
% Enable parallel computing
parpool; % Initializes a parallel pool of workers
% Use 'eigs' with parallel options if applicable
[EigVec, EigVal] = eigs(D, 10, 'smallestabs', opts); % The same as before, MATLAB will automatically use available workers
Another possible workaround for this is to integrate external libraries in the following way:
  1. ARPACK: For more control or different configurations, consider using ARPACK directly from C++ or Fortran and interfacing with MATLAB via MEX files.
  2. SLEPc: Using SLEPc (a scalable library for eigenvalue problem computations) involves more setup. You can write a C or C++ program that uses SLEPc for the eigenvalue computations, then call this program from MATLAB using the system command or compile it as a MEX file to be called directly from MATLAB.
Please refer to the following code below for reference:
// A very rough pseudo-code for using an external library like SLEPc
#include <slepc.h>
int main(int argc, char **argv) {
// Initialize SLEPc
SlepcInitialize(&argc,&argv,(char*)0,help);
// Your matrix setup and eigenvalue computation goes here
// Finalize SLEPc
SlepcFinalize();
return 0;
}
Hope this helps!

카테고리

Help CenterFile Exchange에서 Sparse Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by