how to write fast numerical code
play

How to Write Fast Numerical Code Spring 2011 Lecture 13 Instructor: - PowerPoint PPT Presentation

How to Write Fast Numerical Code Spring 2011 Lecture 13 Instructor: Markus Pschel TA: Georg Ofenbeck Miscellaneous No class next Monday, April 11 th (Sechseluten) Midterm exam: Friday, April 15 th Today Solving linear systems


  1. How to Write Fast Numerical Code Spring 2011 Lecture 13 Instructor: Markus Püschel TA: Georg Ofenbeck

  2. Miscellaneous No class next Monday, April 11 th (Sechseläuten)  Midterm exam: Friday, April 15 th 

  3. Today Solving linear systems  Linear system solving Matrix inversion Matrix inversion  Singular value decomposition ... and more PLU factorization  LAPACK Determinant  BLAS BLAS 1: vector-vector ops BLAS 2: matrix-vector ops BLAS 3: matrix-matrix ops Chapter 2 in James W. Demmel, Applied Numerical Linear Algebra, SIAM, 1997

  4. Gauss Elimination and LU Factorization A = [a k,l ] 1≤k,l≤n -a 2,1 /a 1,1 -a n,1 /a 1,1 A a 1,1 a 1,n 1 0 a 2,1 - 1 0 a 1,1 = ● A A’ a n,1 0 - 0 1 a 1,1 a 1,1 a 1,n 1 1 a 2,1 0 1 0 a’ 2,2 a’ 1,n 0 - 1 0 a 1,1 0 a’ 3,2 - ● A = ● a’ 2,2 a n,1 0 a’ n,2 0 A’ - - 1 1 0 0 0 a’ 2,2 a 1,1

  5. after n- 1 steps …. U = ● A 1 1 a 2,1 0 1 1 0 0 a 1,1 a’ 3,2 U ● = A a’ 2,2 a n,1 0 a’ n,2 0 1 1 0 a 1,1 a’ 2,2 1 a 2,1 1 0 a 1,1 a’ 3,2 U ● A = = L ● U a’ 2,2 a n,1 a’ n,2 1 a 1,1 a’ 2,2

  6. Summary Gauss elimination is LU factorization   We assume that the occurring diagonal elements a 1,1 , a’ 2,2 , … are all ≠ 0 (otherwise the LU factorization does not exist)  U = upper triangular  L = lower triangular (1’s on diagonal)  L contains the multipliers occurring in Gauss elimination Now Ax = b is LUx = b and can be solved in two steps:   Solve Ly = b  Solve Ux = y  Cost: n 2 + O(n) for each step = 2n 2 + O(n)

  7. LU Factorization: Algorithm From straightforward algorithm to optimized BLAS 3 based one  (blackboard) Chapter 2 in James W. Demmel, Applied Numerical Linear Algebra, SIAM, 1997

Recommend


More recommend