{ } Raw JSON

bundles / scipy 1.18.0 / scipy / linalg / _matfuncs / logm

function

scipy.linalg._matfuncs:logm

source: /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. Note that calls with zero-size batches are unsupported and will raise a ValueError.

Parameters

A : (N, N) array_like

Matrix whose logarithm to evaluate

Returns

logm : (N, N) ndarray

Matrix 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

Referenced by