Previous: Sparse Incomplete Factorizations
Up: Sparse Incomplete Factorizations
Next: CRS-based Factorization Solve
Previous Page: Sparse Incomplete Factorizations
Next Page: CRS-based Factorization Solve

Generating a CRS-based Incomplete Factorization

As noted above, for the factorization we only need to store the pivots, so it suffices to allocate a pivot array of length n ( pivots(1:n)). In fact, we will store the inverses of the pivots rather than the pivots themselves. This implies that during the system solution no divisions have to be performed.

Additionally, we assume that an extra integer array diag_ptr(1:n) has been allocated that contains the column (or row) indices of the diagonal elements in each row, that is, .

The factorization begins by copying the matrix diagonal

for i = 1, n
    pivots(i) = val(diag_ptr(i))
Each elimination step starts by inverting the pivot
for i = 1, n
    pivots(i) = 1 / pivots(i)
For all nonzero elements with , we next check whether is a nonzero matrix element, since this is the only element that can cause fill with .
for j = diag_ptr(i)+1, row_ptr(i+1)-1
        found = FALSE
        for k = row_ptr(col_ind(j)), diag_ptr(col_ind(j))-1
            if(col_ind(k) = i) then
                found = TRUE
                element = val(k)
If so, we update .
if (found = TRUE)
   val(diag_ptr(col_ind(j))) = val(diag_ptr(col_ind(j)))
                                   - element * pivots(i) * val(j)