bundles / scipy latest / scipy / linalg / _matfuncs / logm
function
scipy.linalg._matfuncs:logm
source: build-install/usr/lib/python3.14/site-packages/scipy/linalg/_matfuncs.py:146
Signature
def logm(A)Summary
Compute matrix logarithm.
Extended Summary
The matrix logarithm is the inverse of expm: expm(logm(A)) == A
The documentation is written assuming array arguments are of specified "core" shapes. However, array argument(s) of this function may have additional "batch" dimensions prepended to the core shape. In this case, the array is treated as a batch of lower-dimensional slices; see linalg_batch for details. The NEP 5 signature of this function is (i,i)->(i,i).
Parameters
A: (N, N) array_likeMatrix whose logarithm to evaluate
Returns
logm: (N, N) ndarrayMatrix logarithm of
A
Examples
import numpy as np from scipy.linalg import logm, expm a = np.array([[1.0, 3.0], [1.0, 4.0]]) b = logm(a)✓
b expm(b) # Verify expm(logm(a)) returns a✗
array([[1., 3.],
[1., 4.]])
Aliases
scipy.linalg.logm