|MATLAB Function Reference|
Y = logm(X)
returns the matrix logarithm: the inverse function of
expm(X). Complex results are produced if
X has negative eigenvalues. A warning message is printed if the computed
expm(Y) is not close to
[Y,esterr] = logm(X)
does not print any warning message, but returns an estimate of the relative residual,
X is real symmetric or complex Hermitian, then so is
Some matrices, like
X = [0 1; 0 0], do not have any logarithms, real or complex, and
logm cannot be expected to produce one.
For most matrices:
These identities may fail for some
X. For example, if the computed eigenvalues of
X include an exact zero, then
logm(X) generates infinity. Or, if the elements of
X are too large,
expm(X) may overflow.
A is the 3-by-3 matrix
A = logm(X) produces the original matrix
log(X) involves taking the logarithm of zero, and so produces
The matrix functions are evaluated using an algorithm due to Parlett, which is described in . The algorithm uses the Schur factorization of the matrix and may give poor results or break down completely when the matrix has repeated eigenvalues. A warning message is printed when the results may be inaccurate.
 Golub, G. H. and C. F. Van Loan, Matrix Computation, Johns Hopkins University Press, 1983, p. 384.
 Moler, C. B. and C. F. Van Loan, "Nineteen Dubious Ways to Compute the Exponential of a Matrix," SIAM Review 20, 1979,pp. 801-836.