[petsc-users] Slepc JD and GD converge to wrong eigenpair

Jose E. Roman jroman at dsic.upv.es
Mon Apr 3 13:29:53 CDT 2017


> El 1 abr 2017, a las 0:01, Toon Weyens <toon.weyens at gmail.com> escribió:
> 
> Dear jose,
> 
> I have saved the matrices in Matlab format and am sending them to you using pCloud. If you want another format, please tell me. Please also note that they are about 1.4GB each.
> 
> I also attach a typical output of eps_view and log_view in output.txt, for 8 processes.
> 
> Thanks so much for helping me out! I think Petsc and Slepc are amazing inventions that really have saved me many months of work!
> 
> Regards

I played a little bit with your matrices.

With Krylov-Schur I can solve the problem quite easily. Note that in generalized eigenvalue problems it is always better to use STSINVERT because you have to invert a matrix anyway. So instead of setting which=smallest_real, use shift-and-invert with a target that is close to the wanted eigenvalue. For instance, with target=-0.005 I get convergence with just one iteration:

$ ./ex7 -f1 A.bin -f2 B.bin -st_ksp_type preonly -st_pc_type lu -st_pc_factor_mat_solver_package mumps -eps_tol 1e-5 -st_type sinvert -eps_target -0.005

Generalized eigenproblem stored in file.

 Reading COMPLEX matrices from binary files...
 Number of iterations of the method: 1
 Number of linear iterations of the method: 16
 Solution method: krylovschur

 Number of requested eigenvalues: 1
 Stopping condition: tol=1e-05, maxit=7500
 Linear eigensolve converged (1 eigenpair) due to CONVERGED_TOL; iterations 1
 ---------------------- --------------------
            k             ||Ax-kBx||/||kx||
 ---------------------- --------------------
  -0.004809-0.000000i       8.82085e-05
 ---------------------- --------------------


Of course, you don't know a priori where your eigenvalue is. Alternatively, you can set the target at 0 and get rid of positive eigenvalues with a region filtering. For instance:

$ ./ex7 -f1 A.bin -f2 B.bin -st_ksp_type preonly -st_pc_type lu -st_pc_factor_mat_solver_package mumps -eps_tol 1e-5 -st_type sinvert -eps_target 0 -rg_type interval -rg_interval_endpoints -1,0,-.05,.05 -eps_nev 2

Generalized eigenproblem stored in file.

 Reading COMPLEX matrices from binary files...
 Number of iterations of the method: 8
 Number of linear iterations of the method: 74
 Solution method: krylovschur

 Number of requested eigenvalues: 2
 Stopping condition: tol=1e-05, maxit=7058
 Linear eigensolve converged (2 eigenpairs) due to CONVERGED_TOL; iterations 8
 ---------------------- --------------------
            k             ||Ax-kBx||/||kx||
 ---------------------- --------------------
  -0.000392-0.000000i            2636.4
  -0.004809+0.000000i            318441
 ---------------------- --------------------

In this case, the residuals seem very bad. But this is due to the fact that your matrices have huge norms. Adding the option -eps_error_backward ::ascii_info_detail  will show residuals relative to the matrix norms:
 ---------------------- --------------------
            k                 eta(x,k)
 ---------------------- --------------------
  -0.000392-0.000000i       3.78647e-11
  -0.004809+0.000000i       5.61419e-08
 ---------------------- --------------------

 
Regarding the GD solver, I am also getting the correct solution. I don't know why you are not getting convergence to the wanted eigenvalue:

$ ./ex7 -f1 A.bin -f2 B.bin -st_ksp_type preonly -st_pc_type lu -st_pc_factor_mat_solver_package mumps -eps_tol 1e-5 -eps_smallest_real -eps_ncv 32 -eps_type gd

Generalized eigenproblem stored in file.

 Reading COMPLEX matrices from binary files...
 Number of iterations of the method: 132
 Number of linear iterations of the method: 0
 Solution method: gd

 Number of requested eigenvalues: 1
 Stopping condition: tol=1e-05, maxit=120000
 Linear eigensolve converged (1 eigenpair) due to CONVERGED_TOL; iterations 132
 ---------------------- --------------------
            k             ||Ax-kBx||/||kx||
 ---------------------- --------------------
  -0.004809+0.000000i       2.16223e-05
 ---------------------- --------------------


Again, it is much better to use a target instead of smallest_real:

$ ./ex7 -f1 A.bin -f2 B.bin -st_ksp_type preonly -st_pc_type lu -st_pc_factor_mat_solver_package mumps -eps_tol 1e-5 -eps_type gd -eps_target -0.005

Generalized eigenproblem stored in file.

 Reading COMPLEX matrices from binary files...
 Number of iterations of the method: 23
 Number of linear iterations of the method: 0
 Solution method: gd

 Number of requested eigenvalues: 1
 Stopping condition: tol=1e-05, maxit=120000
 Linear eigensolve converged (1 eigenpair) due to CONVERGED_TOL; iterations 23
 ---------------------- --------------------
            k             ||Ax-kBx||/||kx||
 ---------------------- --------------------
  -0.004809-0.000000i       2.06572e-05
 ---------------------- --------------------


Jose




More information about the petsc-users mailing list