# Shifted ldlfact and cholfact

Hi all,

The calls to `ldlfact` and `cholfact`, in the case of `SparseMatrixCSC` arguments, call the appropriate functions in SuiteSparse and return `CHOLMOD.Factor` objects. These calls also support a named argument `shift`, which adds `shift*I` to the matrix to be factored. This is documented here.

However, I’ve always used SuiteSparse from MATLAB, and there one can use `LD = ldlchol (A,beta)` to compute the Cholesky factorization of `A*A'+beta*I`. This is convenient because one can perform such factorization (I guess) without the need of forming `A*A'`.

Is there a way to do the same in Julia? Or am I missing something?

Thank you!

`cholfact(A, shift=β)` and `ldltfact(A, shift=β)` are supported for sparse matrices (only) and will do what you want.

Thank you. That computes the Cholesky factor of `A + b*I`, as documented. My question is whether there’s a way to factor `A*A'+ b*I` without actually computing the matrix-matrix product, as I believe MATLAB’s interface to SuiteSparse allows (using `ldlchol`).

Not entirely an answer to your original question, but if you perform the QR factorization of `[A' ; sqrt(b) * speye(size(A,1))]`, the transpose of the R factor will be the Cholesky factor that you’re after. (I’m assuming `A'` has more rows than columns and `b > 0`.)

Yes, that’s an option. However I would like to better understand what SuiteSparse allows to do, and how `cholfact` and `ldltfact` are connected to it. I’ll probably dive into the code and see!

It’s SuiteSparse that computes sparse QR factorization (via SuiteSparseQR) and it’s really the stable way to obtain the factor you’re looking for.

Well if that’s how `ldlchol` does that in MATLAB (I’m going to check) than you completely answered my question! However, I’m not sure why you need to make that assumption on the shape of `A`, since for `b > 0` the matrix I’m factoring is always spd.

You’re right. No assumption on the shape of `A` if you’re regularizing. I’m not sure if that’s how Matlab does it.