scipy 1.8.0 Pypi GitHub Homepage
Other Docs
NotesParametersReturnsBackRef
funm(A, func, disp=True)

Returns the value of matrix-valued function f at A. The function f is an extension of the scalar-valued function :None:None:`func` to matrices.

Notes

This function implements the general algorithm based on Schur decomposition (Algorithm 9.1.1. in ).

If the input matrix is known to be diagonalizable, then relying on the eigendecomposition is likely to be faster. For example, if your matrix is Hermitian, you can do

>>> from scipy.linalg import eigh
>>> def funm_herm(a, func, check_finite=False):
...     w, v = eigh(a, check_finite=check_finite)
...     ## if you further know that your matrix is positive semidefinite,
...     ## you can optionally guard against precision errors by doing
...     # w = np.maximum(w, 0)
...     w = func(w)
...     return (v * w).dot(v.conj().T)

Parameters

A : (N, N) array_like

Matrix at which to evaluate the function

func : callable

Callable object that evaluates a scalar function f. Must be vectorized (eg. using vectorize).

disp : bool, optional

Print warning if error in the result is estimated large instead of returning estimated error. (Default: True)

Returns

funm : (N, N) ndarray

Value of the matrix function specified by func evaluated at A

errest : float

(if disp == False)

1-norm of the estimated error, ||err||_1 / ||A||_1

Evaluate a matrix function specified by a callable.

Examples

>>> from scipy.linalg import funm
... a = np.array([[1.0, 3.0], [1.0, 4.0]])
... funm(a, lambda x: x*x) array([[ 4., 15.], [ 5., 19.]])
>>> a.dot(a)
array([[  4.,  15.],
       [  5.,  19.]])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

scipy.linalg._matfuncs.funm

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /scipy/linalg/_matfuncs.py#488
type: <class 'function'>
Commit: