21.06.2014 Views

Numerical Methods Contents - SAM

Numerical Methods Contents - SAM

Numerical Methods Contents - SAM

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

❶: elimination step, ❷: backsubstitution step<br />

2.2 LU-Decomposition/LU-Factorization<br />

⎛<br />

⎛<br />

Assumption: (sub-)matrices regular, if required.<br />

Remark 2.1.5 (Gaussian elimination for non-square matrices).<br />

“fat matrix”: A ∈ K n,m , m>n:<br />

⎛<br />

⎞<br />

⎞<br />

⎜<br />

⎟<br />

⎝<br />

⎠ −→ ⎜<br />

⎟<br />

⎝ 0 ⎠ −→ ⎜<br />

⎝<br />

elimination step<br />

back substitution<br />

1<br />

1 0<br />

0<br />

1<br />

⎞<br />

⎟<br />

⎠<br />

△<br />

The gist of Gaussian elimination:<br />

⎛<br />

⎞ ⎛<br />

⎞ ⎛<br />

⎜<br />

⎟<br />

⎝<br />

⎠ −→ ⎜<br />

⎟<br />

⎝ 0 ⎠ −→ ⎜<br />

⎝<br />

1<br />

1 0<br />

row transformations<br />

row transformations<br />

row transformation = adding a multiple of a matrix row to another row, or<br />

multiplying a row with a non-zero scalar (number)<br />

(ger.: Zeilenumformung)<br />

Note: row transformations preserve regularity of a matrix (why ?)<br />

0<br />

1<br />

⎞<br />

⎟<br />

⎠<br />

Simultaneous solving of<br />

LSE with multiple right hand sides<br />

Given regular A ∈ K n,n , B ∈ K n,m ,<br />

seek X ∈ K n,m<br />

MATLAB:<br />

AX = B ⇔<br />

X = A\B;<br />

X = A −1 B<br />

asymptotic complexity: O(n 2 m)<br />

Code 2.1.6: Gaussian elimination with multiple r.h.s.<br />

1 function X = gausselim (A, B)<br />

2 % Gauss elimination without pivoting, X = A\B<br />

3 n = size (A, 1 ) ; m = n + size (B, 2 ) ; A = [ A,B ] ;<br />

4 for i =1:n−1, p i v o t = A( i , i ) ;<br />

5 for k= i +1:n , fac = A( k , i ) / p i v o t ;<br />

6 A( k , i +1:m) = A( k , i +1:m) −<br />

fac∗A( i , i +1:m) ;<br />

7 end<br />

8 end<br />

9 A( n , n+1:m) = A( n , n+1:m) / A( n , n ) ;<br />

10 for i =n−1:−1:1<br />

11 for l = i +1:n<br />

12 A( i , n+1:m) = A( i , n+1:m) −<br />

A( l , n+1:m) ∗A( i , l ) ;<br />

13 end<br />

14 A( i , n+1:m) = A( i , n+1:m) /A( i , i ) ;<br />

15 end<br />

16 X = A ( : , n+1:m) ;<br />

△<br />

Ôº½ ¾º½<br />

A matrix factorization (ger. Matrixzerlegung) writes a general matrix A as product of two special<br />

(factor) matrices. Requirements for these special matrices define the matrix factorization.<br />

Mathematical issue:<br />

existence & uniqueness<br />

Ôº¾ ¾º¾<br />

<strong>Numerical</strong> issue: algorithm for computing factor matrices<br />

Ôº¿<br />

¾º¾<br />

Example 2.2.1 (Gaussian elimination and LU-factorization).<br />

LSE from Ex. 2.1.1: consider (forward) Gaussian elimination:<br />

⎛<br />

⎝ 1 1 0<br />

⎞ ⎛<br />

2 1 −1⎠<br />

⎝ x ⎞ ⎛<br />

1<br />

x 2 ⎠ = ⎝ 4 ⎞<br />

x 1 + x 2 = 4<br />

1 ⎠ ←→ 2x 1 + x 2 − x 3 = 1 .<br />

3 −1 −1 x 3 −3 3x 1 − x 2 − x 3 = −3<br />

⎛<br />

⎝ 1 ⎞ ⎛<br />

1 ⎠ ⎝ 1 1 0<br />

⎞ ⎛<br />

2 1 −1 ⎠ ⎝ 4 ⎞ ⎛<br />

1 ⎠ ➤ ⎝ 1 ⎞ ⎛<br />

2 1 ⎠ ⎝ 1 1 0<br />

⎞ ⎛<br />

0 −1 −1 ⎠ ⎝ 4<br />

⎞<br />

−7 ⎠ ➤<br />

1 3 −1 −1 −3 0 1 3 −1 −1 −3<br />

⎛<br />

⎞<br />

⎝ 1 2 1 ⎠<br />

3 0 1<br />

⎛<br />

⎝ 1 1 0<br />

⎞<br />

0 −1 −1 ⎠<br />

0 −4 −1<br />

⎛<br />

⎝ 4<br />

−7<br />

−15<br />

⎞<br />

⎠ ➤<br />

⎛<br />

⎞<br />

⎝ 1 2 1 ⎠<br />

3 4 1<br />

} {{ }<br />

=L<br />

= pivot row, pivot element bold, negative multipliers red<br />

⎛ ⎞<br />

⎝ 1 1 0<br />

0 −1 −1 ⎠<br />

}<br />

0 0<br />

{{<br />

3<br />

}<br />

=U<br />

Perspective: link Gaussian elimination to matrix factorization → Ex. 2.2.1<br />

⎛<br />

⎝ 4<br />

−7<br />

13<br />

⎞<br />

⎠<br />

✸<br />

Ôº ¾º¾

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!