slepc4py.SLEPc.FN#
- class slepc4py.SLEPc.FN#
Bases:
ObjectMathematical Function.
The
FNpackage provides the functionality to represent a simple mathematical function such as an exponential, a polynomial or a rational function. This is used as a building block for defining the function associated to the nonlinear eigenproblem, as well as for specifying which function to use when computing the action of a matrix function on a vector.Enumerations
FN type of combination of child functions.
FN parallel types.
FN type.
Methods Summary
appendOptionsPrefix([prefix])Append to the prefix used for searching for all FN options in the database.
create([comm])Create the FN object.
destroy()Destroy the FN object.
duplicate([comm])Duplicate the FN object copying all parameters.
Compute the value of the derivative \(f'(x)\) for a given x.
Compute the value of the function \(f(x)\) for a given x.
evaluateFunctionMat(A[, B])Compute the value of the function \(f(A)\) for a given matrix A.
evaluateFunctionMatVec(A[, v])Compute the first column of the matrix \(f(A)\).
Get the two child functions that constitute this combined function.
Get the method currently used for matrix functions.
Get the prefix used for searching for all FN options in the database.
Get the mode of operation in parallel runs.
Get the index of the phi-function.
Get the coefficients of the denominator of the rational function.
Get the coefficients of the numerator of the rational function.
getScale()Get the scaling parameters that define the matematical function.
getType()Get the FN type of this object.
setCombineChildren(comb, f1, f2)Set the two child functions that constitute this combined function.
Set FN options from the options database.
setMethod(meth)Set the method to be used to evaluate functions of matrices.
setOptionsPrefix([prefix])Set the prefix used for searching for all FN options in the database.
setParallel(pmode)Set the mode of operation in parallel runs.
setPhiIndex(k)Set the index of the phi-function.
setRationalDenominator(alpha)Set the coefficients of the denominator of the rational function.
setRationalNumerator(alpha)Set the coefficients of the numerator of the rational function.
setScale([alpha, beta])Set the scaling parameters that define the matematical function.
setType(fn_type)Set the type for the FN object.
view([viewer])Print the FN data structure.
Attributes Summary
The method to be used to evaluate functions of matrices.
The mode of operation in parallel runs.
Methods Documentation
- appendOptionsPrefix(prefix=None)#
Append to the prefix used for searching for all FN options in the database.
Logically collective.
- create(comm=None)#
Create the FN object.
Collective.
- Parameters:
comm (Comm | None) – MPI communicator; if not provided, it defaults to all processes.
- Return type:
See also
- destroy()#
Destroy the FN object.
Collective.
See also
Source code at slepc4py/SLEPc/FN.pyx:168
- Return type:
- duplicate(comm=None)#
Duplicate the FN object copying all parameters.
Collective.
Duplicate the FN object copying all parameters, possibly with a different communicator.
- Parameters:
comm (Comm | None) – MPI communicator; if not provided, it defaults to the object’s communicator.
- Returns:
The new object.
- Return type:
See also
- evaluateDerivative(x)#
Compute the value of the derivative \(f'(x)\) for a given x.
Not collective.
- Parameters:
x (Scalar) – Value where the derivative must be evaluated.
- Returns:
The result of \(f'(x)\).
- Return type:
Notes
Scaling factors are taken into account, so the actual derivative evaluation will return \(ab f'(a x)\).
See also
- evaluateFunction(x)#
Compute the value of the function \(f(x)\) for a given x.
Not collective.
- Parameters:
x (Scalar) – Value where the function must be evaluated.
- Returns:
The result of \(f(x)\).
- Return type:
Notes
Scaling factors are taken into account, so the actual function evaluation will return \(b f(a x)\).
- evaluateFunctionMat(A, B=None)#
Compute the value of the function \(f(A)\) for a given matrix A.
Logically collective.
- Parameters:
- Returns:
The result of \(f(A)\).
- Return type:
Notes
Scaling factors are taken into account, so the actual function evaluation will return \(b f(a A)\).
- evaluateFunctionMatVec(A, v=None)#
Compute the first column of the matrix \(f(A)\).
Logically collective.
- Parameters:
- Returns:
The first column of the result \(f(A)\).
- Return type:
Notes
This operation is similar to
evaluateFunctionMat()but returns only the first column of \(f(A)\), hence saving computations in most cases.See also
- getCombineChildren()#
Get the two child functions that constitute this combined function.
Not collective.
Get the two child functions that constitute this combined function, and the way they must be combined.
- Returns:
comb (
CombineType) – How to combine the functions (addition, multiplication, division, composition).f1 (
FN) – First function.f2 (
FN) – Second function.
- Return type:
tuple[CombineType, FN, FN]
See also
- getMethod()#
Get the method currently used for matrix functions.
Not collective.
- Returns:
An index identifying the method.
- Return type:
See also
- getOptionsPrefix()#
Get the prefix used for searching for all FN options in the database.
Not collective.
- Returns:
The prefix string set for this FN object.
- Return type:
- getParallel()#
Get the mode of operation in parallel runs.
Not collective.
- Returns:
The parallel mode.
- Return type:
See also
- getPhiIndex()#
Get the index of the phi-function.
Not collective.
- Returns:
The index.
- Return type:
See also
- getRationalDenominator()#
Get the coefficients of the denominator of the rational function.
Not collective.
- Returns:
Coefficients.
- Return type:
- getRationalNumerator()#
Get the coefficients of the numerator of the rational function.
Not collective.
- Returns:
Coefficients.
- Return type:
See also
- getScale()#
Get the scaling parameters that define the matematical function.
Not collective.
- Returns:
- Return type:
See also
- getType()#
Get the FN type of this object.
Not collective.
- Returns:
The math function type currently being used.
- Return type:
- setCombineChildren(comb, f1, f2)#
Set the two child functions that constitute this combined function.
Logically collective.
Set the two child functions that constitute this combined function, and the way they must be combined.
- Parameters:
comb (CombineType) – How to combine the functions (addition, multiplication, division, composition).
f1 (FN) – First function.
f2 (FN) – Second function.
- Return type:
See also
- setFromOptions()#
Set FN options from the options database.
Collective.
Notes
To see all options, run your program with the
-helpoption.See also
Source code at slepc4py/SLEPc/FN.pyx:304
- Return type:
- setMethod(meth)#
Set the method to be used to evaluate functions of matrices.
Logically collective.
Notes
In some
FNtypes there are more than one algorithms available for computing matrix functions. In that case, this function allows choosing the wanted method.If
methis currently set to 0 and the input argument ofFN.evaluateFunctionMat()is a symmetric/Hermitian matrix, then the computation is done via the eigendecomposition, rather than with the general algorithm.See also
- setOptionsPrefix(prefix=None)#
Set the prefix used for searching for all FN options in the database.
Logically collective.
- Parameters:
prefix (str | None) – The prefix string to prepend to all FN 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.
- setParallel(pmode)#
Set the mode of operation in parallel runs.
Logically collective.
- Parameters:
pmode (ParallelType) – The parallel mode.
- Return type:
Notes
This is relevant only when the function is evaluated on a matrix, with either
evaluateFunctionMat()orevaluateFunctionMatVec().See also
- setPhiIndex(k)#
Set the index of the phi-function.
Logically collective.
Notes
If not set, the default index is 1.
See also
- setRationalDenominator(alpha)#
Set the coefficients of the denominator of the rational function.
Logically collective.
See also
- setRationalNumerator(alpha)#
Set the coefficients of the numerator of the rational function.
Logically collective.
See also
- setScale(alpha=None, beta=None)#
Set the scaling parameters that define the matematical function.
Logically collective.
- Parameters:
- Return type:
See also
- setType(fn_type)#
Set the type for the FN object.
Logically collective.
- view(viewer=None)#
Print the FN data structure.
Collective.
- Parameters:
viewer (Viewer | None) – Visualization context; if not provided, the standard output is used.
- Return type:
See also
Attributes Documentation
- method#
The method to be used to evaluate functions of matrices.
- parallel#
The mode of operation in parallel runs.