https://github.com/numpy/numpy/pull/4079

I'm looking for the equivalent of Cholesky for possibly singular, symmetric matrices using numpy or scipy linalg.

details:
I'm writing a function that can either take the data x (nobs, k_vars) or the moment matrix x.T.dot(x) (k_vars, k_vars), and I want to get the same result in both cases.

Given data x, all I need is the R of the QR decomposition.
If the moment matrix is not singular, then I can get the same with the Cholesky decomposition.

However, what's the equivalent of R in QR if x is not of full rank and the moment matrix is singular?

QR on the moment matrix gives different numbers and I don't know how to recover the correct R.


requirement: I need the same sequential decomposition as qr and cholesky to be used for sequential least squares.

Thanks,

Josef