I use the function below to generate the betas for a given set of guess lambdas from my optimiser.
When running I often get the following warning message:
There are special tools designed for this problem, appropriately called "rank revealing matrix factorizations". To my best (albeit a little old) knowledge, a good enough way to decide whether a n x n
matrix A
is nonsingular is to go with
det(A) <> 0 <=> rank(A) = n
and use a rank-revealing QR factorization of A:
AP = QR
where Q
is orthogonal, P
is a permutation matrix and R
is an upper triangular matrix with the property that the magnitude of the diagonal elements is decreased along the diagonal.