ginv
This function receives a covariance matrix S and calculates the generalized inverse of S.
ginv(S)
S
Useful links