Pivoting
Pivoting
−4
3.1 · 10 1 −3 −4.001246...
A= , b= , xexakt =
1 1 −7 −2.99875...
and thus
1 0 1 1
Lper = −4 , Uper = ,
3.1 · 10 1 0 1 − l21 = 0.9997
−7 −4.001
y = L−1 b
per per = , x = U −1
per y =
−2.998 −2.999
0.5 2 8.75 11.25
A = A(1) = 1 2 3 , b(1) = 6 sol.: (1, 1, 1)>
0.5 5 6.5 12
seek pivot in the first column: =⇒ interchange 1st and 2nd row:
1 2 3 6
e(1)
A = 0.5 2 8.75 , eb(1) = 11.25
0.5 5 6.5 12
3
example of an LU -factorization with row pivoting
1 2 3 6
!
1
(2) (2) (1)
A = 0 1 7.25 , b = 8.25 , L = −0.5 1 ,
0 4 5 9 −0.5 1
(2) (2)
seek pivot in 2nd column: compare merely a22 und a32 .
(2) (2)
Since |a32 | > |a22 | interchange the 2nd and 3rd row:
1 2 3 6
e(2)
A = 0 4 5 , eb(2) = 9 ,
0 1 7.25 8.25
4
computation of the permutation matrix P , such that P A = LU
track the row permutations: We expect that we have computed an
1. step: π = (1, 2, 3) LU -factorization of the following matrix:
2. step: π = (2, 1, 3) A2,:
Ae := A3,:
3. step: π = (2, 3, 1) A1,:
0 0 1 0 1 0
Pπ = 1 0 0 =⇒ P := Pπ−1 = Pπ> = 0 0 1
0 1 0 1 0 0
5
Gaussina eliminiation with (partial) pivoting
Input: invertible A ∈ Rn×n
Output: factorization PA = LU, where A is overwritten by U:
uij = aπ(i),j and P = P−1 >
π = Pπ is implicitly given by the vector π
π := (1, 2, . . . , n)
for k = 1 : (n − 1) do
seek p ∈ {k, . . . , n} s.t. |apk | ≥ |aik | ∀i ≥ k
interchange k-th and p-th entry of vector π
for i = (k + 1) : n do
a
lπ(i),k := a π(i),k
π(k),k
for j = (k + 1) : n do
aπ(i),j := aπ(i),j − lπ(i),k aπ(k),j
end for
end for
end for