Y = logm(X)
logm(A) is the inverse function of expm(A) in that for most matrices A
These identities may fail for somelogm(expm(A))=A=expm(logm(A))
A. For example, if the computed eigenvalues of A include an exact zero, then logm(A) generates infinity. Or, if the elements of A are too large, expm(A) may overflow.
X produced by the example in expm.
ThenX =2.7183 1.7183 1.08620 1.0000 1.26420 0 0.3679
A = logm(X) produces the original matrix A used in the expm example.
ButA =1.0000 1.0000 0.00000 0 2.00000 0 -1.0000
log(X) involves taking the logarithm of zero, and so produces
ans=1.0000 0.5413 0.0826-Inf 0 0.2345-Inf -Inf -1.0000
, which is described in [1]. The algorithm uses the Schur factorization of the matrix and can give poor results or break down completely when the matrix has repeated eigenvalues. A warning message is printed when the results may be inaccurate.
expm,funm,sqrtm
[2] C. B. Moler and C. F. Van Loan, "Nineteen Dubious Ways to Compute the Exponential of a Matrix," SIAM Review 20, pp. 801-836, 1979.
(c) Copyright 1994 by The MathWorks, Inc.