next up previous contents
Next: Solution Up: Procedures Previous: Solution

 

LU Decomposition

Matrices are used widely in Numerical Computing, many alogirithms inolve decomposing a matrix, A into an equivalent pair L and U, where L and U are lower and upper triangular matrices respectively and tex2html_wrap_inline3050 .

Consider the following system of equations,

eqnarray2563

here

equation2565

so

equation2570

and

equation2575

Both L and U can be stored in the same matrix; since the diagonal of L is always unity it does not have to be store, the combined LU matrix can be stored as

equation2581

Now, given that

equation2586

then we solve for tex2html_wrap_inline3060 where

equation2593

(recall that the diagonal of L will be all 1s) and then solve

equation2597

The advantage of this method is that the triangular system of equations is very easy to slove. tex2html_wrap_inline3066 can be sloved by forward substitution and tex2html_wrap_inline3068 by backward substitution. tex2html_wrap_inline3060 is calculated by forward substitution as follows :

eqnarray2608

Once tex2html_wrap_inline3060 is known tex2html_wrap_inline3074 can easily be obtained by backwards substitution:

eqnarray2623

The LU decomposition algorithm is as follows:

For each row k from 1 to n-1 in order,

The algorithm will not work if the A matrix is singular, that is, if any of the rows of A are all zero.

This algorithm omits the issue of pivoting so can be unstable - your program will work for the 3 by 3 matrix givenm here.

The an HPF program with subroutines to perform LU decomposition and foward and backwards substitution.




next up previous contents
Next: Solution Up: Procedures Previous: Solution

Adam Marshall ©University of Liverpool, 1996
Fri Dec 6 14:10:26 GMT 1996