Clear Filters
Clear Filters

Eigenvalue for a big matrix

38 views (last 30 days)
Mücahit Özalp
Mücahit Özalp on 14 May 2021
Edited: Mücahit Özalp on 13 Jul 2024 at 20:52
This question was flagged by Walter Roberson
matrx problem
  1 Comment
Matt J
Matt J on 14 May 2021
Edited: Matt J on 14 May 2021
Not sure if this helps, but there appear to be some papers out there dealing with eigendecomposition of block tridiagonal matrices, e.g.,

Sign in to comment.

Answers (1)

Maneet Kaur Bagga
Maneet Kaur Bagga on 8 May 2024
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!

Categories

Find more on Sparse Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!