[petsc-users] Incorrect Eigenvalues when Setting KSP and PC types

Gregory Meyer gregory.meyer at berkeley.edu
Thu Sep 21 15:47:39 CDT 2017


Hi all,

I'm using shift-invert with EPS to solve for eigenvalues. I find that if I
do only

...
  ierr = EPSGetST(eps,&st);CHKERRQ(ierr);
  ierr = STSetType(st,STSINVERT);CHKERRQ(ierr);
...

in my code I get correct eigenvalues. But if I do

...
  ierr = EPSGetST(eps,&st);CHKERRQ(ierr);
  ierr = STSetType(st,STSINVERT);CHKERRQ(ierr);
  ierr = STGetKSP(st,&ksp);CHKERRQ(ierr);
  ierr = KSPGetPC(ksp,&pc);CHKERRQ(ierr);
  ierr = KSPSetType(ksp,KSPPREONLY);CHKERRQ(ierr);
  ierr = PCSetType(pc,PCCHOLESKY);CHKERRQ(ierr);
...

the eigenvalues found by EPS are completely wrong! Somehow I thought I was
supposed to do the latter, from the examples etc, but I guess that was not
correct? I attach the full piece of test code and a test matrix.

Best,
Greg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170921/ded39c53/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_sinvert.c
Type: text/x-csrc
Size: 2346 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170921/ded39c53/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.mat
Type: application/octet-stream
Size: 2640 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170921/ded39c53/attachment.obj>


More information about the petsc-users mailing list