L03 MAE507 LU Cholesky Decomp
-
Upload
muhammad-saad-khan-tareen -
Category
Documents
-
view
238 -
download
0
Transcript of L03 MAE507 LU Cholesky Decomp
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
1/47
September 3, 2015
Slide 1
!" $%&'()'*+,'-
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
2/47
September 3, 2015
Slide 2
! .-/ " 0.12+&%*
! "#$%& '&()*+,-)& .)/&(0
! 122%& '&()*+,-)& .)/&(0
#
$
$
$
$
%
&
44
3433
242322
13131211
u000
uu00
uuu0
uuuu
U
#
$
$
$
$
%
&
44344241
333231
2221
11
llll
0lll
00ll
000l
L
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
3/47
September 3, 2015
Slide 3
!" $%&'()'*+,'-! 3*#/4%& 5%/4#6 7#& 8#-9(*+ 5)/&(0 %:,);#*8
!
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
4/47
September 3, 2015
Slide 4
!" $%&'()'*+,'-!
388,5% /4%&% %0(8/8 G!H
! I,?4 /4)/
! '4(8 (52-(%8
{ } { } { } { }
bxAdxUL
bdL&AUL
#
$
$
$
$
%
&
44344241
333231
2221
11
llll
lll
ll
l
L
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
5/47
'4% I/%28 #7 "1 >%?#52#8(;#*
[ ] [ ] [ ]
[ ] [ ]{ } { }
x B
L U A
L U
=
=
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
6/47
September 3, 2015
Slide 6
!" $%&'()'*+,'-
! "1 >%?#52#8(;#*
J K)8%6 #* D),88 %-(5(*);#*
J .#&% %L?(%*/
! >%?#52#8(;#* .%/4#68C*#/ ,*(:,%F
J >##-(M-% 6%?#52#8(;#* 3++4 5
J N,/ 6%?#52#8(;#* 6++4 5 C#5(M%6F
J N4#-%8BO 6%?#52#8(;#* C7#& 8O55%/&(? 5)/&(?%8F 6++4 3++
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
7/47
September 3, 2015
Slide 7
!" $%&'()'*+,'-'4&%% K)8(? I/%28
CPF Q)?/#& C6%?#52#8%F G7H (*/#
G!H )*6 G"H
CRF +(9%* S8TU 6%/%&5(*% S/T 7
G!HS/T V S8T
CWF ,8(*+ G"HS9T V S/T )*6 =)?B@
8,=8;/,;#*U 8#-9% 7#& S9T
!
369)*/)+%X Y*?% $% 4)9% G!H)*6 G"HU $% ?)* ,8% 5)*O
6(Z%&%*/ S8T8 $(/4#,/
&%2%);*+ /4% 6%?#52#8(;#*
2?%88
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
8/47
September 3, 2015
Slide 8
!" $%&'()'*+,'-
! !"6%?#52#8(;#* [ 7)?/#&(\);#*
G7H S9T V G !H G "H S9T V S 8T
!
Q#&$)&6 8,=8;/,;#*G !H S /T V S 8T
! K)?B 8,=8;/,;#*
G "H S9T V S /T!
Q#&$)&6 8,=8;/,;#*8 )&% 5#&% %L?(%*/
/4)* %-(5(*);#*
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
9/47
September 3, 2015
Slide 9
1
4
2
3
5
F14
F23F12
F24
F45
H1
F35
F25
V2
V1
Simple Truss
W
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
10/47
September 3, 2015
Slide 10
:9.()%;
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
11/47
September 3, 2015
Slide 11
!"
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
12/47
September 3, 2015
Slide 12
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
13/47
September 3, 2015
Slide 13
A.&B =68*,16,'-
#
$
%
&
'
#
$
%
&
'
#
$
%
&
'
(
(
(
(
)
*
+
+
+
+
,
-
4
3
2
1
444
434333
424323222
414313212111
4
3
2
1
44
3433
242322
14131211
d
d
d
d
xu
xuxu
xuxuxu
xuxuxuxu
x
x
x
x
u000
uu00
uuu0
uuuu
xU
#
$
%
%
%
&
1141431321211
2242432322
3343433
4444
uxuxuxudx
uxuxudx
uxudx
udx
/)(
/)(
/)(
/Identical to
Gauss
elimination
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
14/47
September 3, 2015
Slide 14
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
15/47
September 3, 2015
Slide 15
A.&BC=68*,16,'-
#
$
%
%
13/70x3x21x
8/35x2x
4/352x4x
33/707033/x
431
32
43
4
#
$
$
$
$
%
&
'
'
33/70
4/35
8/35
13/70
x}{
}
33
2
0
1
x
x
x
x
70000
4100
0420
3201
xU
4
3
2
1
#
$
%
&
'
(
#
$
%
&
'
)
)
)
)
*
+
,
,
,
,
-
.
(
(
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
16/47
September 3, 2015
Slide 16
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
17/47
Forward and Back Substitutions
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
18/47
Example: Forward and Back Substitutions
A=[1 0 2 3; -1 2 2 -3; 0 1 1 4; 6 2 2 4];b=[1 -1 2 1]';
[L,U] = LU_factor(A);L =
1.0000 0 0 0-1.0000 1.0000 0 0
0 0.5000 1.0000 06.0000 1.0000 14.0000 1.0000
U =1 0 2 30 2 4 00 0 -1 40 0 0 -70
x=LU_solve(L,U,b)x =
-0.18570.2286-0.11430.4714
Forward and back
substitution
(without pivoting) MATLABM-file
LU_factor
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
19/47
September 3, 2015
Slide 19
D+E',-F +- !" $%&'()'*+,'-
! I;-- *%%6 2(9#;*+ (* "1 6%?#52#8(;#*
! .%88%8 ,2 #&6%& #7 G!H
!
A4)/ /# 6#`
! a%%6 /# 2(9#/ =#/4 G!H )*6 ) 2%&5,/);#*
5)/&(0 GDH!
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
20/47
September 3, 2015
Slide 20
!" $%&'()'*+,'- @+1G D+E',-F
! b%&5,/);#* 5)/&(0 G DH
@ 2%&5,/);#* #7 (6%*;/O 5)/&(0 G HH
! b%&5,/);#* 5)/&(0 2%&7#&58 =##BB%%2(*+)88#?()/%6 $(/4 /4% $%0?4)*+%8
!
b%&5,/%6 5)/&(0 G DH G7H! "1 7)?/#&(\);#* #7 /4% 2%&5,/%6 5)/&(0
G DH G7H V G !H G "H
! I#-,;#*
G !H G "H S0T V G D H S=T
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
21/47
September 3, 2015
Slide 21
D%2(61.,'- 0.12+9
!
K##BB%%2(*+ 7#& $ %0?4)*+%8! E0)52-%X G D5H (*/%&?4)*+%8 $ P )*6 W
! .,-;2-% 2%&5,/);#*8 G DH
#
$
$
$
$
%
&
#
$
$
$
$
%
&
#
$
$
$
$
%
&
44434241
14131211
24232221
34333231
44434241
34333231
24232221
14131211
aaaa
aaaa
aaaa
aaaa
aaaa
aaaa
aaaa
aaaa
1000
0001
0010
0100
#
$
$
$
$
%
&
#
$
$
$
$
%
&
#
$
$
$
$
%
&
14131211
44434241
24232221
34333231
44434241
34333231
24232221
14131211
aaaa
aaaa
aaaa
aaaa
aaaa
aaaa
aaaa
aaaa
0001
1000
0010
0100
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
22/47
September 3, 2015
Slide 22
#
$
$
$
$
%
&
'
14226
24110
13221
13201
bA
!" $%&'()'*+,'- @+1G D+E',-F
1x4x2x2x6
2x4xx
1x3x2x2x
1x3x2x
4321
432
4321
431
#
$
$
$
$
%
&
#
$
$
$
$
%
&
#
$
$
$
$
%
&
'
1
1
1
1
P
1
1
1
1
L
4226
4110
3221
3201
A
Start with
No need to consider {b} in decomposition
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
23/47
September 3, 2015
Slide 23
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
24/47
September 3, 2015
Slide 24
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
25/47
September 3, 2015
Slide 25
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
26/47
September 3, 2015
Slide 26
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
27/47
September 3, 2015
Slide 27
!" $%&'()'*+,'- @+1G D+E',-F
#
$
$
$
$
%
&
#
$
$
$
$
%
&
'
0100
0001
0010
1000
P
4226
4110
3221
3201
A ;
#
$
%
&
'
(
)
)
)
)
*
+
,
,
,
,
-
.
(
)
)
)
)
*
+
,
,
,
,
-
.
(
(
2
1
1
1
bP
5000
2200
7/37/37/30
4226
U
103/70
011/71/6
0011/6
0001
L
Gauss elimination with partial pivoting
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
28/47
September 3, 2015
Slide 28
!" $%&'()'*+,'- @+1G D+E',-F
AP
4110
3201
3221
4226
5000
2200
7/37/37/30
4226
103/70
011/71/6
0011/6
0001
UL
#
$
$
$
$
%
&
'
#
$
$
$
$
%
&
'
#
$
$
$
$
%
&
'
'
#
$
%
&
'
(
#
$
%
&
'
)
#
$
%
&
'
(
#
$
%
&
'
*
*
*
*
+
,
-
-
-
-
.
/
(
(
33/14
5/7
5/6
1
d
d
d
d
2
1
1
1
d
d
d
d
103/70
011/71/6
0011/6
0001
dL
4
3
2
1
4
3
2
1
#
$
%
&
'
(
(
#
$
%
&
'
)
#
$
%
&
'
(
#
$
%
&
'
*
*
*
*
+
,
-
-
-
-
.
/
(
33/70
4/35
8/35
13/70
x
x
x
x
33/14
5/7
5/6
1
x
x
x
x
5000
2200
7/37/37/30
4226
xU
4
3
2
1
4
3
2
1
Forward
substitution
Back
substitution
Important
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
29/47
LU Decomposition with Pivoting
partial pivoting
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
30/47
LU Decomposition with PivotingA=[1 0 2 3; -1 2 2 -3; 0 1 1 4; 6 2 2 4];b=[1 -1 2 1]';
[L,U,P]=LU_pivot(A);L =
1.0000 0 0 0-0.1667 1.0000 0 00.1667 -0.1429 1.0000 0
0 0.4286 0 1.0000U =
6.0000 2.0000 2.0000 4.00000 2.3333 2.3333 -2.33330 0 2.0000 2.00000 0 0 5.0000
T1 =6 2 2 4
-1 2 2 -31 0 2 30 1 1 4
T2 =6 2 2 4-1 2 2 -31 0 2 3
0 1 1 4
T1 = [L][U]
T2 = [P][A]
Verify
T1= T2
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
31/47
LU Decomposition with Pivoting A=[1 0 2 3; -1 2 2 -3; 0 1 1 4; 6 2 2 4]; b=[1; -1; 2; 1]; [L,U,P]=LU_pivot(A); Pb=P*bPb =
1-112
x=LU_Solve(L,U,Pb)
d =1.0000-0.8333
00
d =1.0000-0.83330.7143
0d =
1.0000-0.83330.71432.3571
x =00
-0.11430.4714
x =0
0.2286-0.11430.4714
x =-0.18570.2286-0.11430.4714
x =-0.18570.2286-0.11430.4714
Forward Substitution Back Substitution
LU Decomposition
[L][U]{x} = [P]{b}
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
32/47
September 3, 2015
Slide 32
07>!7A
* 0%1G'/*
! "1 7)?/#&(\);#* G!I"H V -, C7F
@@ &%/,&*8 G!H )*6 G"H
! G!I "I DH V -, C7F
@@ &%/,&*8 )-8# /4% 2%&5,/);#* 5)/&(0 GbH! N4#-%8BO 7)?/#&(\);#*X JV ?4#-C7F
@@ G7H V GJHGJH'
! >%/%&5(*)*/X 6%/ C7F
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
33/47
.3'"3K 7,*?;#*lu
A=[1 0 2 3; -1 2 2 -3; 0 1 1 4; 6 2 2 4];
b=[1; -1; 2; 1];
[L,U]=lu(A)
L =
0.1667 -0.1429 1.0000 0
-0.1667 1.0000 0 0
0 0.4286 0 1.0000
1.0000 0 0 0
U =
6.0000 2.0000 2.0000 4.0000
0 2.3333 2.3333 -2.3333
0 0 2.0000 2.0000
0 0 0 5.0000
L*U
ans =
1 0 2 3
-1 2 2 -3
0 1 1 4
6 2 2 4
d=L\b
d =
1.0000-0.8333
0.7143
2.3571
x=U\d
x =
-0.1857
0.2286
-0.1143
0.4714
Forward and
Back
SubstitutionsLU Decomposition
without Pivoting
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
34/47
September 3, 2015
Slide 34
KG'3%*BL !"
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
35/47
=&2+)1 M3% N'2 KG'3%*BL $%&'()'*+,'-
Symmetric MatrixL= U
Compute only the upper triangular elements
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
36/47
A=[9 -6 12 -3; -6 5 -9 2; 12 -9 21 0; -3 2 0 6]A =
9 -6 12 -3-6 5 -9 212 -9 21 0-3 2 0 6
[L,U] = Cholesky(A)
L = 3 0 0 0-2 1 0 04 -1 2 0-1 0 2 1
U =3 -2 4 -10 1 -1 00 0 2 20 0 0 1
Symmetric
[L] = [U]
6023
021912
2956
31269
A
#
$
$
$
$
%
&
'
'
'
'
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
37/47
07>!7A
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
38/47
September 3, 2015
Slide 38
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
39/47
September 3, 2015
Slide 39
$''3+O3% !" $%&'()'*+,'-
! >##-(M-% 3-+#&(/45
D%/ P
8 #* 6()+#*)- #7 G!HC3++ 45P
! Y2%&)/% #* $8 )*6 ?#-,5*8 8%:,%*;)--OU
*)&$(*+ 6#$* /# 8(*+-% %-%5%*/
!
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
40/47
September 3, 2015
Slide 40
$''3+O3% !" $%&'()'*+,'-
#
$
$
$
$
%
&
#
$
$
$
$
%
&
#
$
$
$
$
%
&
44
3433
242322
14131211
434241
3231
21
44434241
34333231
24232221
14131211
u000
uu00
uuu0
uuuu
1lll
01ll
001l
0001
aaaa
aaaa
aaaa
aaaa
A
st
21 21 11 31 31 11 41 41 111 column: / ; / ; /l a u l a u l a u= = =
1414131312121111
stau;au;au;au:row1
uululululululululul
uululuululululul
uuluuluulul
uuuu
A
44344324421441334323421341224212411141
34243214313323321331223212311131
2414212313212212211121
14131211
#
$
$
$
$
%
&
By hand
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
41/47
September 3, 2015
Slide 41
$''3+O3% !" $%&'()'*+,'-
nd
31 12 32 22 32 41 12 42 22 42
32 32 31 12 22
42 42 41 12 22
2 column: ;
( ) /
( ) /
l u l u a l u l u a
l a l u u
l a l u u
+ = + =
= !"#
= !$
nd
21 12 22 22 21 13 23 23 21 14 24 24
22 22 21 12
23 23 21 13
24 24 21 14
2 : ; ;row l u u a l u u a l u u a
u a l u
u a l u
u a l u
+ = + = + =
= !"#
= !$#
=
!%
uululululululululul
uululuululululul
uuluuluulul
uuuu
A
44344324421441334323421341224212411141
34243214313323321331223212311131
2414212313212212211121
14131211
#
$
$
$
$
%
&
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
42/47
September 3, 2015
Slide 42
$''3+O3% !" $%&'()'*+,'-
rd
43 43 41 13 42 23 333 column: ( ) /l a l u l u u= ! !
31 13 32 23 33 33 31 14 32 24 34 34
33 33 31 13 32 23
34 34 31 14 32 24
3 : ;rd
row l u l u u a l u l u u a
u a l u l u
u a l u l u
+ + = + + =
= ! !"#
= ! !$
th
44 44 41 14 42 24 43 344 row: u a l u l u l u= ! ! !
uululululululululul
uululuululululul
uuluuluulul
uuuu
A
44344324421441334323421341224212411141
34243214313323321331223212311131
2414212313212212211121
14131211
#
$
$
$
$
%
&
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
43/47
September 3, 2015
Slide 43
3-+#&(/45 #7 >##-(M-% >%?#52#8(;#*
[ ][ ]
1, 1,
,1 ,1 1,1
[ ] [ ][ ] ( by matrix)
Staring the first row of , , for 1, 2,......, ;
then the first column of , / , for 2,......, ;
Then alternatively determine the 2nd row o
i i
j j
A L U N N
U u a i N
L l a u j N
=
= =
= =
[ ]
[ ]
[ ]
2, 2, 2,1 1,
,2 ,2 ,1 1,2 2,2
1th
, , , ,1
th
f ,
for 2,3,......, ;
and 2nd column of ;
( ) / , for 3,......, ; then
and n row of , for ,..., ;
and n column of
i i i
j j j
n
n i n i n k k ik
U
u a l u i N
L
l a l u u j N
U u a l u i n N
!
=
= ! =
= ! =
=
! =
"
! !
[ ]1
, , , , ,1
, / ,
for 1,..., ; ..........until row of [ ].
n
j n j n j k k n n nk
th
L l a l u u
j n N N U
!
=
# $= !% &
% &' (
= +
"
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
44/47
September 3, 2015
Slide 44
KG'3%*BL !"
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
45/47
September 3, 2015
Slide 45
KG'3%*BL !"
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
46/47
September 3, 2015
Slide 46
KG'3%*BL !" $%&'()'*+,'-
11 11 12 12 11 13 13 11 14 14 111 column / row: u a ; u a /u ; u a /u ; u a /u
st
= = = =
22121424242212132323
2
122222
2422241214232223121322
2
22
2
12
nd
uuuauuuuauuau
auuuuauuuuauu:row/column2
/)(;/)(;
;;
33232413143434
2
23
2
133333
3434332423141333
2
33
2
23
2
13
rd
uuuuuauuuau
auuuuuuauuu:row/column3
/)(;
;
2
34
2
24
2
14444444
2
44
2
34
2
24
2
14
th
uuuauauuuu:row4
uuuuuuuuuuuuuuuu
uuuuuuuuuuuuuuu
uuuuuuuuuuuu
uuuuuuu
A
2
44
2
34
2
24
2
14333423241314222412141411
333423241314
2
33
2
23
2
13222312131311
2224121422231213
2
22
2
121211
141113111211
2
11
#
$
$
$
$
%
&
-
7/24/2019 L03 MAE507 LU Cholesky Decomp
47/47
:9.()3%; KG'3%*BL !"
13/3; u43/12; u23/6; u39u:column/row114131211
st
012)1)(2u112)49u125u
2uuuu9uuuu5uu:column/row2
2423
2
22
2224121422231213
2
22
2
12
nd
/)((;/)((;)(
;;
2210410u21421u
0uuuuuu21uuu:column/row3
34
22
33
343324231413
2
33
2
23
2
13
rd
/)))(())(((;)()(
;
2222222th
uuuuuuuuuuuuuuuu
uuuuuuuuuuuuuuu
uuuuuuuuuuuu
uuuuuuu
6023
021912
2956
31269
A
2
44
2
34
2
24
2
14333423241314222412141411
333423241314
2
33
2
23
2
13222312131311
2224121422231213
2
22
2
121211
141113111211
2
11
#
$
$
$
$
%
&
#
$
$
$
$
%
&
'
'
'
'