Package slepc4py :: Module SLEPc :: Class EPS

[hide private]
[frames] | no frames]

# Class EPS

EPS

Nested Classes | [hide private]

| Balance EPS type of balancing used for non-Hermitian problems
| Conv EPS convergence test
| ConvergedReason EPS convergence reasons
| ErrorType EPS error type to assess accuracy of computed solutions
| Extraction EPS extraction technique
| LanczosReorthogType EPS Lanczos reorthogonalization type
| PowerShiftType EPS Power shift type.
| ProblemType EPS problem type
| Type EPS type
| Which EPS desired piece of spectrum

Instance Methods | [hide private]

a new object with type S, a subtype of T

__new__(S, ...) |

appendOptionsPrefix(self, prefix) Appends to the prefix used for searching for all EPS options in the database. |

cancelMonitor(self) Clears all monitors for an EPS object. |

computeError(self, int i, etype=None) Computes the error (based on the residual norm) associated with the i-th computed eigenpair. |

create(self, comm=None) Creates the EPS object. |

destroy(self) Destroys the EPS object. |

errorView(self, etype=None, Viewer viewer=None) Displays the errors associated with the computed solution (as well as the eigenvalues). |

getArnoldiDelayed(self) Gets the type of reorthogonalization used during the Arnoldi iteration. |

getBV(self) Obtain the basis vector objects associated to the eigensolver. |

getBalance(self) Gets the balancing type used by the EPS object, and the associated parameters. |

getConverged(self) Gets the number of converged eigenpairs. |

getConvergedReason(self) Gets the reason why the solve() iteration was stopped. |

getConvergenceTest(self) Return the method used to compute the error estimate used in the convergence test. |

getDS(self) Obtain the direct solver associated to the eigensolver. |

getDimensions(self) Gets the number of eigenvalues to compute and the dimension of the subspace. |

getEigenpair(self, int i, Vec Vr=None, Vec Vi=None) Gets the i-th solution of the eigenproblem as computed by solve(). |

getEigenvalue(self, int i) Gets the i-th eigenvalue as computed by solve(). |

getEigenvector(self, int i, Vec Vr, Vec Vi=None) Gets the i-th eigenvector as computed by solve(). |

getErrorEstimate(self, int i) Returns the error estimate associated to the i-th computed eigenpair. |

getExtraction(self) Gets the extraction type used by the EPS object. |

getInterval(self) Gets the computational interval for spectrum slicing. |

getInvariantSubspace(self) Gets an orthonormal basis of the computed invariant subspace. |

getIterationNumber(self) Gets the current iteration number. |

getKrylovSchurDetectZeros(self) Gets the flag that enforces zero detection in spectrum slicing. |

getKrylovSchurDimensions(self) Gets the dimensions used for each subsolve step in case of doing spectrum slicing for a computational interval. |

getKrylovSchurLocking(self) Gets the locking flag used in the Krylov-Schur method. |

getKrylovSchurPartitions(self) Gets the number of partitions of the communicator in case of spectrum slicing. |

getKrylovSchurRestart(self) Gets the restart parameter used in the Krylov-Schur method. |

getKrylovSchurSubcommInfo(self) Gets information related to the case of doing spectrum slicing for a computational interval with multiple communicators. |

getKrylovSchurSubcommMats(self) Gets the eigenproblem matrices stored internally in the subcommunicator to which the calling process belongs. |

getKrylovSchurSubcommPairs(self, int i, Vec V) Gets the i-th eigenpair stored internally in the multi-communicator to which the calling process belongs. |

getLanczosReorthogType(self) Gets the type of reorthogonalization used during the Lanczos iteration. |

getOperators(self) Gets the matrices associated with the eigenvalue problem. |

getOptionsPrefix(self) Gets the prefix used for searching for all EPS options in the database. |

getPowerShiftType(self) Gets the type of shifts used during the power iteration. |

getProblemType(self) Gets the problem type from the EPS object. |

getRG(self) Obtain the region object associated to the eigensolver. |

getRQCGReset(self) Gets the reset parameter used in the RQCG method. |

getST(self) Obtain the spectral transformation (ST) object associated to the eigensolver object. |

getTarget(self) Gets the value of the target. |

getTolerances(self) Gets the tolerance and maximum iteration count used by the default EPS convergence tests. |

