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
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