[petsc-users] find eigenvalues in serial for small matrix

Oleksandr Koshkarov olk548 at mail.usask.ca
Mon Jul 23 20:27:59 CDT 2018

Dear All,

In my large parallel simulation, I need to precompute eigenvalues (or at 
least the largest one) of smallish simple matrix (from 4x4 up to maybe 
50x50, tridiagonal and symmetric). Computation time here is not 
important and I thought to do it for each processor independently in 
serial. I thought to use petsc for this as I already use petsc for 
everything else. However, simple solution seems not to work:

   Mat M;

... insering some values


   KSP ksp;

   PetscReal r[n], c[n];

which produces the error:
[0]PETSC ERROR: --------------------- Error Message 
[0]PETSC ERROR: Null argument, when expecting valid pointer
[0]PETSC ERROR: Null Object: Parameter # 1
[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html 
for trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.9.2, May, 20, 2018
[0]PETSC ERROR: ./eigtest on a arch-linux2-c-debug named koshlaptop by 
kosh Mon Jul 23 19:25:29 2018
[0]PETSC ERROR: Configure options --with-hdf5-dir=/home/kosh/.local/hdf5
[0]PETSC ERROR: #1 VecDuplicate() line 372 in 
[0]PETSC ERROR: #2 KSPComputeExplicitOperator() line 47 in 
[0]PETSC ERROR: #3 KSPComputeEigenvaluesExplicitly() line 140 in 

Is it possible to use petsc for this simple task? or KSP will not work 
with dense serial matrix?

Thank you in advance and best regards,

More information about the petsc-users mailing list