slepc4py.SLEPc.FN#

class slepc4py.SLEPc.FN#

Bases: Object

Mathematical Function.

The FN package 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

CombineType

FN type of combination of child functions.

ParallelType

FN parallel types.

Type

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.

evaluateDerivative(x)

Compute the value of the derivative \(f'(x)\) for a given x.

evaluateFunction(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) for a given matrix A.

getCombineChildren()

Get the two child functions that constitute this combined function.

getMethod()

Get the method currently used for matrix functions.

getOptionsPrefix()

Get the prefix used for searching for all FN options in the database.

getParallel()

Get the mode of operation in parallel runs.

getPhiIndex()

Get the index of the phi-function.

getRationalDenominator()

Get the coefficients of the denominator of the rational function.

getRationalNumerator()

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.

setFromOptions()

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

method

The method to be used to evaluate functions of matrices.

parallel

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.

Parameters:

prefix (str | None) – The prefix string to prepend to all FN option requests.

Return type:

None

Source code at slepc4py/SLEPc/FN.pyx:234

create(comm=None)#

Create the FN object.

Collective.

Parameters:

comm (Comm | None) – MPI communicator; if not provided, it defaults to all processes.

Return type:

Self

Source code at slepc4py/SLEPc/FN.pyx:166

destroy()#

Destroy the FN object.

Collective.

Source code at slepc4py/SLEPc/FN.pyx:156

Return type:

Self

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.

Return type:

FN

Source code at slepc4py/SLEPc/FN.pyx:277

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:

Scalar

Source code at slepc4py/SLEPc/FN.pyx:320

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:

Scalar

Source code at slepc4py/SLEPc/FN.pyx:299

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:

petsc4py.PETSc.Mat

Source code at slepc4py/SLEPc/FN.pyx:341

evaluateFunctionMatVec(A, v=None)#

Compute the first column of the matrix f(A) for a given matrix A.

Logically collective.

Parameters:
Returns:

The first column of the result f(A).

Return type:

petsc4py.PETSc.Vec

Source code at slepc4py/SLEPc/FN.pyx:363

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]

Source code at slepc4py/SLEPc/FN.pyx:586

getMethod()#

Get the method currently used for matrix functions.

Not collective.

Returns:

An index identifying the method.

Return type:

int

Source code at slepc4py/SLEPc/FN.pyx:444

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:

str

Source code at slepc4py/SLEPc/FN.pyx:249

getParallel()#

Get the mode of operation in parallel runs.

Not collective.

Returns:

The parallel mode.

Return type:

ParallelType

Source code at slepc4py/SLEPc/FN.pyx:473

getPhiIndex()#

Get the index of the phi-function.

Not collective.

Returns:

The index.

Return type:

int

Source code at slepc4py/SLEPc/FN.pyx:627

getRationalDenominator()#

Get the coefficients of the denominator of the rational function.

Not collective.

Returns:

Coefficients.

Return type:

ArrayScalar

Source code at slepc4py/SLEPc/FN.pyx:543

getRationalNumerator()#

Get the coefficients of the numerator of the rational function.

Not collective.

Returns:

Coefficients.

Return type:

ArrayScalar

Source code at slepc4py/SLEPc/FN.pyx:506

getScale()#

Get the scaling parameters that define the matematical function.

Not collective.

Returns:

  • alpha (Scalar) – Inner scaling (argument).

  • beta (Scalar) – Outer scaling (result).

Return type:

tuple[Scalar, Scalar]

Source code at slepc4py/SLEPc/FN.pyx:402

getType()#

Get the FN type of this object.

Not collective.

Returns:

The math function type currently being used.

Return type:

str

Source code at slepc4py/SLEPc/FN.pyx:198

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:

None

Source code at slepc4py/SLEPc/FN.pyx:564

setFromOptions()#

Set FN options from the options database.

Collective.

Notes

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

Source code at slepc4py/SLEPc/FN.pyx:264

Return type:

None

setMethod(meth)#

Set the method to be used to evaluate functions of matrices.

Logically collective.

Parameters:

meth (int) – An index identifying the method.

Return type:

None

Notes

In some FN types there are more than one algorithms available for computing matrix functions. In that case, this function allows choosing the wanted method.

If meth is currently set to 0 and the input argument of FN.evaluateFunctionMat() is a symmetric/Hermitian matrix, then the computation is done via the eigendecomposition, rather than with the general algorithm.

Source code at slepc4py/SLEPc/FN.pyx:419

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:

None

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.

Source code at slepc4py/SLEPc/FN.pyx:213

setParallel(pmode)#

Set the mode of operation in parallel runs.

Logically collective.

Parameters:

pmode (ParallelType) – The parallel mode.

Return type:

None

Source code at slepc4py/SLEPc/FN.pyx:459

setPhiIndex(k)#

Set the index of the phi-function.

Logically collective.

Parameters:

k (int) – The index.

Return type:

None

Source code at slepc4py/SLEPc/FN.pyx:613

setRationalDenominator(alpha)#

Set the coefficients of the denominator of the rational function.

Logically collective.

Parameters:

alpha (Sequence[Scalar]) – Coefficients.

Return type:

None

Source code at slepc4py/SLEPc/FN.pyx:527

setRationalNumerator(alpha)#

Set the coefficients of the numerator of the rational function.

Logically collective.

Parameters:

alpha (Sequence[Scalar]) – Coefficients.

Return type:

None

Source code at slepc4py/SLEPc/FN.pyx:490

setScale(alpha=None, beta=None)#

Set the scaling parameters that define the matematical function.

Logically collective.

Parameters:
  • alpha (Scalar | None) – Inner scaling (argument), default is 1.0.

  • beta (Scalar | None) – Outer scaling (result), default is 1.0.

Return type:

None

Source code at slepc4py/SLEPc/FN.pyx:383

setType(fn_type)#

Set the type for the FN object.

Logically collective.

Parameters:

fn_type (Type | str) – The math function type to be used.

Return type:

None

Source code at slepc4py/SLEPc/FN.pyx:183

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:

None

Source code at slepc4py/SLEPc/FN.pyx:141

Attributes Documentation

method#

The method to be used to evaluate functions of matrices.

Source code at slepc4py/SLEPc/FN.pyx:644

parallel#

The mode of operation in parallel runs.

Source code at slepc4py/SLEPc/FN.pyx:651