This internal function calculates the decomposition \(\mathbf{S} = \mathbf{K} \mathbf{K}^T\) for an \(n \times n\) covariance matrix \(\mathbf{S}\), so that \(\mathbf{K}\) is an \(n \times m\) matrix with \(m\) being the rank of \(\mathbf{S}\). Returns this \(\mathbf{K}\) and its generalized inverse, \(\mathbf{K}^-\), in a list.
KiK(S, tol = .Machine$double.eps * 100)
List with K
and iK
, with the latter being
\(\mathbf{K}^-\)
Covariance matrix. Symmetry and positive (semi-)definiteness are checked.
Tolerance to determine the rank of \(\mathbf{S}\). Eigenvalues smaller than this value are considered zero.
At present, this utilizes svd()
,
although there may be better alternatives.