sparse icon indicating copy to clipboard operation
sparse copied to clipboard

Sparse Cholesky Decomposition

Open TomMaullin opened this issue 4 years ago • 9 comments

I was recommended to ask this on the dask github issues threads here.

Would it be possible to implement a Cholesky Decomposition function for Sparse matrices? I understand this may not be a high priority currently but would be enormously helpful in the future!

TomMaullin avatar Sep 08 '19 23:09 TomMaullin

Hi! Why do you need the decomposition? Is it to solve a system of linear equations? If so, sparse.solve exists.

hameerabbasi avatar Sep 09 '19 07:09 hameerabbasi

Hey! I am performing sparse numerical optimisation for mixed effects model estimation. To ensure certain matrices remain positive definite during the optimisation I need to perform a cholesky factorisation and work with the cholesky factor. This work is based on the paper behind the lme4 package in R (see here if you would like more information).

Also: Oh! I wasn't aware of sparse.solve - It doesn't solve the problem I have but will certainly be useful - I can't seem to find it in the documentation! Does it broadcast?

TomMaullin avatar Sep 09 '19 10:09 TomMaullin

Edit: I was wrong, it doesn’t exist yet.

hameerabbasi avatar Sep 09 '19 10:09 hameerabbasi

Hi! I think scikit-sparse has the sparse cholesky decomposition implemented under sksparse.cholmod Sparse Cholesky Is this what you're looking for?

Harivallabha avatar Sep 10 '19 22:09 Harivallabha

Hi, it does yes thank you. However this decomposition may be run hundreds of thousands of times in my code and ideally everything would be done in sparse as the overhead for converting the data between different packages' sparse matrix formats becomes quite large with increasing iterations. Also `scikit-sparse' is no longer maintained and was ruled out of my work due to potential future compatibility issues.

I did try cvxopt which is the current winner - however ideally I need to perform as much as I can eventually in a parallel or vectorised form and as sparse is the chosen implementation for dask, and the dense parts of my code are already dask compatible, I thought id be best ask here first about a single sparse cholesky decomposition.

TomMaullin avatar Sep 10 '19 22:09 TomMaullin

Ah right, I see. That makes perfect sense.

Harivallabha avatar Sep 11 '19 08:09 Harivallabha

We have a lot of linear algebra to get to before we can implement this. I'll leave this open to track it.

hameerabbasi avatar Sep 11 '19 08:09 hameerabbasi

Hi all, I was wondering if we had any news concerning this development ?

MickaelRigault avatar Nov 23 '21 13:11 MickaelRigault

I believe the functions in SciPy now accept sparse arrays.

hameerabbasi avatar Nov 23 '21 15:11 hameerabbasi