operator.matrix_function
operator.matrix_function(A, fun='identity', deg=20, rtol=None, orth=0, **kwargs)
Constructs a LinearOperator
approximating the action of the matrix function fun(A)
.
This function uses the Lanczos method to approximate the action of matrix function: v \mapsto f(A)v, \quad f(A) = U f(\lambda) U^T The resulting operator may be used in conjunction with other methods, such as hutch
or xtrace
.
The resulting operator also supports fast evaluation of f(A)’s quadratic form: v \mapsto v^T f(A) v The weights of the quadrature may be computed using either the Golub-Welsch (GW) or Forward Three Term Recurrence algorithms (FTTR) (see the method
parameter).
For a description of all other parameters, see the Lanczos function.
To compute the weights of the quadrature, the GW computation uses implicit symmetric QR steps with Wilkinson shifts, while the FTTR algorithm uses the explicit expression for orthogonal polynomials. While both require O(\mathrm{deg}^2) time to execute, the former requires O(\mathrm{deg}^2) space but is highly accurate, while the latter uses only O(1) space at the cost of stability. If deg
is large, fttr
is preferred.
Parameters
Name | Type | Description | Default |
---|---|---|---|
A |
scipy.sparse.linalg.LinearOperator or ndarray or sparray | real symmetric operator. | required |
fun |
str or typing.Callable | real-valued function defined on the spectrum of A . |
"identity" |
deg |
int | Degree of the Krylov expansion. | 20 |
rtol |
float | Relative tolerance to consider two Lanczos vectors are numerically orthogonal. | 1e-8 |
orth |
int | Number of additional Lanczos vectors to orthogonalize against when building the Krylov basis. | 0 |
kwargs |
dict | additional key-values to parameterize the chosen function ‘fun’. | {} |
Returns
Type | Description |
---|---|
scipy.sparse.linalg.LinearOperator | a LinearOperator approximating the action of fun on the spectrum of A |