SciPy

scipy.linalg.logm

scipy.linalg.logm(A, disp=True)[source]

Compute matrix logarithm.

The matrix logarithm is the inverse of expm: expm(logm(A)) == A

Parameters
A(N, N) array_like

Matrix whose logarithm to evaluate

dispbool, optional

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

Returns
logm(N, N) ndarray

Matrix logarithm of A

errestfloat

(if disp == False)

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

References

1

Awad H. Al-Mohy and Nicholas J. Higham (2012) “Improved Inverse Scaling and Squaring Algorithms for the Matrix Logarithm.” SIAM Journal on Scientific Computing, 34 (4). C152-C169. ISSN 1095-7197

2

Nicholas J. Higham (2008) “Functions of Matrices: Theory and Computation” ISBN 978-0-898716-46-7

3

Nicholas J. Higham and Lijing lin (2011) “A Schur-Pade Algorithm for Fractional Powers of a Matrix.” SIAM Journal on Matrix Analysis and Applications, 32 (3). pp. 1056-1078. ISSN 0895-4798

Examples

>>> from scipy.linalg import logm, expm
>>> a = np.array([[1.0, 3.0], [1.0, 4.0]])
>>> b = logm(a)
>>> b
array([[-1.02571087,  2.05142174],
       [ 0.68380725,  1.02571087]])
>>> expm(b)         # Verify expm(logm(a)) returns a
array([[ 1.,  3.],
       [ 1.,  4.]])

Previous topic

scipy.linalg.expm

Next topic

scipy.linalg.cosm