Package slepc4py :: Module SLEPc :: Class NEP
[hide private]
[frames] | no frames]

Class NEP



NEP

Nested Classes [hide private]
  ConvergedReason
  ErrorType
NEP error type to assess accuracy of computed solutions
  Refine
NEP refinement strategy
  RefineScheme
Scheme for solving linear systems during iterative refinement
  Type
NEP type
  Which
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 NEP options in the database.
 
cancelMonitor(self)
Clears all monitors for a NEP 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 NEP object.
 
destroy(self)
Destroys the NEP object.
 
errorView(self, etype=None, Viewer viewer=None)
Displays the errors associated with the computed solution (as well as the eigenvalues).
 
getBV(self)
Obtain the basis vectors object associated to the eigensolver.
 
getConverged(self)
Gets the number of converged eigenpairs.
 
getConvergedReason(self)
Gets the reason why the `solve()` iteration was stopped.
 
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()`.
 
getErrorEstimate(self, int i)
Returns the error estimate associated to the i-th computed eigenpair.
 
getIterationNumber(self)
Gets the current iteration number.
 
getLeftEigenvector(self, int i, Vec Wr, Vec Wi=None)
Gets the i-th left eigenvector as computed by `solve()`.
 
getOptionsPrefix(self)
Gets the prefix used for searching for all NEP options in the database.
 
getRG(self)
Obtain the region object associated to the eigensolver.
 
getRIILagPreconditioner(self)
Indicates how often the preconditioner is rebuilt.
 
getTolerances(self)
Gets the tolerance and maximum iteration count used by the default NEP convergence tests.
 
getTrackAll(self)
Returns the flag indicating whether all residual norms must be computed or not.
 
getTwoSided(self)
Returns the flag indicating whether a two-sided variant of the algorithm is being used or not.
 
getType(self)
Gets the NEP type of this object.
 
getWhichEigenpairs(self)
Returns which portion of the spectrum is to be sought.
 
reset(self)
Resets the NEP object.
 
setBV(self, BV bv)
Associates a basis vectors object to the eigensolver.
 
setDimensions(self, nev=None, ncv=None, mpd=None)
Sets the number of eigenvalues to compute and the dimension of the subspace.
 
setFromOptions(self)
Sets NEP options from the options database.
 
setFunction(self, function, Mat F, Mat P=None, args=None, kargs=None)
Sets the function to compute the nonlinear Function T(lambda) as well as the location to store the matrix.
 
setInitialSpace(self, space)
Sets the initial space from which the eigensolver starts to iterate.
 
setJacobian(self, jacobian, Mat J, args=None, kargs=None)
Sets the function to compute Jacobian T'(lambda) as well as the location to store the matrix.
 
setOptionsPrefix(self, prefix)
Sets the prefix used for searching for all NEP options in the database.
 
setRG(self, RG rg)
Associates a region object to the eigensolver.
 
setRIILagPreconditioner(self, lag)
Determines when the preconditioner is rebuilt in the nonlinear solve.
 
setSplitOperator(self, A, f, structure=None)
Sets the operator of the nonlinear eigenvalue problem in split form.
 
setTolerances(self, tol=None, maxit=None)
Sets the tolerance and maximum iteration count used in convergence tests.
 
setTrackAll(self, trackall)
Specifies if the solver must compute the residual of all approximate eigenpairs or not.
 
setTwoSided(self, twosided)
Sets the solver to use a two-sided variant so that left eigenvectors are also computed.
 
setType(self, nep_type)
Selects the particular solver to be used in the NEP 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.
 
view(self, Viewer viewer=None)
Prints the NEP 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, viewFromOptions

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

Properties [hide private]

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 NEP options
in the database.

Parameters
----------
prefix: string
    The prefix string to prepend to all NEP 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: `NEP.ErrorType` enumerate
    The error type to compute.

Returns
-------
error: real
    The error bound, computed in various ways from the residual norm
    ``||T(lambda)x||_2`` where ``lambda`` is the eigenvalue and
    ``x`` is the eigenvector.

create(self, comm=None)

 
Creates the NEP object.

Parameters
----------
comm: Comm, optional.
    MPI communicator. If not provided, it defaults to all
    processes.

destroy(self)

 
Destroys the NEP 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: `NEP.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.

getBV(self)

 
Obtain the basis vectors object associated to the eigensolver.

Returns
-------
bv: BV
    The basis vectors context.

getConverged(self)

 
Gets the number of converged eigenpairs.

Returns
-------
nconv: int
    Number of converged eigenpairs.

getConvergedReason(self)

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

