petsc-3.7.1 2016-05-15
Report Typos and Errors

# KSPComputeEigenvalues

Computes the extreme eigenvalues for the preconditioned operator. Called after or during KSPSolve().

### Synopsis

    #include "petscksp.h"
    PetscErrorCode  KSPComputeEigenvalues(KSP ksp,PetscInt n,PetscReal r[],PetscReal c[],PetscInt *neig)

Not Collective Many br

### Input Parameter

| ksp | - iterative context obtained from KSPCreate() Many br
| n | - size of arrays r and c. The number of eigenvalues computed (neig) will, in Many brgeneral, be less than this. Many br

### Output Parameters

| r | - real part of computed eigenvalues, provided by user with a dimension of at least n Many br
| c | - complex part of computed eigenvalues, provided by user with a dimension of at least n Many br
| neig | - actual number of eigenvalues computed (will be less than or equal to n) Many br

### Options Database Keys

| -ksp_compute_eigenvalues | - Prints eigenvalues to stdout Many br
| -ksp_plot_eigenvalues | - Plots eigenvalues in an x-window display Many br

### Notes

The number of eigenvalues estimated depends on the size of the Krylov space Many brgenerated during the KSPSolve() ; for example, with Many brCG it corresponds to the number of CG iterations, for GMRES it is the number Many brof GMRES iterations SINCE the last restart. Any extra space in r[] and c[] Many brwill be ignored. Many br

KSPComputeEigenvalues() does not usually provide accurate estimates; it is Many brintended only for assistance in understanding the convergence of iterative Many brmethods, not for eigenanalysis. For accurate computation of eigenvalues we recommend using Many brthe excellent package SLEPc. Many br

One must call KSPSetComputeEigenvalues() before calling KSPSetUp() Many brin order for this routine to work correctly. Many br

Many users may just want to use the monitoring routine Many brKSPMonitorSingularValue() (which can be set with option -ksp_monitor_singular_value) Many brto print the singular values at each iteration of the linear solve. Many br

Many br

### Keywords

KSP, compute, extreme, singular, values

### See Also

KSPSetComputeSingularValues(), KSPMonitorSingularValue(), KSPComputeExtremeSingularValues()

Level:advanced
Location:src/ksp/ksp/interface/itfunc.c
Index of all KSP routines
Table of Contents for all manual pages
Index of all manual pages