slepc4py.SLEPc.MFN#
- class slepc4py.SLEPc.MFN#
Bases:
ObjectMatrix Function.
Matrix Function (
MFN) is the object provided by slepc4py for computing the action of a matrix function on a vector. Given a matrix \(A\) and a vector \(b\), the callmfn.solve(b,x)computes \(x=f(A)b\), where \(f\) is a function such as the exponential.Enumerations
MFN convergence reasons.
MFN type.
Methods Summary
appendOptionsPrefix([prefix])Append to the prefix used for searching for all MFN options in the database.
Clear all monitors for an
MFNobject.create([comm])Create the MFN object.
destroy()Destroy the MFN object.
getBV()Get the basis vector object associated to the MFN object.
Get the reason why the
solve()iteration was stopped.Get the dimension of the subspace used by the solver.
Get if
solve()generates an error if the solver does not converge.getFN()Get the math function object associated to the MFN object.
Get the current iteration number.
Get the list of monitor functions.
Get the matrix associated with the MFN object.
Get the prefix used for searching for all MFN options in the database.
Get the tolerance and maximum iteration count.
getType()Get the MFN type of this object.
reset()Reset the MFN object.
setBV(bv)Set a basis vector object associated to the MFN object.
setDimensions(ncv)Set the dimension of the subspace to be used by the solver.
setErrorIfNotConverged([flg])Set
solve()to generate an error if the solver does not converge.setFN(fn)Set a math function object associated to the MFN object.
Set MFN options from the options database.
setMonitor(monitor[, args, kargs])Append a monitor function to the list of monitors.
setOperator(A)Set the matrix associated with the MFN object.
setOptionsPrefix([prefix])Set the prefix used for searching for all MFN options in the database.
setTolerances([tol, max_it])Set the tolerance and maximum iteration count.
setType(mfn_type)Set the particular solver to be used in the MFN object.
setUp()Set up all the necessary internal data structures.
solve(b, x)Solve the matrix function problem.
solveTranspose(b, x)Solve the transpose matrix function problem.
view([viewer])Print the MFN data structure.
Attributes Summary
The basis vectors (
BV) object associated to the MFN object.The math function (
FN) object associated to the MFN object.The maximum iteration count used by the MFN convergence tests.
The tolerance count used by the MFN convergence tests.
Methods Documentation
- appendOptionsPrefix(prefix=None)#
Append to the prefix used for searching for all MFN options in the database.
Logically collective.
- Parameters:
prefix (str | None) – The prefix string to prepend to all MFN option requests.
- Return type:
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:219 <slepc4py/SLEPc/MFN.pyx#L219>`
- cancelMonitor()#
Clear all monitors for an
MFNobject.Logically collective.
See also
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:498 <slepc4py/SLEPc/MFN.pyx#L498>`
- Return type:
- create(comm=None)#
Create the MFN object.
Collective.
- Parameters:
comm (Comm | None) – MPI communicator. If not provided, it defaults to all processes.
- Return type:
See also
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:102 <slepc4py/SLEPc/MFN.pyx#L102>`
- destroy()#
Destroy the MFN object.
Logically collective.
See also
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:76 <slepc4py/SLEPc/MFN.pyx#L76>`
- Return type:
- getBV()#
Get the basis vector object associated to the MFN object.
Not collective.
- Returns:
The basis vectors context.
- Return type:
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:379 <slepc4py/SLEPc/MFN.pyx#L379>`
- getConvergedReason()#
Get the reason why the
solve()iteration was stopped.Not collective.
- Returns:
Negative value indicates diverged, positive value converged.
- Return type:
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:607 <slepc4py/SLEPc/MFN.pyx#L607>`
- getDimensions()#
Get the dimension of the subspace used by the solver.
Not collective.
- Returns:
Maximum dimension of the subspace to be used by the solver.
- Return type:
See also
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:305 <slepc4py/SLEPc/MFN.pyx#L305>`
- getErrorIfNotConverged()#
Get if
solve()generates an error if the solver does not converge.Not collective.
Get a flag indicating whether
solve()will generate an error if the solver does not converge.- Returns:
Trueindicates you want the error generated.- Return type:
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:650 <slepc4py/SLEPc/MFN.pyx#L650>`
- getFN()#
Get the math function object associated to the MFN object.
Not collective.
- Returns:
The math function context.
- Return type:
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:342 <slepc4py/SLEPc/MFN.pyx#L342>`
- getIterationNumber()#
Get the current iteration number.
Not collective.
Get 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:
Iteration number.
- Return type:
See also
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:584 <slepc4py/SLEPc/MFN.pyx#L584>`
- getMonitor()#
Get the list of monitor functions.
Not collective.
- Returns:
The list of monitor functions.
- Return type:
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:485 <slepc4py/SLEPc/MFN.pyx#L485>`
- getOperator()#
Get the matrix associated with the MFN object.
Collective.
- Returns:
The matrix for which the matrix function is to be computed.
- Return type:
See also
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:416 <slepc4py/SLEPc/MFN.pyx#L416>`
- getOptionsPrefix()#
Get the prefix used for searching for all MFN options in the database.
Not collective.
- Returns:
The prefix string set for this MFN object.
- Return type:
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:169 <slepc4py/SLEPc/MFN.pyx#L169>`
- getTolerances()#
Get the tolerance and maximum iteration count.
Not collective.
- Returns:
- Return type:
See also
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:257 <slepc4py/SLEPc/MFN.pyx#L257>`
- getType()#
Get the MFN type of this object.
Not collective.
- Returns:
The solver currently being used.
- Return type:
See also
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:150 <slepc4py/SLEPc/MFN.pyx#L150>`
- reset()#
Reset the MFN object.
Collective.
See also
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:90 <slepc4py/SLEPc/MFN.pyx#L90>`
- Return type:
- setBV(bv)#
Set a basis vector object associated to the MFN object.
Collective.
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:399 <slepc4py/SLEPc/MFN.pyx#L399>`
- setDimensions(ncv)#
Set the dimension of the subspace to be used by the solver.
Logically collective.
- Parameters:
ncv (int) – Maximum dimension of the subspace to be used by the solver.
- Return type:
See also
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:324 <slepc4py/SLEPc/MFN.pyx#L324>`
- setErrorIfNotConverged(flg=True)#
Set
solve()to generate an error if the solver does not converge.Logically collective.
Notes
Normally SLEPc continues if the solver fails to converge, you can call
getConvergedReason()after asolve()to determine if it has converged.See also
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:626 <slepc4py/SLEPc/MFN.pyx#L626>`
- setFN(fn)#
Set a math function object associated to the MFN object.
Collective.
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:362 <slepc4py/SLEPc/MFN.pyx#L362>`
- setFromOptions()#
Set MFN options from the options database.
Collective.
Notes
To see all options, run your program with the
-helpoption.This routine must be called before
setUp()if the user is to be allowed to set the solver type.See also
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:238 <slepc4py/SLEPc/MFN.pyx#L238>`
- Return type:
- setMonitor(monitor, args=None, kargs=None)#
Append a monitor function to the list of monitors.
Logically collective.
See also
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:460 <slepc4py/SLEPc/MFN.pyx#L460>`
- setOperator(A)#
Set the matrix associated with the MFN object.
Collective.
Notes
This must be called before
setUp(). If called again aftersetUp()then theMFNobject is reset.See also
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:436 <slepc4py/SLEPc/MFN.pyx#L436>`
- setOptionsPrefix(prefix=None)#
Set the prefix used for searching for all MFN options in the database.
Logically collective.
- Parameters:
prefix (str | None) – The prefix string to prepend to all MFN option requests.
- Return type:
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 MFN contexts, one could call:
M1.setOptionsPrefix("mfn1_") M2.setOptionsPrefix("mfn2_")
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:188 <slepc4py/SLEPc/MFN.pyx#L188>`
- setTolerances(tol=None, max_it=None)#
Set the tolerance and maximum iteration count.
Logically collective.
Set the tolerance and maximum iteration count used by the default MFN convergence tests.
- Parameters:
- Return type:
See also
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:279 <slepc4py/SLEPc/MFN.pyx#L279>`
- setType(mfn_type)#
Set the particular solver to be used in the MFN object.
Logically collective.
Notes
The default is
KRYLOV. Normally, it is best to usesetFromOptions()and then set the MFN 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.See also
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:123 <slepc4py/SLEPc/MFN.pyx#L123>`
- setUp()#
Set up all the necessary internal data structures.
Collective.
Set up all the internal data structures necessary for the execution of the eigensolver.
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:513 <slepc4py/SLEPc/MFN.pyx#L513>`
- Return type:
- solve(b, x)#
Solve the matrix function problem.
Collective.
Given a vector \(b\), the vector \(x = f(A) b\) is returned.
Notes
The matrix \(A\) is specified with
setOperator(). The function \(f\) is specified via theFNobject obtained withgetFN()or set withsetFN().See also
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:528 <slepc4py/SLEPc/MFN.pyx#L528>`
- solveTranspose(b, x)#
Solve the transpose matrix function problem.
Collective.
Given a vector \(b\), the vector \(x = f(A^T) b\) is returned.
Notes
The matrix \(A\) is specified with
setOperator(). The function \(f\) is specified via theFNobject obtained withgetFN()or set withsetFN().See also
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:556 <slepc4py/SLEPc/MFN.pyx#L556>`
- view(viewer=None)#
Print the MFN data structure.
Collective.
- Parameters:
viewer (Viewer | None) – Visualization context; if not provided, the standard output is used.
- Return type:
See also
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:57 <slepc4py/SLEPc/MFN.pyx#L57>`
Attributes Documentation
- bv#
The basis vectors (
BV) object associated to the MFN object.:sources:`Source code at slepc4py/SLEPc/MFN.pyx:695 <slepc4py/SLEPc/MFN.pyx#L695>`
- fn#
The math function (
FN) object associated to the MFN object.:sources:`Source code at slepc4py/SLEPc/MFN.pyx:688 <slepc4py/SLEPc/MFN.pyx#L688>`
- max_it#
The maximum iteration count used by the MFN convergence tests.
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:681 <slepc4py/SLEPc/MFN.pyx#L681>`
- tol#
The tolerance count used by the MFN convergence tests.
:sources:`Source code at slepc4py/SLEPc/MFN.pyx:674 <slepc4py/SLEPc/MFN.pyx#L674>`