Filter löschen
Filter löschen

Eigenvalue for a big matrix

38 Ansichten (letzte 30 Tage)
Mücahit Özalp
Mücahit Özalp am 14 Mai 2021
Bearbeitet: Mücahit Özalp am 13 Jul. 2024 um 20:52
matrx problem
  1 Kommentar
Matt J
Matt J am 14 Mai 2021
Bearbeitet: Matt J am 14 Mai 2021
Not sure if this helps, but there appear to be some papers out there dealing with eigendecomposition of block tridiagonal matrices, e.g.,

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Maneet Kaur Bagga
Maneet Kaur Bagga am 8 Mai 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!

Kategorien

Mehr zu Sparse Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by