Skip to contents

Computes the principal matrix logarithm of a symmetric positive-definite (SPD) matrix. The input matrix is first regularized to ensure positive definiteness.

Usage

matrix_logm_spd(S, regularize_epsilon = 1e-06)

Arguments

S

A numeric, symmetric matrix.

regularize_epsilon

Epsilon for regularization. Default 1e-6.

Value

The matrix logarithm of S (a symmetric matrix).

Examples

S1 <- matrix(c(2.3, -0.3, -0.3, 3.6), 2, 2)
logS1 <- matrix_logm_spd(S1)
print(logS1)
#>            [,1]       [,2]
#> [1,]  0.8266331 -0.1037649
#> [2,] -0.1037649  1.2762808