Returns
-------
reason: `NEP.ConvergedReason` enumerate
    Negative value indicates diverged, positive value
    converged.

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, optional
    Placeholder for the returned eigenvector (real part).
Vi: Vec, optional
    Placeholder for the returned eigenvector (imaginary part).

Returns
-------
e: scalar (possibly complex)
    The computed eigenvalue.

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
-------
error: real
    Error estimate.

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.

getLeftEigenvector(self, int i, Vec Wr, Vec Wi=None)

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

Parameters
----------
i: int
   Index of the solution to be obtained.
Wr: Vec
    Placeholder for the returned eigenvector (real part).
Wi: Vec, optional
    Placeholder for the returned eigenvector (imaginary part).

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

Left eigenvectors are available only if the twosided flag was set
with `setTwoSided()`.

getOptionsPrefix(self)

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

Returns
-------
prefix: string
    The prefix string set for this NEP object.

Overrides: petsc4py.PETSc.Object.getOptionsPrefix

getRG(self)

 
Obtain the region object associated to the eigensolver.

Returns
-------
rg: RG
    The region context.

getRIILagPreconditioner(self)

 
Indicates how often the preconditioner is rebuilt.

Returns
-------
lag: int
    The lag parameter.

getTolerances(self)

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

Returns
-------
tol: float
    The convergence tolerance.
maxit: 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.

getTwoSided(self)

 
Returns the flag indicating whether a two-sided variant
of the algorithm is being used or not.

Returns
-------
twosided: bool
    Whether the two-sided variant is to be used or not.

getType(self)

 
Gets the NEP type of this object.

Returns
-------
type: `NEP.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: `NEP.Which` enumerate
    The portion of the spectrum to be sought by the solver.

setBV(self, BV bv)

 
Associates a basis vectors object to the eigensolver.

Parameters
----------
bv: BV
    The basis vectors context.

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.

setFromOptions(self)

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

Overrides: petsc4py.PETSc.Object.setFromOptions

setFunction(self, function, Mat F, Mat P=None, args=None, kargs=None)

 
Sets the function to compute the nonlinear Function T(lambda)
as well as the location to store the matrix.

Parameters
----------
function:
    Function evaluation routine
F: Mat
    Function matrix
P: Mat
    preconditioner matrix (usually same as the Function)

setInitialSpace(self, space)

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

Parameters
----------
space: Vec or sequence of Vec
   The initial space

setJacobian(self, jacobian, Mat J, args=None, kargs=None)

 
Sets the function to compute Jacobian T'(lambda) as well
as the location to store the matrix.

Parameters
----------
jacobian:
    Jacobian evaluation routine
J: Mat
    Jacobian matrix

setOptionsPrefix(self, prefix)

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

Parameters
----------
prefix: string
    The prefix string to prepend to all NEP option requests.

Overrides: petsc4py.PETSc.Object.setOptionsPrefix

setRG(self, RG rg)

 
Associates a region object to the eigensolver.

Parameters
----------
rg: RG
    The region context.

setRIILagPreconditioner(self, lag)

 
Determines when the preconditioner is rebuilt in the
nonlinear solve.

Parameters
----------
lag: int
    0 indicates NEVER rebuild, 1 means rebuild every time the Jacobian is
    computed within the nonlinear iteration, 2 means every second time
    the Jacobian is built, etc.

setSplitOperator(self, A, f, structure=None)

 
Sets the operator of the nonlinear eigenvalue problem
in split form.

Parameters
----------
A: Mat or sequence of Mat
    Coefficient matrices of the split form.
f: sequence of FN
    Scalar functions of the split form.
structure: `PETSc.Mat.Structure` enumerate, optional
    Structure flag for matrices.

setTolerances(self, tol=None, maxit=None)

 
Sets the tolerance and maximum iteration count used in convergence tests.

Parameters
----------
tol: float, optional
    The convergence tolerance.
maxit: int, optional
    The maximum number of iterations.

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.

setTwoSided(self, twosided)

 
Sets the solver to use a two-sided variant so that left
eigenvectors are also computed.

Parameters
----------
twosided: bool
    Whether the two-sided variant is to be used or not.

setType(self, nep_type)

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

Parameters
----------
nep_type: `NEP.Type` enumerate
    The solver to be used.

setWhichEigenpairs(self, which)

 
Specifies which portion of the spectrum is to be sought.

Parameters
----------
which: `NEP.Which` enumerate
    The portion of the spectrum to be sought by the solver.

view(self, Viewer viewer=None)

 
Prints the NEP data structure.

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

Overrides: petsc4py.PETSc.Object.view