I have a system Ax = b, where B is a constant, but A keeps changing by small amounts in each iteration. I am using UMFPACK 5 to solve this linear system again as again as A changes. I can do the above in two ways:
Which of the above ways is correct? I am getting completely different answers (as expected) for the above two procedures. Any help or comment is appreciated. Thanks.
The symbolic factorization depends only on the sparsity pattern (Ap and Ai in the notation of UMFPACK). The numeric factorization depends on the actual values (Ax). So you need to compute the symbolic factorization only once, but you need to re-compute the numeric factorization in each factorization.
The documentation of UMFPACK shows that this is a slight simplification of reality. In fact, UMFPACK does use the actual values to do the symbolic factorization, but it only distinguishes between 'small' and 'large' values. So if the matrix A changes only a little, that does not matter. If the values (Ax) change by so much that a previously 'small' value becomes large, or the other way around, then the symbolic factorization may change. However, if you use the old symbolic factorization with the new Ax, you will still get the correct numeric factorization and the correct solution, though UMFPACK is (presumably) more efficient if you use the new symbolic factorization.
So, whether you want to recompute the symbolic factorization depends on how long it takes to compute the symbolic factorization, and how much quicker the numeric factorization is if you use the symbolic factorization with the correct Ax. My guess would be that you do not want to recompute the symbolic factorization if you change only a couple of values, but you need to benchmark.