MatrixFunction
MatrixFunction(self, A, fun=None, deg=20, dtype=np.float64, **kwargs)Linear operator class for matrix functions.
This class represents an implicitly defined matrix function, i.e. a LinearOperator approximating:
f(A) = U f(\Lambda) U^T
Matrix-vector multiplications with the corresponding operator estimate the action v \mapsto f(A)v using the Lanczos method on a fixed-degree Krylov expansion.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | np.ndarray | numpy array, sparse matrix, or LinearOperator. | required |
| fun | Optional[Callable] | optional spectral function to associate to the operator. | None |
| deg | int | degree of the Krylov expansion to perform. | 20 |
| dtype | np.dtype | floating point dtype to execute in. Must be float64 or float32. | np.float64 |
| kwargs | dict | keyword arguments to pass to the Lanczos method. | {} |
Methods
| Name | Description |
|---|---|
| quad | Estimates the quadratic form using Lanczos quadrature. |
quad
MatrixFunction.quad(x)Estimates the quadratic form using Lanczos quadrature.
This function uses the Lanczos method to estimate the quadratic form: x \mapsto x^T f(A) x The error of the approximation depends on both the degree of the Krylov expansion and the conditioning of f(A).
Though mathematically equivalent, this method is computationally distinct from the operation x @ (A @ x), i.e. the operation which first applies x \mapsto f(A)x and then performs a dot product.