Contents
- Computing real logarithm of a real matrix
- Introduction
- MATLAB build-in matrix logarithm
- real matrix logarithm
Called Functions
Computing real logarithm of a real matrix
by Sherif, N., & Morsy, E. in International Journal of Algebra, 2008
Reproduce in Code (c) Sebastian Jiro Schlecht: Sunday, 6. January 2019
clear; clc; close all;
Introduction
In this example, we reproduce an algorithm (Section 3.1) to compute the real logarithm of a square real normal matrix. As a test example we use the Hadamard matrix of size 4.
N = 4; H = hadamard(N) / sqrt(N)
H = 0.5000 0.5000 0.5000 0.5000 0.5000 -0.5000 0.5000 -0.5000 0.5000 0.5000 -0.5000 -0.5000 0.5000 -0.5000 -0.5000 0.5000
MATLAB build-in matrix logarithm
complexLog = logm(H) expm(complexLog)
Warning: Principal matrix logarithm is not defined for A with nonpositive real eigenvalues. A non-principal matrix logarithm is returned. complexLog = 0.0000 + 0.7854i 0.0000 - 0.7854i 0.0000 - 0.7854i 0.0000 - 0.7854i 0.0000 - 0.7854i 0.0000 + 2.3562i 0.0000 - 0.7854i 0.0000 + 0.7854i 0.0000 - 0.7854i 0.0000 - 0.7854i 0.0000 + 2.3562i 0.0000 + 0.7854i 0.0000 - 0.7854i 0.0000 + 0.7854i 0.0000 + 0.7854i 0.0000 + 0.7854i ans = 0.5000 - 0.0000i 0.5000 + 0.0000i 0.5000 - 0.0000i 0.5000 + 0.0000i 0.5000 + 0.0000i -0.5000 - 0.0000i 0.5000 + 0.0000i -0.5000 - 0.0000i 0.5000 - 0.0000i 0.5000 + 0.0000i -0.5000 + 0.0000i -0.5000 + 0.0000i 0.5000 + 0.0000i -0.5000 - 0.0000i -0.5000 - 0.0000i 0.5000 - 0.0000i
real matrix logarithm
realLog = realLogOfNormalMatrix( H ) expm(realLog)
realLog = 0.0000 -1.1107 1.1107 0.0000 1.1107 0.0000 -2.2214 -1.1107 -1.1107 2.2214 0 1.1107 -0.0000 1.1107 -1.1107 0 ans = 0.5000 0.5000 0.5000 0.5000 0.5000 -0.5000 0.5000 -0.5000 0.5000 0.5000 -0.5000 -0.5000 0.5000 -0.5000 -0.5000 0.5000