Main Content

Matrix logarithm

`L = logm(`

is the
principal matrix logarithm of `A`

)`A`

, the inverse of `expm(A)`

.
The output, `L`

, is the unique logarithm for which
every eigenvalue has imaginary part lying strictly between –*π* and *π*.
If `A`

is singular or has any eigenvalues on the
negative real axis, then the principal logarithm is undefined. In
this case, `logm`

computes a nonprincipal logarithm
and returns a warning message.

`[L,exitflag] = logm(A)`

returns a scalar `exitflag`

that
describes the exit condition of `logm`

:

If

`exitflag = 0`

, the algorithm was successfully completed.If

`exitflag = 1`

, too many matrix square roots had to be computed. However, the computed value of`L`

might still be accurate.

If

`A`

is real symmetric or complex Hermitian, then so is`logm(A)`

.Some matrices, like

`A = [0 1; 0 0]`

, do not have any logarithms, real or complex, so`logm`

cannot be expected to produce one.

[1] Al-Mohy, A. H. and Nicholas J. Higham, “Improved
inverse scaling and squaring algorithms for the matrix logarithm,” *SIAM
J. Sci. Comput.*, 34(4), pp. C153–C169, 2012

[2] Al-Mohy, A. H., Higham, Nicholas J. and
Samuel D. Relton, “Computing the Frechet derivative of the
matrix logarithm and estimating the condition number,” *SIAM
J. Sci. Comput.,*, 35(4), pp. C394–C410, 2013