Skip to main content
`Ctrl`+`K`

# MFNSolve

Solves the matrix function problem. Given a vector \(b\), the vector \(x = f(A)b\) is returned.

## Synopsis

    #include "slepcmfn.h"
    PetscErrorCode MFNSolve(MFN mfn,Vec b,Vec x)

Collective

## Input Parameters

- mfn - the matrix function solver context

- b - the right hand side vector

## Output Parameter

- x - the solution (this may be the same vector as `b`, then `b` will be overwritten with the answer)

## Options Database Keys

- -mfn_view - print information about the solver used

- -mfn_view_pre - print information about the solver before the solve starts

- -mfn_view_mat - view the matrix

- -mfn_view_rhs - view right hand side vector

- -mfn_view_solution - view computed solution vector

- -mfn_converged_reason - print reason for convergence/divergence, and number of iterations

## Notes

The matrix \(A\) is specified with `MFNSetOperator()`. The function \(f\) is specified via the `FN` object obtained with `MFNGetFN()` or set with `MFNSetFN()`.

All the command-line options listed above admit an optional argument specifying the viewer type and options. For instance, use `-mfn_view_mat binary:amatrix.bin` to save the matrix to a binary file, or `-mfn_view_solution :sol.m:ascii_matlab` to save the solution in a file that can be executed in Matlab. See `PetscObjectViewFromOptions()` for more details.

## See Also

MFN: Matrix Function, `MFNCreate()`, `MFNSetUp()`, `MFNDestroy()`, `MFNSetTolerances()`, `MFNSetOperator()`, `MFNSetFN()`

## Level

beginner

## Location

src/mfn/interface/mfnsolve.c

## Examples

src/mfn/tutorials/ex23.c
src/mfn/tutorials/ex26.c
src/mfn/tutorials/ex39.c
src/mfn/tutorials/ex23f.F90
src/mfn/tutorials/ex37.c
src/eps/tutorials/ex36.c

## Implementations

MFNSolve_Expokit() in src/mfn/impls/expokit/mfnexpokit.c
MFNSolve_Krylov() in src/mfn/impls/krylov/mfnkrylov.c

Index of all MFN routines Table of Contents for all manual pages Index of all manual pages