Graphics Programs Reference
In-Depth Information
ending up with
⎡
⎣
⎤
⎦
U
11
U
12
U
13
0
U
22
U
23
00
U
33
A
=
U
=
The foregoing illustrationreveals two importantfeatures of Doolittle's decompo-
sition:
The matrix
U
is identicaltotheupper triangular matrix that results from Gauss
elimination.
The off-diagonal elements of
L
are the pivot equationmultipliers used during
Gauss elimination; that is,
L
i j
is the multiplier thateliminated
A
i j
.
It is usual practice to store the multipliers in the lower triangular portion of the
coefficient matrix, replacing the coefficients as theyareeliminated (
L
i j
replacing
A
i j
).
The diagonal elements of
L
do not havetobe stored,since it is understood thateach
of themis unity. The finalform of the coefficient matrix would thus be the following
mixtureof
L
and
U
:
⎡
⎣
⎤
⎦
U
11
U
12
U
13
L
21
U
22
U
23
L
31
[
L
\
U
]
=
(2.13)
L
32
U
33
The algorithm forDoolittle's decompositionisthus identical to the Gauss elim-
inationprocedure in
gauss
,exceptthateach multiplier
λ
is now storedinthe lower
triangular portion of
A
.
LUdec
In this version of LU decomposition the original
A
is destroyed and replacedbyits
decomposed form
[
L
\
U
]
.
functionA=LUdec(A)
%LUdecompositionofmatrixA;returnsA=[L\U].
%USAGE:A=LUdec(A)
n = size(A,1);
fork=1:n-1
fori=k+1:n
if A(i,k) ˜= 0.0
lambda = A(i,k)/A(k,k);
A(i,k+1:n) = A(i,k+1:n) - lambda*A(k,k+1:n);
Search WWH ::
Custom Search