1.17k likes | 3.91k Vues
Lecture 11 - LU Decomposition. CVEN 302 June 26, 2002. Lecture’s Goals. LU Decomposition Doolittle’s technique Cholesky’s technique Pivoting of matrices Tridiagonal Method. LU Decomposition (Doolittle’s method). Matrix decomposition. Doolitte’s method.
E N D
Lecture 11 - LU Decomposition CVEN 302 June 26, 2002
Lecture’s Goals • LU Decomposition • Doolittle’s technique • Cholesky’s technique • Pivoting of matrices • Tridiagonal Method
LU Decomposition (Doolittle’s method) • Matrix decomposition
Doolitte’s method The method alternates from solving from the upper triangular to the lower triangular
General formulation of Doolittle’s The problem is reverse of the Crout’s reduction, starting with the upper triangular matrix and going to the lower triangular matrix.
LU Programs • There are two programs • LU_factor - the program does a Doolittle decomposition of a matrix and returns the L and U matrices • LU_solver uses an L and U matrix combination to solve the system of equations.
Example • The matrix is broken into a lower and upper triangular matrices.
Cholesky’s method The Cholesky decomposition is used on symmetric positive definite matrix: where, lii = uii
Cholesky’s Method The method does not alternate but does it from the diagonal out.
Cholesky’s Method The second row in.
Cholesky’s Method General Method
Cholesky’s Method General Method
Example The matrices can contain imaginary values.
LU Programs • Test program • LU_cholesky_factor - the program does a Cholesky’s decomposition of a matrix and returns the L and U matrices • LU_Solve uses an L and U matrix combination to solve the system of equations.
Tridiagonal Matrix For a banded matrix using Doolittle’s method, i.e. a tridiagonal matrix.
Tridiagonal LU Decomposition The tridiagonal solver first step: The second step:
Tridiagonal LU Decomposition The tridiagonal solver for LU decomposition breaks down into form:
LU Programs for Tridiagonal Matrices • Test program • [dd,bb]=LU_tridiag(a,d,b) - the program does a decomposition of a tridiagonal matrix and returns the lower diagonal of L and the diagonal of U matrices • x = LU_tridiag_solve(a,dd,b,r) uses the lower diagonal of the L matrix and the diagonal and a vectors of the U matrix combination to solve the system of equations r is the right hand side.
Pivoting of the LU Decomposition • Still need pivoting in LU decomposition • Messes up order of [L] • What to do? • Need to pivot both [L] and a permutation matrix [P] • Initialize [P] as identity matrix and pivot when [A] is pivoted Also pivot [L]
Pivoting of the LU Decomposition • Permutation matrix [ P ] - permutation of identity matrix [ I ] • Permutation matrix performs “bookkeeping” associated with the row exchanges • Permuted matrix [ P ] [ A ] • LU factorization of the permuted matrix [ P ] [ A ] = [ L ] [ U ]
Permutation Matrix • Bookkeeping for row exchanges • Example: [ P1] interchanges row 1 and 3 • Multiple permutations [ P ]
LU Decomposition with Pivoting Start with No need to consider {b} in decomposition
Forward Elimination Interchange rows 1 & 4 Gaussian elimination of first column Save -mi1in the first column of [L]
Forward Elimination No interchange required Gaussian elimination of second column Save -mi2in the second column of [L]
Forward Elimination Interchange rows 3 &4 Partial pivoting for [L] and [P]
Forward Elimination Gaussian elimination of third column Save -mi3 in third column of [L]
Doolittle LU with Pivoting Gauss elimination with partial pivoting
Doolittle LU with Pivoting Forward substitution Back substitution
LU Pivoting Program • Test program • [L U P]=LU_pivot(A) - the program does a decomposition of a matrix and returns the L and U matrices and P matrix which represents the pivoting problem.
Summary • Setup of the LU decomposition techniques. • Doolittle’s method • Cholesky’s method is for symmetric positive definite matrices • Tridiagonal matrices compression techniques • Pivoting of matrices
Homework • Check the Homework webpage