Sparse Direct Methods for Linear Systems
Sparse Direct Methods for Linear Systems
1. Reordering: A −→ A := P AP T
For j = 1, . . . , n Do:
l(j : n, j) = a(j : n, j) T
ä Preprocessing: uses graph [Min. deg, AMD, Nested Dissection]
L1
For k = 1, . . . , j − 1 Do:
L1 2. Symbolic Factorization: Build static data structure.
// cmod(k,j):
lj:n,j := lj:n,j − lj,k ∗ lj:n,k
ä Exploits ’elimination tree’, uses graph only.
EndDo
// cdivp (j) [Scale] ä Also: ’supernodes’
A
lj,j = lj,j
lj+1:n,j := lj+1:n,j /ljj
L 2 3. Numerical Factorization: Actual factorization A = LLT
EndDo ä Pattern of L is known. Uses static data structure. Exploits
supernodes (blas3)
4. Triangular solves: Solve Ly = b then LT x = y
Facts about elimination trees Elim. tree depends on ordering (Not just the graph)
ä Elimination Tree defines dependencies between columns. Example: 3 × 3 grid for 5-point stencil [natural ordering]
ä The root of a subtree cannot be used as pivot before any of its 9
descendents is processed.
8
ä Elimination tree depends on ordering; ++ +
7 8 9 +++ + 7
ä It is easy to determine the sparsity pattern of L because the In theory: To construct the 7
pattern of a given column is “inherited” by the ancestors in the tree. pattern of L, go up the
nz(L:5) := nz(L:5)
tree and accumulate the
k patterns of the columns. U nz(L:2) 6
3 List={1} 2 3
List={1} 2 L={5,6,8}
p=5
8 8
6 6
4 7 4 7
List= empty List= empty
L={2,5,8} , p = 2 List={2,3},L={6,8}, p=6 L={2,5,8} , p = 2
List={2,3},L={6,8},p=6 Multifrontal methods
1 5 5
1
List=empty List={1} List=empty ä Start with the frontal method.
List={1} 3 L:={5,8}
L={5,6,8}
2
p=5
L={5,6,8}
2 3 L:={5,8}
p=5 8
p=5 p=5 ä Recall: Finite element matrix:
6 8 P [e]
List={4,5} List={4,5}
6 A= A
L={7,8}
4 7 p=7 List={6}
List=empty
List=empty 4 7
L={6,7}
p=6 L={6,7} p = 6 A[e] = element matrix associated with element e.
ä An old idea: Execute Gaussian elimination as the elements are
being assembled
ä Dependency: variabes ↔ elements, creates an assembly tree.
ä Method is called the frontal method
ä Very popular among finite element users: saves storage
1 7 4
Multifrontal methods: extension to general matrices 9
8
ä Elimination tree replaces assembly tree 8
6
3 7
ä Proceed in post-order traversal of elimination tree in order not 3 6
2 5
to violate task dependencies. 1 2 4 5
9
ä When a node is eliminated an update matrix is created.
ä This matrix is passed to the parent which adds it to its frontal 1 3 7 2 3 9
matrix. 1 U1 = U2 =
2
3 7
ä Requires a stack of pending update matrices 3 9
3
3
3 7
3
ä Update matrices popped out as they are needed
7
9
Frontal Update Frontal Update
ä Often implemented with nested dissection-type ordering Matrix Matrix Matrix Matrix
ä More complex than a left-looking algorithm
8-23 – Direct2
9 7 4
Eliminating nodes 1 and 2: What happens on matrix
8
7 8
6
3
3 6 1 ? ?
4 5 5 2 ? ?
9 ? ? 3 ? ← U1(3, :) ← U2(3, :)
4 ? ?
A3 + U 1 + U2 5 ? ?
3 7 8 9 ? ? 6 ?
U1 U3 ? ? 7 ? ← U (7, :)
3
1
7 8 9
7
? ? ? 8 ?
7 8 9
? ? ? 9 ← U2(9, :)
8
9
U2
Frontal Update
Matrix Matrix
Supernodes