I am referring to the The Compute Step section in Eigen documentation:
In the
compute()
function, the matrix is generally factorized:....
For this class of solvers precisely, the compute step is further subdivided into
analyzePattern()
andfactorize()
.The goal of
analyzePattern()
is to reorder the nonzero elements of the matrix, such that the factorization step creates less fill-in. This step exploits only the structure of the matrix. Hence, the results of this step can be used for other linear systems where the matrix has the same structure. ....In
factorize()
, the factors of the coefficient matrix are computed. This step should be called each time the values of the matrix change. However, the structural pattern of the matrix should not change between multiple calls.
The documentation for analyzePattern()
Compute the column permutation to minimize the fill-in
- Apply this permutation to the input matrix -
- Compute the column elimination tree on the permuted matrix
- Postorder the elimination tree and the column permutation
and factorize()
Numerical factorization Interleaved with the symbolic factorization On exit, info is
= 0: successful factorization
0: if info = i, and i is
<= A->ncol: U(i,i) is exactly zero. The factorization has been completed, but the factor U is exactly singular, and division by zero will occur if it is used to solve a system of equations.
A->ncol: number of bytes allocated when memory allocation failure occurred, plus A->ncol. If lwork = -1, it is the estimated amount of space needed, plus A->ncol.
My question is, do we know the relative cost of calling analyzePattern()
and factorize()
?
This question is important to me because my application has a stable matrix structure but constantly changing coefficient matrix. Example: in FEM model, FEM users often leave the element connection unchanged, but always change the element sizes in order to get the best design.
So if analyzePattern()
is a lot expensive than factorize()
, then I can take advantage of this fact and rewrite my code. If no, I can just stick to the compute()
function and rerun analyzePattern()
every time the element sizes change.