Search code examples
matlabmatrixlogarithm

Matrix Logarithm in Base 2


Logm() takes the matrix logarithm, and log2() takes the logarithm base 2 of each element of a matrix.

I'm trying to compute the Von Neumann entropy, which involves the base 2 matrix logarithm. How do I do this?


Solution

  • If you define the matrix exponential "with base 2" as B = expm(log(2) .* A), or if you analogously directly define the matrix logarithm "with base 2" via an eigendecomposition with the standard logarithm of base 2 applied eigenvalue-wise, then you can obtain a corresponding base 2 matrix logarithm by dividing by log(2):

    A = logm(B) ./ log(2)