getTrackAll(self) Returns the flag indicating whether all residual norms must be computed or not. |

getTrueResidual(self) Returns the flag indicating whether true residual must be computed explicitly or not. |

getType(self) Gets the EPS type of this object. |

getWhichEigenpairs(self) Returns which portion of the spectrum is to be sought. |

isGeneralized(self) Tells whether the EPS object corresponds to a generalized eigenvalue problem. |

isHermitian(self) Tells whether the EPS object corresponds to a Hermitian eigenvalue problem. |

isPositive(self) Tells whether the EPS object corresponds to an eigenvalue problem type that requires a positive (semi-) definite matrix B. |

reset(self) Resets the EPS object. |

setArnoldiDelayed(self, delayed) Activates or deactivates delayed reorthogonalization in the Arnoldi iteration. |

setBV(self, BV bv) Associates a basis vectors object to the eigensolver. |

setBalance(self, balance=None, iterations=None, cutoff=None) Specifies the balancing technique to be employed by the eigensolver, and some parameters associated to it. |

setConvergenceTest(self, conv) Specifies how to compute the error estimate used in the convergence test. |

setDS(self, DS ds) Associates a direct solver object to the eigensolver. |

setDeflationSpace(self, space) Add vectors to the basis of the deflation space. |

setDimensions(self, nev=None, ncv=None, mpd=None) Sets the number of eigenvalues to compute and the dimension of the subspace. |

setExtraction(self, extraction) Sets the extraction type used by the EPS object. |

setFromOptions(self) Sets EPS options from the options database. |

setInitialSpace(self, space) Sets the initial space from which the eigensolver starts to iterate. |

setInterval(self, inta, intb) Defines the computational interval for spectrum slicing. |

setKrylovSchurDetectZeros(self, detect) Sets a flag to enforce detection of zeros during the factorizations throughout the spectrum slicing computation. |

setKrylovSchurDimensions(self, nev=None, ncv=None, mpd=None) Sets the dimensions used for each subsolve step in case of doing spectrum slicing for a computational interval. |

setKrylovSchurLocking(self, lock) Choose between locking and non-locking variants of the Krylov-Schur method. |

setKrylovSchurPartitions(self, npart) Sets the number of partitions for the case of doing spectrum slicing for a computational interval with the communicator split in several sub-communicators. |

setKrylovSchurRestart(self, keep) Sets the restart parameter for the Krylov-Schur method, in particular the proportion of basis vectors that must be kept after restart. |

setKrylovSchurSubintervals(self, subint) Sets the subinterval boundaries for spectrum slicing with a computational interval. |

setLanczosReorthogType(self, reorthog) Sets the type of reorthogonalization used during the Lanczos iteration. |

setOperators(self, Mat A, Mat B=None) Sets the matrices associated with the eigenvalue problem. |

setOptionsPrefix(self, prefix) Sets the prefix used for searching for all EPS options in the database. |

setPowerShiftType(self, shift) Sets the type of shifts used during the power iteration. |

setProblemType(self, problem_type) Specifies the type of the eigenvalue problem. |

setRG(self, RG rg) Associates a region object to the eigensolver. |

setRQCGReset(self, nrest) Sets the reset parameter of the RQCG iteration. |

setST(self, ST st) Associates a spectral transformation object to the eigensolver. |

setTarget(self, target) Sets the value of the target. |

setTolerances(self, tol=None, max_it=None) Sets the tolerance and maximum iteration count used by the default EPS convergence tests. |

setTrackAll(self, trackall) Specifies if the solver must compute the residual of all approximate eigenpairs or not. |

setTrueResidual(self, trueres) Specifies if the solver must compute the true residual explicitly or not. |

setType(self, eps_type) Selects the particular solver to be used in the EPS object. |

setUp(self) Sets up all the internal data structures necessary for the execution of the eigensolver. |

setWhichEigenpairs(self, which) Specifies which portion of the spectrum is to be sought. |

solve(self) Solves the eigensystem. |

updateKrylovSchurSubcommMats(self, s=1.0, a=1.0, Mat Au=None, t=1.0, b=1.0, Mat Bu=None, structure=None, globalup=False) Update the eigenproblem matrices stored internally in the subcommunicator to which the calling process belongs. |

view(self, Viewer viewer=None) Prints the EPS data structure. |

