[petsc-users] [SLEPc] generalized symmetric eigensystem

Pierre Jolivet pierre at joliv.et
Fri Aug 5 00:47:00 CDT 2022



> On 5 Aug 2022, at 5:04 AM, Patrick Alken <patrick.alken at geomag.info> wrote:
> 
> I am trying to solve a generalized symmetric eigensystem problem using SLEPc, and I am getting much different eigenvalues compared with the dense LAPACK solver DSYGVD. I have attached a minimal working example (MWE). The code relies on the external libraries GSL, Lapack and Lapacke.
> 
> The matrices (A,B) come from discretizing the Laplacian in spherical coordinates using a radial basis function method. Here are the eigenvalues computed by the dense LAPACK solver:
> 
> === LAPACK eigenvalues ===
> eval(0) = 1.309567289750e+00
> eval(1) = 1.648674331144e+00
> eval(2) = 1.709879393690e+00
> eval(3) = 1.709879393690e+00
> eval(4) = 2.142210251638e+00
> eval(5) = 2.142210251638e+00
> eval(6) = 2.145726457896e+00
> eval(7) = 2.216526311324e+00
> eval(8) = 2.216526311324e+00
> eval(9) = 2.695837030236e+00
> 
> 
> Here are the eigenvalues computed by SLEPc, using the command:
> 
> $ ./mwe -eps_nev 10 -eps_smallest_magnitude -eps_tol 1e-8
> 
> Number of requested eigenvalues: 10
>  Linear eigensolve converged (10 eigenpairs) due to CONVERGED_TOL; iterations 196
>  ---------------------- --------------------
>             k             ||Ax-kBx||/||kx||
>  ---------------------- --------------------
>         0.094520                906.031
>         0.177268                363.291
>         1.324501                61.9577
>         1.786472                35.7082
>         2.187857                32.8364
>        -2.886905                27.7314
>         2.899206                24.2224
>         4.195222                20.3007
>         4.787192                12.8346
>         7.221589                9.58513
>  ---------------------- --------------------
> 
> As we can see, the results are quite different than LAPACK and the error norms in the right column are quite large. Using a stricter tolerance (eps_tol) does not seem to help. Can anyone suggest how to diagnose and fix the problem?

You probably want to use a spectral transformation to find the smallest magnitude eigenpairs.
I cannot try your code because of its dependencies, but I bet that if you replace -eps_smallest_magnitude by -eps_target 0.0 -st_type sinvert, you’ll get a match with the LAPACK eigenvalues.

Thanks,
Pierre

> <laplace3d.c><le_laplace3d.h><Makefile.txt><mwe.c>



More information about the petsc-users mailing list