## MyGeneralizedEigenv​alueProblemSolver

Version 1.0.2 (11.4 MB) by
Solving large-scale generalized/standard eigenvalue problems; GPU-accelerated Conjugate Gradient solver for linear system.

Updated 15 Jul 2020

# MyGnenralizedEigenvalueProblemSolver
Successfully tested on Matlab R2019a and subsequent versions.

# Functionality & Application:
With a memory-efficient way to solve the k smallest Eigenvalues and the corresponding Eigenvectors
of the large-scale Generalized/Standard Eigen-system A*x = v*B*x. Where, 'A' is a sparse symmetric
matrix, 'B' is a sparse symmetric positive-definite matrix (Specially, the generalized eigen-system
becomes a standard one when 'B' is an identity matrix), 'v' is the eigenvalue, 'x' is corresponding
eigenvector.
A direct application of this program is the 'Modal Analysis' in Finite Element- (FE-) based Structural
dynamics analysis.

# Design description
The Matlab built-in function 'eigs' provides a highly scalable interface for solving the generalized/
standard eigen-system, however, it doesn't fit the large-scale problem very well because of the
limitation of the integrated linear system solver in it causing the memory overload easily. I
re-organized the the Conjugate Gradient (CG) linear system solver and integrated it into 'eigs', now it
can handle problems with millions of degree of freedoms in a normal PC. Furthermore, to reduce the processing
time, I finshed a limited extension to GPU with the use of the Matlab built-in function 'gpuArray'.

# Data set:
The sparse matrix stored in the Matlab 'MAT-File' is used for the demo code, but the solver itself
is open to any input sparse matrix files as long as converting them into the standard Matlab sparse
matrix form (via 'sparse' or 'spconvert' functions) before solving.
You can find the test data sets with 1K x 1K, 10K x 10K and 100K x 100K dimensions from the 'data'
folder, and the larger ones with 1M x 1M and 4M x 4M dimensions can be got via the following link

# Control parameters:
'GPU_' ========= Switch 'ON' to try proceeding the linear system solving on GPU, if there is no enough
space on the VRAM, stepping back to CPU.
'LSSolver_' ==== type of the linear system solver ('Iterative' or 'Direct'), opting 'Iterative' will
solve the linear system via CG-solver, 'Direct' will go with the Matlab built-in multi-frontal
LU decomposition. The 'Direct' option is only recommended for those highly sparse or small
matrices, and GPU acceleration doesn't work in this option.
'tol_' ========= Convergence tolerance for both 'eigs' and the CG-solver.
'maxIT_' ======= the maximum iteration number of the CG-solver.

# Limitations:
Only the k smallest eigenpairs are considered.
In order to save the VRAM space in the GPU accelerated version, I tried using C*y + (y'*C)' - eig(A).*y
to replace A*y (where C = tril(A)), but I failed since the large error (around 1.0e-3) between these two
operations. I guess there must be some numerical deviations, but shouldn't be this large.
Welcome to exchange in the comment zone!

# Some results
Experiment Environment 1:
A desktop running Windows 10 and equiped with CPU: Intel(R) Core(TM) i7-7700K @4.20GHz; RAM: 32GB; GPU: NIVDIA GeForce RTX 2070, 8GB VRAM
-------------------------------------------------------------------------
dimension | Processing time: s (CPU) | Processing time: s (GPU)
-------------------------------------------------------------------------
1K x 1K | 0.2 | 3.9
10K x 10K | 2.1 | 5.85
100K x 100K | 47.3 | 13.1
1M x 1M | 1.23e+03 | 109
4M x 4M | 7.31e+03 | 852
-------------------------------------------------------------------------

Experiment Environment 2(provided by Yingjian Liu from The University of Texas at Dallas，US):
A laptop running Windows 10 and equiped with CPU: Intel(R) Core(TM) i7-9750H 2.60GHz turbo@4.20GHz; RAM: 16GB; GPU: NIVDIA GeForce RTX 2060, 6GB VRAM
-------------------------------------------------------------------------
dimension | Processing time: s (CPU) | Processing time: s (GPU)
-------------------------------------------------------------------------
1K x 1K | 0.16 | 4.56
10K x 10K | 1.99 | 6.6
100K x 100K | 49.5 | 14.8
1M x 1M | 1.33e+03 | 152
3M x 3M | 5.25e+03 | 746
-------------------------------------------------------------------------

### Cite As

junpeng wang (2023). MyGeneralizedEigenvalueProblemSolver (https://www.mathworks.com/matlabcentral/fileexchange/76926-mygeneralizedeigenvalueproblemsolver), MATLAB Central File Exchange. Retrieved .

##### MATLAB Release Compatibility
Created with R2019a
Compatible with R2019a to R2020a
##### Platform Compatibility
Windows macOS Linux

### Community Treasure Hunt

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

Start Hunting!

#### MyGeneralizedEigenvalueProblemSolver

Version Published Release Notes
1.0.2

corrected typo in file name

1.0.1

corrected typo in file name

1.0.0