Inherited from `petsc4py.PETSc.Object`: `__copy__`, `__deepcopy__`, `__eq__`, `__ge__`, `__gt__`, `__le__`, `__lt__`, `__ne__`, `__nonzero__`, `compose`, `decRef`, `getAttr`, `getClassId`, `getClassName`, `getComm`, `getDict`, `getName`, `getRefCount`, `getTabLevel`, `incRef`, `incrementTabLevel`, `query`, `setAttr`, `setName`, `setTabLevel`, `stateIncrease`

Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__init__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties | [hide private]

| bv
| extraction
| max_it
| problem_type
| st
| target
| tol
| which
Inherited from `petsc4py.PETSc.Object`: `classid`, `comm`, `fortran`, `handle`, `klass`, `name`, `prefix`, `refcount`, `type` Inherited from `object`: `__class__`

Method Details | [hide private]

### __new__(S, ...)

Returns: a new object with type S, a subtype of T
Overrides: object.__new__

### appendOptionsPrefix(self, prefix)

Appends to the prefix used for searching for all EPS options in the database.

# Parameters

prefix: string
  The prefix string to prepend to all EPS option requests.

### computeError(self, int i, etype=None)

Computes the error (based on the residual norm) associated with the i-th computed eigenpair.

# Parameters

i: int
  Index of the solution to be considered.
etype: EPS.ErrorType enumerate
  The error type to compute.

# Returns

e: real
  The error bound, computed in various ways from the residual norm `||Ax-kBx||_2` where `k` is the eigenvalue and `x` is the eigenvector.

# Notes

The index `i` should be a value between `0` and `nconv-1` (see getConverged()).

### create(self, comm=None)

Creates the EPS object.

# Parameters

comm: MPI_Comm, optional
  MPI communicator; if not provided, it defaults to all processes.

### destroy(self)

Destroys the EPS object.

Overrides: petsc4py.PETSc.Object.destroy

### errorView(self, etype=None, Viewer viewer=None)

Displays the errors associated with the computed solution (as well as the eigenvalues).

# Parameters

etype: EPS.ErrorType enumerate, optional
  The error type to compute.
viewer: Viewer, optional.
  Visualization context; if not provided, the standard output is used.

# Notes

By default, this function checks the error of all eigenpairs and prints the eigenvalues if all of them are below the requested tolerance. If the viewer has format `ASCII_INFO_DETAIL` then a table with eigenvalues and corresponding errors is printed.

### getArnoldiDelayed(self)

Gets the type of reorthogonalization used during the Arnoldi iteration.

# Returns

delayed: boolean
  True if delayed reorthogonalization is to be used.

### getBV(self)

Obtain the basis vector objects associated to the eigensolver.

# Returns

bv: BV
  The basis vectors context.

### getBalance(self)

Gets the balancing type used by the EPS object, and the associated parameters.

# Returns

balance: EPS.Balance enumerate
  The balancing method
iterations: integer
  Number of iterations of the balancing algorithm
cutoff: real
  Cutoff value

### getConverged(self)

Gets the number of converged eigenpairs.

# Returns

nconv: int
  Number of converged eigenpairs.

# Notes

This function should be called after solve() has finished.

### getConvergedReason(self)

Gets the reason why the solve() iteration was stopped.

# Returns

reason: EPS.ConvergedReason enumerate
  Negative value indicates diverged, positive value converged.

### getConvergenceTest(self)

Return the method used to compute the error estimate used in the convergence test.

# Returns

conv: EPS.Conv
  The method used to compute the error estimate used in the convergence test.

### getDS(self)

Obtain the direct solver associated to the eigensolver.

# Returns

ds: DS
  The direct solver context.

### getDimensions(self)

Gets the number of eigenvalues to compute and the dimension of the subspace.

# Returns

nev: int
  Number of eigenvalues to compute.
ncv: int
  Maximum dimension of the subspace to be used by the solver.
mpd: int
  Maximum dimension allowed for the projected problem.

### getEigenpair(self, int i, Vec Vr=None, Vec Vi=None)

Gets the i-th solution of the eigenproblem as computed by solve(). The solution consists of both the eigenvalue and the eigenvector.

# Parameters

i: int
  Index of the solution to be obtained.
Vr: Vec
  Placeholder for the returned eigenvector (real part).
