# [SciPy-user] generalized eigenvalue problem for sparse matrices

Abhinav Sarkar abhinav.sarkar@gmail....
Tue Apr 15 01:48:50 CDT 2008

```abhinav sarkar <abhinav.sarkar <at> gmail.com> writes:

>
> Hi
>   I am trying to solve a generalized eigenvalue problem for sparse
>  matrices. The problem is in form
>     A*x = 𝜎*M*x
>  where A and M are sparse matrices and x is a vector and sigma is a
>  scalar whose value is to be found.
>
>  For this I am using the Arpack function ARPACK_gen_eigs provided in
>  the module scipy.sparse.linalg.eigen.arpack.speigs . However the
>  solution which I am getting does not match with the solution obtained
>  from the eig function in MATLAB. For example:
>
>  A = [1 0 0 -33 16 0; 0 1 0 16 -33 16; 0 0 1 0 16 -33; 1601 -96 256
>  -1800 0 0; -96 1601 -96 0 -1800 0; 256 -96 1601 0 0 -1800]
>  M = [0 0 0 1 0 0; 0 0 0 0 1 0; 0 0 0 0 0 1; -33 16 0 0 0 0; 16 -33 16
>  0 0 0; 0 16 -33 0 0 0]
>
>  The matrices are written in MATLAB format, spaces separating the row
>  elements and ";" separating the rows.
>  When I solve this problem in MATLAB using the function eig, I get the
>  following eigenvalues:
>  -155.0345, -56.9898, -45.2209, -31.9376, -28.5367, -9.1611
>
>  However when I solve it using ARPACK_gen_eigs to find the two
>  eigenvalues near 10, I get the following solution:
>  13.83675153-1.71439075j, 13.83675153+1.71439075j
>  which is certainly not correct.
>  --
>  Abhinav Sarkar

I tried the eigenvalue problem solver provided for the dense matrices at
scipy.linalg.eig and it gives the same result as the MATLAB functin eig. Then
why is scipy.sparse.linalg.eigen.arpack.speigs.ARPACK_gen_eigs giving different