Square root and inverse square root of a PSD kernel
Source:R/design_similarity_kernel.R
kernel_roots.RdComputes the matrix square root and inverse square root of a positive semi-definite kernel using eigendecomposition with optional regularization.
Value
A list containing:
- Khalf
The matrix square root K^(1/2) with same dimensions as K
- Kihalf
The matrix inverse square root K^(-1/2) with same dimensions as K
- evals
Eigenvalues (after jitter adjustment)
- evecs
Eigenvectors matrix
Details
For a positive semi-definite matrix K, this function computes K^(1/2) and K^(-1/2) using the eigendecomposition K = V * diag(lambda) * V', where K^(1/2) = V * diag(sqrt(lambda)) * V' and K^(-1/2) = V * diag(1/sqrt(lambda)) * V'. The jitter parameter adds a small ridge to eigenvalues to prevent numerical issues with near-zero eigenvalues.