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

  1. Try the plain Cholesky factorisation of the lower triangle of sigma. Return it where it succeeds.
  2. 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.
  3. Add a ridge of max(alg.ridge * scale, eps * scale) to the diagonal, and try again. Multiply the ridge by ten after each failure, for alg.tries tries in all.
  4. Return nothing where every try fails.

Arguments

  • alg: The ridge algorithm.
  • sigma: The covariance matrix, assets × assets.

Returns

  • chol::Option{<:LinearAlgebra.Cholesky}: The factorisation, or nothing where no ridge makes the matrix factorise.

Related

source