Professional Documents
Culture Documents
1
Introduction
If:
L: lower triangular matrix
U: upper triangular matrix
Then,
[A]{X}={B} can be decomposed into two
matrices [L] and [U] such that:
1. [L][U] = [A] ([L][U]){X} = {B}
3
LU Decomposition
Consider:
[U]{X} = {D}
So, [L]{D} = {B}
2. [L]{D} = {B} is used to generate an intermediate vector {D}
by forward substitution.
3. Then, [U]{X}={D} is used to get {X} by back substitution.
4
Summary of LU Decomposition
5
LU Decomposition
6
LU Decomposition
System of linear equations [A]{x}={B}
a12 a31
a11 a12 a13 x1 b1 l 21 ; l 31
a
a23 x2 b2
a11 a11
21 a 22
8
LU Decomposition-Example
3 0.1 0.2 1 0 0
U 0 7.003 0.293 [L ] 0.03333 1 0
0 0.1000 .02713 1
0 10 .012
9
LU Decomposition-Example (cont’d)
10
LU Decomposition-Example
(cont’d)
11
Matrix Inverse Using the LU
Decomposition
15
Matrix Inverse: LU Decomposition
A 1
{x}1 {x}2 {x}3
16
Matrix inverse using LU decomposition
Example
3 0.1 0.2 1 0 0 3 0.1 0.2
A 0.1 7 0.3 [L ] 0.03333 1 0 U 0 7.003 0.293
0.3 0.2 10 0.1000 .02713 1 0
0 10 .012
1 0 0 d1 0 d1 0
0.0333
1 0 d 2 1 d 2 1
0.1000 0.02713 1 d 3 0 d 3 0.02713
2nd column
2B. Then, [U]{X}2={d}2 of [A]-1
19
Matrix inverse using LU decomposition
Example (cont’d)
20
LU decomposition (Operation Counts)
Basic Approach
b) First solve [L] {d} = {b} for {d} by forward subst. n2/2
flops
LU Decomposition Variations
Doolittle [L1][U] from Gaussian elim, General [A]
Crout [L][U1] General [A]
Cholesky [L][L] T Pos. Def. Symmetric [A]
22
LU decomposition
Matrix Inversion
Definition of a matrix inverse:
[A] [A]-1 = [ I ]
23
LU decomposition
Matrix Inversion
If you really must --
1) Gaussian elimination: [A | I ] –> [U | B'] ==> A-1
2) Gauss-Jordan: [A | I ] ==> [I | A-1 ]
26
Vector and Matrix Norms (cont’d)
F e a 2 b2 c 2
Length or Euclidean norm of [F]
27
Vector Norms
Vector Norms: Scalar measure of the magnitude of a vector
Here are some vector norms for n x 1 1/ p
n
vectors {x} with typical elements xi.
Each is in the general form of a p norm
x p
x
i 1
i
p
defined by the general relationship:
n
1. Sum of the magnitudes: x 1
i 1
xi
2. Magnitude of largest element: x
max x i
i
(infinity norm)
1/ 2
n
3. Length or Euclidean norm: x 2
x
i 1
i
2
28
Matrix Norms
A p
max A x p
x 1
n
a
1. Largest column sum:
A 1 max ij
(column sum norm) j
i 1
i 1 j 1 29
Vector and Matrix Norms (cont’d)
37
Introduction
38
Banded matrix
39
Tridiagonal Systems
• A tridiagonal system has a bandwidth of 3:
f1 g1 x1 r1
e x r
2 f2 g2 2 2
e3 f3 g 3 x3 r3
e4 f 4 x4 r4
41
Cholesky Decomposition
This method is suitable for only symmetric systems
where:
l11 0 0
a ij a ji and A A T [L ] l 21 l 22 0
l 31 l 32 l 33
A L * LT
4242
Cholesky Decomposition
i 1
aki l iji 1l kj
l ki akij 1 l ij l kjfor i 1, 2, , k 1
j 1
l ki l ii for i 1, 2, , k 1
k 1 l ii
l kk akk l kj2k 1
l kk akkj 1 l kj2
j 1
43
Pseudocode for Cholesky’s LU
Decomposition algorithm (cont’d)
44
Iterative Solution Methods
45
Iterative Solution Methods
46
Iterative Solution Methods
Basic Mechanics:
Starting with:
a11x1 + a12x2 + a13x3 + ... + a1nxn = b1
a21x1 + a22x2 + a23x3 + ... + a2nxn = b2
a31x1 + a32x2 + a33x3 + ... + a3nxn = b3
: :
an1x1 + an2x2 + an3x3 + ... + annxn = bn
Solve each equation for one variable:
x1 = [b1 – (a12x2 + a13x3 + ... + a1nxn )} / a11
x2 = [b2 – (a21x1 + a23x3 + ... + a2nxn )} / a22
x3 = [b3 – (a31x1 + a32x2 + ... + a3nxn )} / a33
:
xn = [bn – (an1x2 + an2x3 + ... + an,n-1xn-1 )} / ann
47
Gauss-Seidel
new
x x old
a ,i i
new
i
100% s
x i
49
Iterative Solution Methods -- Gauss-Seidel
x 2j1 b 2 a 21 x1j1 a 23 x 3j
a 2n x nj a 22
x 3j1 b3 a x1j1 a 32 x 2j1
a 3n x nj a 33
31
x nj1 b n a n1 x1j1 a n2 x 2j1
a n,n 1 x nj11 a nn
50
Jacobi iteration Method
51
Iterative Solution Methods – the Jacobi
Method
x1j1 b1 a12 x 2j a13 x 3j
a1n x nj a11
x 2j1 b 2 a x1j a 23 x 3j a 2n x nj a 22
21
x nj1 b n a n1 x1j a n2 x 2j
a n,n 1 x nj 1 a nn
52
Gauss-Siedel
a22 a21
aii a
j 1
i, j
j i
56
Gauss-Siedel Method- Example 1
57
Improvement of Convergence Using
Relaxation
x i
new
x i
new
1 x old
i
58
Gauss-Seidel Method- Example 2
8 x1 x2 2 x3 20
3x1 x2 7 x3 34
2 x1 6 x2 x3 38 8x 1 x 2 2x 3 20
Rearrange so that
the equations are 2x 1 6x 2 x 3 38
diagonally dominant
3x 1 x 2 7 x 3 34
20 x2 2 x3 38 2 x1 x3 34 3x1 x2
x1 x2 x3
8 6 7
59
Gauss-Seidel Method- Example 2
60
Gauss-Seidel Method- Example 2
62
Iterative Solution Methods - Comparasion
63
Convergence of Iterative Solution Methods
Rewrite given system: [A]{x} = { [B] + [E] } {x} = {b}
where [B] is diagonal, or triangular so we can solve
[B]{y} = {g} quickly. Thus,
[B] {x}j+1= {b}– [E] {x}j
which is effectively: {x}j+1 = [B]-1 ({b} – [E] {x}j )
True solution {x}c satisfies: {x}c = [B]-1 ({b} – [E] {x}c)
Subtracting yields: {x}c – {x}j+1= – [B]-1 [E] [{x}c – {x}j]
So ||{x}c – {x}j+1 || ||[B]-1 [E]|| ||{x}c – {x}j ||
Iterations converge linearly if || [B]-1 [E] || < 1
=> || ([D] + [Lo])-1 [Uo] || < 1 For Gauss-Seidel
=> || [D] -1 ([Lo] + [Uo]) || < 1 For Jacobi
64
Convergence of Iterative Solution Methods
bi a i1 a a in
xi x1 i2 x 2 xn
a ii a ii a ii a ii
a ij
with all < 1.0, i.e., small slopes.
a ii
65
Convergence of Iterative Solution Methods
ji
Notes:
1. If the above does not hold, still may
converge.
2. This looks similar to infinity norm of [A]
66
Why Iterative Solutions?
• Effort:
68
Software: Excel
The Ctrl and Shift keys are held down while the Enter key is 69
depressed to perform the function.
Software: Matlab (MATrix LABoratory) / Octave
70
71