Matrix square root: private API
ridge_cholesky is the ridge schedule of RidgeCholeskySquareRoot. It returns nothing where no ridge makes the matrix factorise, so a caller that must not raise, such as the Mahalanobis regime statistic, reads it directly.
PortfolioOptimisers.ridge_cholesky — Function
ridge_cholesky(alg::RidgeCholeskySquareRoot, sigma::MatNum)
-> Option{<:LinearAlgebra.Cholesky}Factorises a covariance matrix under the ridge schedule of a RidgeCholeskySquareRoot, and returns nothing where no try succeeds.
Algorithm
- Try the plain Cholesky factorisation of the lower triangle of
sigma. Return it where it succeeds. - Symmetrise
sigma, and take the mean absolute diagonal as the scale. Where that is not a finite positive number, take the largest absolute entry, and at least one. - Add a ridge of
max(alg.ridge * scale, eps * scale)to the diagonal, and try again. Multiply the ridge by ten after each failure, foralg.triestries in all. - Return
nothingwhere every try fails.
Arguments
alg: The ridge algorithm.sigma: The covariance matrix,assets × assets.
Returns
chol::Option{<:LinearAlgebra.Cholesky}: The factorisation, ornothingwhere no ridge makes the matrix factorise.
Related