Skip to contents

Computes the real-valued principal matrix logarithm of a square numeric matrix using the Armadillo linear algebra library.

Usage

LogMat(x, tol = 1e-10)

Arguments

x

A square numeric matrix.

tol

A positive numeric scalar giving the tolerance used to determine whether the imaginary component of the matrix logarithm is negligible. The default is 1e-10.

Value

A numeric matrix containing the real part of the matrix logarithm of x.

Examples

a <- matrix(
  data = c(
    -0.40,  0.10,
    -0.05, -0.30
  ),
  nrow = 2,
  ncol = 2
)

b <- ExpMat(x = a)
b
#>            [,1]        [,2]
#> [1,] 0.66858769 -0.03521973
#> [2,] 0.07043945  0.73902714

a <- LogMat(x = b)
a
#>      [,1]  [,2]
#> [1,] -0.4 -0.05
#> [2,]  0.1 -0.30