DrTimothyAldenDavis / SuiteSparse

The official SuiteSparse library: a suite of sparse matrix algorithms authored or co-authored by Tim Davis, Texas A&M University.
https://people.engr.tamu.edu/davis/suitesparse.html
Other
1.17k stars 261 forks source link

need read/write subroutine for cholmod_factor object and cholmod_common factor #80

Open yhg926 opened 3 years ago

yhg926 commented 3 years ago

I'm always frustrated when I need to factorize a matrix A in to LL' in step1 and then solve LL'x=b in step2. I need first write the cholmod_factor object L and cholmod_common object c to file, and read them into memory later. However, i cannot find a routine can handle these. i'd like there is a write routine to write L an c to file, and a read routine to read L and c to memory. These functions will be very useful in the cases where LL'x=b need be run much more frequently than factorizing A to LL' , then user need only factorize A to LL' once.

DrTimothyAldenDavis commented 3 years ago

This is the first request I've had to write a matrix factorization to a file, and read it back in, so I haven't considered writing such a function. It's not a common requirement, but I can add it to the list of possible future extensions.

As a workaround, you could write the file as a Matrix Market file, then read it back in. It won't be a CHOLMOD factorization when read back in, but just a simple sparse matrix. However, you could do the forward/backsolve using CSparse, instead, which takes as input just a simple sparse matrix.

On Fri, Mar 5, 2021 at 2:22 AM Huiguang Yi notifications@github.com wrote:

I'm always frustrated when I need to factorize a matrix A in to LL' in step1 and then solve LL'x=b in step2. I need first write the cholmod_factor object L and cholmod_common object c to file, and read them into memory later. However, i cannot find a routine can handle these. i'd like there is a write routine to write L an c to file, and a read routine to read L and c to memory. These functions will be very useful in the cases where LL'x=b need be run much more frequently than factorizing A to LL' , then user need only factorize A to LL' once.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/DrTimothyAldenDavis/SuiteSparse/issues/80, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYIIOLGPWELVYJJJ5FZ6ATTCCIEZANCNFSM4YUY2JLQ .

yhg926 commented 3 years ago

I use CSparse previously and it can write the factor. I turn to Suitesparse because it is much faster. I hope your extensions will come soon