hw3_solutions

# hw3_solutions - [L11 U11 = hw3lu(A11 triangular solve for...

This preview shows pages 1–3. Sign up to view the full content.

Exercise

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Computer Problems Additional function [L,U] = hw3lu (A) %HW3LU: [L,U] = hw3lu (A) computes the LU factorization of A. % L is computed one row at a time; U is computed one column at a time. [m n] = size (A) ; if (m ~= n) error ( 'A must be square' ) ; end if (n == 1) L = 1 ; U = A ; else % define A11, A12, A21, and A22: A11 = A (1:n-1, 1:n-1) ; A21 = A (n,1:n-1) ; A12 = A (1:n-1,n) ; A22 = A (n,n) ; % compute the LU factorization of A11
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: [L11, U11] = hw3lu (A11) ; % triangular solve for L21 (solve L21 * U11 = A21 for L21): L21 = A21 / U11 ; % triangular solve for U12 (solve L11 * U12 = A12 for U12): U12 = L11 \ A12 ; % Let L22 = 1 L22 = 1 ; % compute U22 by solving L21*U12 + L22*U22 = A22 for U22: U22 = A22 - L21*U12 ; % glue the results together L = [L11 zeros(n-1,1) ; L21 L22] ; U = [U11 U12 ; zeros(1,n-1) U22] ; end...
View Full Document

## This note was uploaded on 01/18/2010 for the course COT 4501 taught by Professor Davis during the Fall '08 term at University of Florida.

### Page1 / 3

hw3_solutions - [L11 U11 = hw3lu(A11 triangular solve for...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online