Vi: Vec
  Placeholder for the returned eigenvector (imaginary part).

# Returns

e: scalar (possibly complex)
  The computed eigenvalue.

# Notes

The index `i` should be a value between `0` and `nconv-1` (see getConverged()). Eigenpairs are indexed according to the ordering criterion established with setWhichEigenpairs().

### getEigenvalue(self, int i)

Gets the i-th eigenvalue as computed by solve().

# Parameters

i: int
  Index of the solution to be obtained.

# Returns

e: scalar (possibly complex)
  The computed eigenvalue.

# Notes

The index `i` should be a value between `0` and `nconv-1` (see getConverged()). Eigenpairs are indexed according to the ordering criterion established with setWhichEigenpairs().

### getEigenvector(self, int i, Vec Vr, Vec Vi=None)

Gets the i-th eigenvector as computed by solve().

# Parameters

i: int
  Index of the solution to be obtained.
Vr: Vec
  Placeholder for the returned eigenvector (real part).
Vi: Vec, optional
  Placeholder for the returned eigenvector (imaginary part).

# Notes

The index `i` should be a value between `0` and `nconv-1` (see getConverged()). Eigenpairs are indexed according to the ordering criterion established with setWhichEigenpairs().

### getErrorEstimate(self, int i)

Returns the error estimate associated to the i-th computed eigenpair.

# Parameters

i: int
  Index of the solution to be considered.

# Returns

e: real
  Error estimate.

# Notes

This is the error estimate used internally by the eigensolver. The actual error bound can be computed with computeError().

### getExtraction(self)

Gets the extraction type used by the EPS object.

# Returns

extraction: EPS.Extraction enumerate
  The method of extraction.

### getInterval(self)

Gets the computational interval for spectrum slicing.

# Returns

inta: float
  The left end of the interval.
intb: float
  The right end of the interval.

# Notes

If the interval was not set by the user, then zeros are returned.

### getInvariantSubspace(self)

Gets an orthonormal basis of the computed invariant subspace.

# Returns

subspace: list of Vec
  Basis of the invariant subspace.

# Notes

This function should be called after solve() has finished.

