Linear Systems Pivoting in Gaussian Elim. CSE 541 Roger Crawfis.

10
Linear Systems Pivoting in Gaussian Elim. CSE 541 Roger Crawfis

Transcript of Linear Systems Pivoting in Gaussian Elim. CSE 541 Roger Crawfis.

Page 1: Linear Systems Pivoting in Gaussian Elim. CSE 541 Roger Crawfis.

Linear SystemsPivoting in Gaussian Elim.

CSE 541

Roger Crawfis

Page 2: Linear Systems Pivoting in Gaussian Elim. CSE 541 Roger Crawfis.

The naïve implementation of Gaussian Elimination is not robust and can suffer from severe round-off errors due to:Dividing by zeroDividing by small numbers and adding.

Both can be solved with pivoting

Limitations of Gaussian Elimation

Page 3: Linear Systems Pivoting in Gaussian Elim. CSE 541 Roger Crawfis.

What if at step i, Aii = 0?

Simple Fix:If Aii = 0

Find Aji 0 j > i

Swap Row j with i

Factored Portion

iiA

jiA

Row i

Row j

Partial Pivoting

Page 4: Linear Systems Pivoting in Gaussian Elim. CSE 541 Roger Crawfis.

75

25.6

5.125.12

25.11025.1

2

14

x

x

Forward Elimination

52

1

5

4

1025.675

25.6

1025.15.120

25.11025.1

x

x

9999.4

0001.1

52

1

digitsx

x

Example – Partial Pivoting

Page 5: Linear Systems Pivoting in Gaussian Elim. CSE 541 Roger Crawfis.

52

1

5

4

1025.6

25.6

1025.10

25.11025.1

x

x

Rounded to 3 digits

Example – Partial Pivoting

75

25.6

5.125.12

25.11025.1

2

14

x

x

Forward Elimination

52

1

5

4

1025.675

25.6

1025.15.120

25.11025.1

x

x

9999.4

0001.1

52

1

digitsx

x

5

0

32

1

digitsx

x

Page 6: Linear Systems Pivoting in Gaussian Elim. CSE 541 Roger Crawfis.

Partial Pivoting to mitigate round-off error

Adds an O(n) search.

If | | < max | |

Swap row with arg (max | |)

ii jij i

ijj i

A A

i A

Avoids Small Multipliers

Better Pivoting

Page 7: Linear Systems Pivoting in Gaussian Elim. CSE 541 Roger Crawfis.

Forward Elimination

5

2

1

5 107525.6

75

105.1225.10

5.125.12

x

x

5

1

32

1

digitsx

x

25.6

75

25.10

5.125.12

2

1

x

x

Rounded to 3 digits

75

25.6

5.125.12

25.11025.1

2

14

x

x

25.6

75

25.11025.1

5.125.12

2

14 x

x

swap

Partial Pivoting

Page 8: Linear Systems Pivoting in Gaussian Elim. CSE 541 Roger Crawfis.

Pivoting strategies

k

k

k

k

Partial Pivoting:Only row interchange

Complete (Full) PivotingRow and Column interchange

Threshold PivotingOnly if prospective pivot is found

to be smaller than a certain threshold

Page 9: Linear Systems Pivoting in Gaussian Elim. CSE 541 Roger Crawfis.

Pivoting With Permutations

Adding permutation matrices in the mix:

However, in Gaussian Elimination we will only swap rows or columns below the current pivot point. This implies a global reordering of the equations will work:

bPMPMPMAxPMPMPM nnnnnnnn 112211112211

bxAM

MPbMPAx

Page 10: Linear Systems Pivoting in Gaussian Elim. CSE 541 Roger Crawfis.

Pivoting

Again, the pivoting is strictly a function of the matrix A, so once we determine P it is trivial to apply it to many problems bk.

For LU factorization we have:LU = PALy = PbUx = y