Docsity

Linear Algebra: Making LU Decomposition Robust with Partial Pivoting, Study notes of Mathematics

Toggle sidebar
bg1
1
IB Paper 7: Linear Algebra Handout 3
3.5 Making LU decomposition robust – Partial Pivoting
When we say an algorithm is robust, we mean that it should be able to obtain an accurate solution
for the majority of cases without user intervention i.e. it should not be easily "fooled" or get "hung
up" by particular combinations of data. This raises the question what might go wrong with the
algorithm we have used so far. It helps to look at that algorithm in a bit more detail, exemplified
initially using 3 × 3 matrices.
Step 1 Choose
[ ]
T
1
u a b c
=
and 1
1
l d
e
=
so that
T
11 1
0 0 0
0
0
l u r s
t u
= − =
R A
[
]
1
1
a b c a b c
d da db dc
e ea eb ec
= − = −
R A A
It is clear that
1
u
must be the first row of A, and that
21
a
d
a
= and
31
a
e
a
=
Step 2 Choose
[ ]
T
20
u g h
=
and 2
0
1
l
f
=
so that
T T T
2 1 2 2 1 1 2 2
0 0 0
0 0 0
0 0
l u l u l u
w
= − = − − =
R R A
[
]
2 1
0 0 0 0 0 0 0 0
1 0 0
0 0
g h
r s g h
f t u fg fh
= − = −
R R
so that
2
u
is the second row of R1 and
t
f
g
=
After each step of the process the remainder matrix has one more row and one more columnof
zeros, and the process continues until we run out of rows. This gives us the potential problem
about what to do if g (or its equivalent element in a later stage of the process when A is bigger than
3 × 3) turns out to be 0 . If you look back at the end of the previous handout, you will see that the
pf3
pf4
pf5

Partial preview of the text

Download Linear Algebra: Making LU Decomposition Robust with Partial Pivoting and more Study notes Mathematics in PDF only on Docsity!

IB Paper 7: Linear Algebra Handout 3

3.5 Making LU decomposition robust – Partial Pivoting

When we say an algorithm is robust, we mean that it should be able to obtain an accurate solution for the majority of cases without user intervention i.e. it should not be easily "fooled" or get "hung up" by particular combinations of data. This raises the question what might go wrong with the algorithm we have used so far. It helps to look at that algorithm in a bit more detail, exemplified initially using 3 × 3 matrices.

Step 1 Choose u  1 T^ = [ a b c ] and 1

l d e

= ^ 

so that

T 1 1 1

l u r s t u

= − = ^ 

R A 

[ ]

1

1 a b c a b c d da db dc e ea eb ec

= − ^ ^ = − ^ 

R A A

It is clear that u  1 must be the first row of A , and that 21

a d a

= and 31

a e a

Step 2 Choose u T^2 = [ 0 g h ] and 2

l 1 f

= ^ 

so that

T T T (^2 1 2 2 1 1 2 )

l u l u l u w

= − = − − = ^ 

R R ^ A ^ 

[ ]

2 1

g h r s g h f t u fg fh

= − ^ ^ = ^ ^ − ^ 

R R

so that u ^2 is the second row of R 1 and

t f g

After each step of the process the remainder matrix has one more row and one more columnof zeros, and the process continues until we run out of rows. This gives us the potential problem about what to do if g (or its equivalent element in a later stage of the process when A is bigger than 3 × 3) turns out to be 0. If you look back at the end of the previous handout, you will see that the

thing we divide by at each step is called the pivot element for this step. This symptom is, therefore, often referred to as a zero candidate pivot element.

If we were doing this by hand, we would know what to do as the next example illustrates, we would choose a different pivot.

Example

Perform LU on

Step 1

 −^  =^  −   

Step 2

Note that we have still zeroed one additional row and one column in this step, so the decomposition is still on track.

Step 3

Pulling this together

1 [ 2 1 2 ] 0 [ 0 1 4 ] 0 [ 0 0 3 ]

A

= L U ˆ

Note that L ˆ isn't quite lower triangular but, in the immortal words of the MATLAB help file, L ˆ is "psychologically equivalent" to a lower triangular matrix.

Can’t use this to zero second column

Use this instead

Step 1

.1 .3 02 0 0 .6^ 1.

    ^ 

  =   ^ 

    ^ 

    ^ 

    ^ 

Step 2

For this step we have used 2 as the largest potential pivot. In matrix form

A =

Permute the rows,

giving

0 0 1 1 0 0 0 1 0

A further consequence of this way of choosing the pivot element is that all of the pivot elements have ended up large and all of the multipliers are less than unity.

L =

U =

The L and U that we have ended up with have their largest terms on the diagonal (and so will be well conditioned when it comes to forward and backward substitution). This is a good thing, as the following example shows.

Multipliers

Pivots

3.6 Ill-conditioned problems

The examples presented in this section are somewhat extreme, so that we can see the principles on small (2 × 2 matrices). The general m × n case shows exactly the same features/problems but with less extreme data.

Suppose

x x b y

A

Performing non-intelligent basic LU decomposition leads us to

We re-write A x = b as LU x = b and solve U x = c , where L c = b

1 4 2

c c b c

L

Solving this by forward substitution 1 4 2 1

c

c c

Then U x = c is solved by backward substitution

y

. x

This gives

=^4 − =^4 × =

x. y.

y which is correct

Now this is all well and good if we are working to exact precision. Machines, however, will always be working to a limited number of significant figures. If, for example, y was in error by 1

part in 10−^6 , y = 1.000001, then this last equation becomes

x = 104 ( 2.0001 − 2 y )= 10 4 × .000098 = .98 (*)

i.e. we don't even have three significant figure accuracy for x , which is not exactly robust.

The trouble comes from the fact that the pivot for x , .0001, is very small, and so any errors on the right-hand side of (*) are immediately multiplied by a large number (10^4 ). This equation is said to be ill-conditioned.

For the extended LU method , it is clear that the permutation matrix will simply swap the rows, so then we can proceed naively. This time we solve PA x = P b. (NOT A x = b )

Pivot small

Multiplier large