The returned vectors span an invariant subspace associated with the computed eigenvalues. An invariant subspace `X` of `A` satisfies ``A x` in `X` for all `x` in `X` (a similar definition applies for generalized eigenproblems).

### getIterationNumber(self)

Gets the current iteration number. If the call to solve() is complete, then it returns the number of iterations carried out by the solution method.

# Returns

its: int
  Iteration number.

### getKrylovSchurDetectZeros(self)

Gets the flag that enforces zero detection in spectrum slicing.

# Returns

detect: bool
  The zero detection flag.

### getKrylovSchurDimensions(self)

Gets the dimensions used for each subsolve step in case of doing spectrum slicing for a computational interval.

# Returns

nev: int
  Number of eigenvalues to compute.
ncv: int
  Maximum dimension of the subspace to be used by the solver.
mpd: int
  Maximum dimension allowed for the projected problem.

### getKrylovSchurLocking(self)

Gets the locking flag used in the Krylov-Schur method.

# Returns

lock: bool
  The locking flag.

### getKrylovSchurPartitions(self)

Gets the number of partitions of the communicator in case of spectrum slicing.

# Returns

npart: int
  The number of partitions.

### getKrylovSchurRestart(self)

Gets the restart parameter used in the Krylov-Schur method.

# Returns

keep: float
  The number of vectors to be kept at restart.

### getKrylovSchurSubcommInfo(self)

Gets information related to the case of doing spectrum slicing for a computational interval with multiple communicators.

# Returns

k: int
  Number of the subinterval for the calling process.
n: int
  Number of eigenvalues found in the k-th subinterval.
v: Vec
  A vector owned by processes in the subcommunicator with dimensions compatible for locally computed eigenvectors.

# Notes

This function is only available for spectrum slicing runs.

The returned Vec should be destroyed by the user.

### getKrylovSchurSubcommMats(self)

Gets the eigenproblem matrices stored internally in the subcommunicator to which the calling process belongs.

# Returns

A: Mat
  The matrix associated with the eigensystem.
B: Mat
  The second matrix in the case of generalized eigenproblems.

# Notes

This is the analog of getOperators(), but returns the matrices distributed differently (in the subcommunicator rather than in the parent communicator).

These matrices should not be modified by the user.

### getKrylovSchurSubcommPairs(self, int i, Vec V)

Gets the i-th eigenpair stored internally in the multi-communicator to which the calling process belongs.

# Parameters

i: int
  Index of the solution to be obtained.
V: Vec
  Placeholder for the returned eigenvector.

# Returns

e: scalar
  The computed eigenvalue.

# Notes

The index `i` should be a value between `0` and `n-1`, where `n` is the number of vectors in the local subinterval, see getKrylovSchurSubcommInfo().

### getLanczosReorthogType(self)

Gets the type of reorthogonalization used during the Lanczos iteration.

# Returns

reorthog: EPS.LanczosReorthogType enumerate
  The type of reorthogonalization.

### getOperators(self)

Gets the matrices associated with the eigenvalue problem.

# Returns

A: Mat
  The matrix associated with the eigensystem.
B: Mat
  The second matrix in the case of generalized eigenproblems.

### getOptionsPrefix(self)

Gets the prefix used for searching for all EPS options in the database.

# Returns

prefix: string
  The prefix string set for this EPS object.

Overrides: petsc4py.PETSc.Object.getOptionsPrefix

### getPowerShiftType(self)

Gets the type of shifts used during the power iteration.

# Returns

shift: EPS.PowerShiftType enumerate
  The type of shift.

### getProblemType(self)

Gets the problem type from the EPS object.

# Returns

problem_type: EPS.ProblemType enumerate
  The problem type that was previously set.

### getRG(self)

Obtain the region object associated to the eigensolver.

# Returns

rg: RG
  The region context.

### getRQCGReset(self)

Gets the reset parameter used in the RQCG method.

# Returns

nrest: integer
  The number of iterations between resets.

### getST(self)

Obtain the spectral transformation (ST) object associated to the eigensolver object.

# Returns

st: ST
  The spectral transformation.

### getTarget(self)

Gets the value of the target.

# Returns

target: float (real or complex)
  The value of the target.

# Notes

If the target was not set by the user, then zero is returned.

### getTolerances(self)

Gets the tolerance and maximum iteration count used by the default EPS convergence tests.

# Returns

tol: float
  The convergence tolerance.
max_it: int
  The maximum number of iterations

### getTrackAll(self)

Returns the flag indicating whether all residual norms must be computed or not.

# Returns

trackall: bool
  Whether the solver compute all residuals or not.

### getTrueResidual(self)

Returns the flag indicating whether true residual must be computed explicitly or not.

# Returns

trueres: bool
  Whether the solver compute all residuals or not.

### getType(self)

Gets the EPS type of this object.

# Returns

type: EPS.Type enumerate
  The solver currently being used.

Overrides: petsc4py.PETSc.Object.getType

### getWhichEigenpairs(self)

Returns which portion of the spectrum is to be sought.

# Returns

which: EPS.Which enumerate
  The portion of the spectrum to be sought by the solver.

### isGeneralized(self)

Tells whether the EPS object corresponds to a generalized eigenvalue problem.

# Returns

flag: boolean
  True if two matrices were set with setOperators().

### isHermitian(self)

Tells whether the EPS object corresponds to a Hermitian eigenvalue problem.

# Returns

flag: boolean
  True if the problem type set with setProblemType() was Hermitian.

### isPositive(self)

Tells whether the EPS object corresponds to an eigenvalue problem type that requires a positive (semi-) definite matrix B.

# Returns

flag: boolean
  True if the problem type set with setProblemType() was positive.

### setArnoldiDelayed(self, delayed)

Activates or deactivates delayed reorthogonalization in the Arnoldi iteration.

# Parameters

delayed: boolean
  True if delayed reorthogonalization is to be used.

# Notes

This call is only relevant if the type was set to EPS.Type.ARNOLDI with setType().

Delayed reorthogonalization is an aggressive optimization for the Arnoldi eigensolver than may provide better scalability, but sometimes makes the solver converge less than the default algorithm.

### setBV(self, BV bv)

Associates a basis vectors object to the eigensolver.

# Parameters

bv: BV
  The basis vectors context.

### setBalance(self, balance=None, iterations=None, cutoff=None)

Specifies the balancing technique to be employed by the eigensolver, and some parameters associated to it.

# Parameters

balance: EPS.Balance enumerate
  The balancing method
iterations: integer
  Number of iterations of the balancing algorithm
cutoff: real
  Cutoff value

### setConvergenceTest(self, conv)

Specifies how to compute the error estimate used in the convergence test.

# Parameters

conv: EPS.Conv
  The method used to compute the error estimate used in the convergence test.

### setDS(self, DS ds)

Associates a direct solver object to the eigensolver.

# Parameters

ds: DS
  The direct solver context.

### setDeflationSpace(self, space)

Add vectors to the basis of the deflation space.

# Parameters

space: a Vec or an array of Vec
  Set of basis vectors to be added to the deflation space.

# Notes

When a deflation space is given, the eigensolver seeks the eigensolution in the restriction of the problem to the orthogonal complement of this space. This can be used for instance in the case that an invariant subspace is known beforehand (such as the nullspace of the matrix).

The vectors do not need to be mutually orthonormal, since they are explicitly orthonormalized internally.

These vectors do not persist from one solve() call to the other, so the deflation space should be set every time.

### setDimensions(self, nev=None, ncv=None, mpd=None)

Sets the number of eigenvalues to compute and the dimension of the subspace.

# Parameters

nev: int, optional
  Number of eigenvalues to compute.
ncv: int, optional
  Maximum dimension of the subspace to be used by the solver.
mpd: int, optional
  Maximum dimension allowed for the projected problem.

# Notes

Use DECIDE for `ncv` and `mpd` to assign a reasonably good value, which is dependent on the solution method.

The parameters `ncv` and `mpd` are intimately related, so that the user is advised to set one of them at most. Normal usage is the following:

- In cases where `nev` is small, the user sets `ncv` (a reasonable default is 2 * `nev`).
- In cases where `nev` is large, the user sets `mpd`.

The value of `ncv` should always be between `nev` and (`nev` + `mpd`), typically `ncv` = `nev` + `mpd`. If `nev` is not too large, `mpd` = `nev` is a reasonable choice, otherwise a smaller value should be used.

### setExtraction(self, extraction)

Sets the extraction type used by the EPS object.

# Parameters

extraction: EPS.Extraction enumerate
  The extraction method to be used by the solver.

# Notes

Not all eigensolvers support all types of extraction. See the SLEPc documentation for details.

By default, a standard Rayleigh-Ritz extraction is used. Other extractions may be useful when computing interior eigenvalues.

Harmonic-type extractions are used in combination with a target. See setTarget().

### setFromOptions(self)

Sets EPS options from the options database. This routine must be called before setUp() if the user is to be allowed to set the solver type.

# Notes

To see all options, run your program with the `-help` option.

Overrides: petsc4py.PETSc.Object.setFromOptions

### setInitialSpace(self, space)

Sets the initial space from which the eigensolver starts to iterate.

# Parameters

space: Vec or sequence of Vec
  The initial space

# Notes

Some solvers start to iterate on a single vector (initial vector). In that case, the other vectors are ignored.

In contrast to setDeflationSpace(), these vectors do not persist from one solve() call to the other, so the initial space should be set every time.

The vectors do not need to be mutually orthonormal, since they are explicitly orthonormalized internally.

Common usage of this function is when the user can provide a rough approximation of the wanted eigenspace. Then, convergence may be faster.

### setInterval(self, inta, intb)

Defines the computational interval for spectrum slicing.

# Parameters

inta: float
  The left end of the interval.
intb: float
  The right end of the interval.

# Notes

Spectrum slicing is a technique employed for computing all eigenvalues of symmetric eigenproblems in a given interval. This function provides the interval to be considered. It must be used in combination with EPS.Which.ALL, see setWhichEigenpairs().

### setKrylovSchurDetectZeros(self, detect)

Sets a flag to enforce detection of zeros during the factorizations throughout the spectrum slicing computation.

# Parameters

detect: bool
  True if zeros must checked for.

# Notes

A zero in the factorization indicates that a shift coincides with an eigenvalue.

This flag is turned off by default, and may be necessary in some cases, especially when several partitions are being used. This feature currently requires an external package for factorizations with support for zero detection, e.g. MUMPS.

### setKrylovSchurDimensions(self, nev=None, ncv=None, mpd=None)

Sets the dimensions used for each subsolve step in case of doing spectrum slicing for a computational interval. The meaning of the parameters is the same as in setDimensions().

# Parameters

nev: int, optional
  Number of eigenvalues to compute.
ncv: int, optional
  Maximum dimension of the subspace to be used by the solver.
mpd: int, optional
  Maximum dimension allowed for the projected problem.

### setKrylovSchurLocking(self, lock)

Choose between locking and non-locking variants of the Krylov-Schur method.

# Parameters

lock: bool
  True if the locking variant must be selected.

# Notes

The default is to lock converged eigenpairs when the method restarts. This behaviour can be changed so that all directions are kept in the working subspace even if already converged to working accuracy (the non-locking variant).

### setKrylovSchurPartitions(self, npart)

Sets the number of partitions for the case of doing spectrum slicing for a computational interval with the communicator split in several sub-communicators.

# Parameters

npart: int
  The number of partitions.

# Notes

By default, npart=1 so all processes in the communicator participate in the processing of the whole interval. If npart>1 then the interval is divided into npart subintervals, each of them being processed by a subset of processes.

### setKrylovSchurRestart(self, keep)

Sets the restart parameter for the Krylov-Schur method, in particular the proportion of basis vectors that must be kept after restart.

# Parameters

keep: float
  The number of vectors to be kept at restart.

# Notes

Allowed values are in the range [0.1,0.9]. The default is 0.5.

### setKrylovSchurSubintervals(self, subint)

Sets the subinterval boundaries for spectrum slicing with a computational interval.

# Parameters

subint: list of real values specifying subintervals

# Notes

Logically Collective on EPS This function must be called after setKrylovSchurPartitions(). For npart partitions, the argument subint must contain npart+1 real values sorted in ascending order: subint_0, subint_1, ..., subint_npart, where the first and last values must coincide with the interval endpoints set with EPSSetInterval(). The subintervals are then defined by two consecutive points: [subint_0,subint_1], [subint_1,subint_2], and so on.

### setLanczosReorthogType(self, reorthog)

Sets the type of reorthogonalization used during the Lanczos iteration.

# Parameters

reorthog: EPS.LanczosReorthogType enumerate
  The type of reorthogonalization.

# Notes

This call is only relevant if the type was set to EPS.Type.LANCZOS with setType().

### setOperators(self, Mat A, Mat B=None)

Sets the matrices associated with the eigenvalue problem.

# Parameters

A: Mat
  The matrix associated with the eigensystem.
B: Mat, optional
  The second matrix in the case of generalized eigenproblems; if not provided, a standard eigenproblem is assumed.

### setOptionsPrefix(self, prefix)

Sets the prefix used for searching for all EPS options in the database.

# Parameters

prefix: string
  The prefix string to prepend to all EPS option requests.

# Notes

A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen.

For example, to distinguish between the runtime options for two different EPS contexts, one could call:

    E1.setOptionsPrefix("eig1_")
    E2.setOptionsPrefix("eig2_")

Overrides: petsc4py.PETSc.Object.setOptionsPrefix

### setPowerShiftType(self, shift)

Sets the type of shifts used during the power iteration. This can be used to emulate the Rayleigh Quotient Iteration (RQI) method.

# Parameters

shift: EPS.PowerShiftType enumerate
  The type of shift.

# Notes

This call is only relevant if the type was set to EPS.Type.POWER with setType().

By default, shifts are constant (EPS.PowerShiftType.CONSTANT) and the iteration is the simple power method (or inverse iteration if a shift-and-invert transformation is being used).

A variable shift can be specified (EPS.PowerShiftType.RAYLEIGH or EPS.PowerShiftType.WILKINSON). In this case, the iteration behaves rather like a cubic converging method as RQI.

### setProblemType(self, problem_type)

Specifies the type of the eigenvalue problem.

# Parameters

problem_type: EPS.ProblemType enumerate
  The problem type to be set.

# Notes

Allowed values are: Hermitian (HEP), non-Hermitian (NHEP), generalized Hermitian (GHEP), generalized non-Hermitian (GNHEP), and generalized non-Hermitian with positive semi-definite B (PGNHEP).

This function must be used to instruct SLEPc to exploit symmetry. If no problem type is specified, by default a non-Hermitian problem is assumed (either standard or generalized). If the user knows that the problem is Hermitian (i.e. `A=A^H`) or generalized Hermitian (i.e. `A=A^H`, `B=B^H`, and `B` positive definite) then it is recommended to set the problem type so that eigensolver can exploit these properties.

### setRG(self, RG rg)

Associates a region object to the eigensolver.

# Parameters

rg: RG
  The region context.

### setRQCGReset(self, nrest)

Sets the reset parameter of the RQCG iteration. Every nrest iterations, the solver performs a Rayleigh-Ritz projection step.

# Parameters

nrest: integer
  The number of iterations between resets.

### setST(self, ST st)

Associates a spectral transformation object to the eigensolver.

# Parameters

st: ST
  The spectral transformation.

### setTarget(self, target)

Sets the value of the target.

# Parameters

target: float (real or complex)
  The value of the target.

# Notes

The target is a scalar value used to determine the portion of the spectrum of interest. It is used in combination with setWhichEigenpairs().

### setTolerances(self, tol=None, max_it=None)

Sets the tolerance and maximum iteration count used by the default EPS convergence tests.

# Parameters

tol: float, optional
  The convergence tolerance.
max_it: int, optional
  The maximum number of iterations

# Notes

Use DECIDE for maxits to assign a reasonably good value, which is dependent on the solution method.

### setTrackAll(self, trackall)

Specifies if the solver must compute the residual of all approximate eigenpairs or not.

# Parameters

trackall: bool
  Whether compute all residuals or not.

### setTrueResidual(self, trueres)

Specifies if the solver must compute the true residual explicitly or not.

# Parameters

trueres: bool
  Whether compute the true residual or not.

### setType(self, eps_type)

Selects the particular solver to be used in the EPS object.

# Parameters

eps_type: EPS.Type enumerate
  The solver to be used.

# Notes

See EPS.Type for available methods. The default is EPS.Type.KRYLOVSCHUR. Normally, it is best to use setFromOptions() and then set the EPS type from the options database rather than by using this routine. Using the options database provides the user with maximum flexibility in evaluating the different available methods.

### setUp(self)

Sets up all the internal data structures necessary for the execution of the eigensolver.

# Notes

This function need not be called explicitly in most cases, since solve() calls it. It can be useful when one wants to measure the set-up time separately from the solve time.

### setWhichEigenpairs(self, which)

Specifies which portion of the spectrum is to be sought.

# Parameters

which: EPS.Which enumerate
  The portion of the spectrum to be sought by the solver.

# Notes

Not all eigensolvers implemented in EPS account for all the possible values. Also, some values make sense only for certain types of problems. If SLEPc is compiled for real numbers EPS.Which.LARGEST_IMAGINARY and EPS.Which.SMALLEST_IMAGINARY use the absolute value of the imaginary part for eigenvalue selection.

### updateKrylovSchurSubcommMats(self, s=1.0, a=1.0, Mat Au=None, t=1.0, b=1.0, Mat Bu=None, structure=None, globalup=False)

Update the eigenproblem matrices stored internally in the subcommunicator to which the calling process belongs.

# Parameters

s: float (real or complex)
  Scalar that multiplies the existing A matrix.
a: float (real or complex)
  Scalar used in the axpy operation on A.
Au: Mat, optional
  The matrix used in the axpy operation on A.
t: float (real or complex)
  Scalar that multiplies the existing B matrix.
b: float (real or complex)
  Scalar used in the axpy operation on B.
Bu: Mat, optional
  The matrix used in the axpy operation on B.
structure: `PETSc.Mat.Structure` enumerate
  Either same, different, or a subset of the non-zero sparsity pattern.
globalup: bool
  Whether global matrices must be updated or not.

# Notes

This function modifies the eigenproblem matrices at subcommunicator level, and optionally updates the global matrices in the parent communicator. The updates are expressed as `A <-- s*A + a*Au`, `B <-- t*B + b*Bu`.

It is possible to update one of the matrices, or both.

The matrices `Au` and `Bu` must be equal in all subcommunicators.

The `str` flag is passed to the `Mat.axpy()` operations to perform the updates.

If `globalup` is True, communication is carried out to reconstruct the updated matrices in the parent communicator.

### view(self, Viewer viewer=None)

Prints the EPS data structure.

# Parameters

viewer: Viewer, optional.
  Visualization context; if not provided, the standard output is used.

Overrides: petsc4py.PETSc.Object.view