def _covariance_factor(Sigma):
# Assume it is positive-definite and try Cholesky decomposition.
try:
return Covariance_Cholesky(Sigma)
except la.LinAlgError:
pass
# XXX In the past, we tried LU decomposition if, owing to
# floating-point rounding error, the matrix is merely nonsingular,
# not positive-definite. However, empirically, that seemed to lead
# to bad numerical results. Until we have better numerical analysis
# of the situation, let's try just falling back to least-squares
# pseudoinverse approximation.
# Otherwise, fall back to whatever heuristics scipy can manage.
return Covariance_Loser(Sigma)
评论列表
文章目录