UW AMATH 352 - Lecture 9: Op Count for Gaussian Elimination

Unformatted text preview:

Lecture 9 Op Count for Gaussian Elimination Pivoting for Stability AMath 352 Fri Apr 16 1 17 No of operations cid 80 n 1 cid 80 n j 1 i j 1 no of ops done inside the Ops done inside the double loop 2 n j 5 double loop Total ops n 1 cid 88 n cid 88 j 1 i j 1 2 n j 5 2 n j 2 5 n j n 1 cid 88 j 1 Operation Count for GE Gaussian elimination without pivoting for j 1 n 1 Loop over columns for i j 1 n Loop over rows below row j mult A i j A j j 1 div A i j n A i j n mult A j j n n j 1 mults and n j 1 adds b i b i mult b j 1 mult and 1 add end end 2 17 Ops done inside the double loop 2 n j 5 Total ops n 1 cid 88 n cid 88 j 1 i j 1 2 n j 5 2 n j 2 5 n j n 1 cid 88 j 1 Operation Count for GE Gaussian elimination without pivoting for j 1 n 1 Loop over columns for i j 1 n Loop over rows below row j mult A i j A j j 1 div A i j n A i j n mult A j j n n j 1 mults and n j 1 adds b i b i mult b j 1 mult and 1 add end end No of operations cid 80 n 1 j 1 double loop cid 80 n i j 1 no of ops done inside the 2 17 Total ops n 1 cid 88 n cid 88 j 1 i j 1 2 n j 5 2 n j 2 5 n j n 1 cid 88 j 1 Operation Count for GE Gaussian elimination without pivoting for j 1 n 1 Loop over columns for i j 1 n Loop over rows below row j mult A i j A j j 1 div A i j n A i j n mult A j j n n j 1 mults and n j 1 adds b i b i mult b j 1 mult and 1 add end end No of operations cid 80 n 1 j 1 double loop Ops done inside the double loop 2 n j 5 cid 80 n i j 1 no of ops done inside the 2 17 Operation Count for GE Gaussian elimination without pivoting for j 1 n 1 Loop over columns for i j 1 n Loop over rows below row j mult A i j A j j 1 div A i j n A i j n mult A j j n n j 1 mults and n j 1 adds b i b i mult b j 1 mult and 1 add end end No of operations cid 80 n 1 j 1 double loop Ops done inside the double loop 2 n j 5 Total ops cid 80 n i j 1 no of ops done inside the n 1 cid 88 n cid 88 j 1 i j 1 n 1 cid 88 j 1 2 n j 5 2 n j 2 5 n j 2 17 Therefore n 1 cid 88 j 1 2 n j 2 5 n j 2 n 1 n 2n 1 n 1 n 6 5 2 2 3 n3 O n2 Operation Count for GE Cont n 1 cid 88 j 1 2 n j 2 5 n j m cid 88 i 1 i 1 2 m no of terms times avg term m m 1 2 m cid 88 i 1 i 2 m m 1 2m 1 6 3 17 Operation Count for GE Cont n 1 cid 88 j 1 2 n j 2 5 n j m cid 88 i 1 n 1 cid 88 j 1 Therefore i 1 2 m no of terms times avg term m m 1 2 m cid 88 i 1 i 2 m m 1 2m 1 6 2 n j 2 5 n j 2 n 1 n 2n 1 6 5 n 1 n 2 2 3 n3 O n2 3 17 If you forget the exact formula m cid 88 i 1 i p x p dx cid 90 m 0 x p 1 p 1 cid 12 m cid 12 cid 12 cid 12 0 mp 1 p 1 More precisely m cid 88 i 1 i p mp 1 p 1 O mp 4 17 Op Count for Solving Upper Triangular System u11 u12 0 u22 0 0 u1n u2n unn x1 x2 xn y1 y2 yn xn yn unn xn 1 yn 1 un 1 nxn un 1 n 1 In genl xi yi ui j xj uii i n n 1 1 n cid 88 j i 1 Op count cid 80 n i 1 work to compute xi n cid 88 i 1 1 2 n i n 2 n2 O n n 1 n 2 5 17 Solving Linear Systems with Multiple Right Hand Sides cid 73 Work for GE 2 3 n3 O n2 If it takes 1 second to solve a 1000 by 1000 linear system it takes 23 8 seconds to solve a 2000 by 2000 linear system cid 73 Work for solving a triangular system upper or lower n2 O n If you want to solve A cid 126 x1 cid 126 b1 A cid 126 x2 cid 126 b2 factor A LU once then solve L cid 126 yj cid 126 bj U cid 126 xj cid 126 yj j 1 2 Work is about 2 3 n3 2n2 no of right hand sides 6 17 One possible x If A j j 0 search through that column to nd a nonzero say A k j k j Interchange row k and row j and do the elimination If no nonzero is found in the column return with an error message Matrix is singular Why is this matrix singular 0 0 0 a11 a12 a13 a14 a22 a23 a24 0 0 0 0 a34 a44 Pivoting The GE codes that we have looked at so far may fail What if the denominator in mult A i j A j j is 0 7 17 Why is this matrix singular 0 0 0 a11 a12 a13 a14 a22 a23 a24 0 0 0 0 a34 a44 Pivoting The GE codes that we have looked at so far may fail What if the denominator in mult A i j A j j is 0 One possible x If A j j 0 search through that column to nd a nonzero say A k j k j Interchange row k and row j and do the elimination If no nonzero is found in the column return with an error message Matrix is singular 7 17 Pivoting The GE codes that we have looked at so far may fail …

View Full Document

# UW AMATH 352 - Lecture 9: Op Count for Gaussian Elimination

Pages: 34
Documents in this Course

13 pages

26 pages

19 pages