1
function [L, D] = ldlrow (A)
2
%LDLROW an m-file description of the algorithm used by LDL
7
% Compute the L*D*L' factorization of A, by rows. Returns
8
% full L and D matrices. This routine serves as an outline
9
% of the numerical factorization performed by ldl.c.
11
% Here is a diagram of how L is computed. "a" means an
12
% entry that is accessed at the kth step, and "c" means an
13
% entry that is computed. A "-" means neither accessed nor
14
% computed. A "1" means the value of the entry is L (the
15
% unit diagonal of L), and it is accessed at the kth step.
16
% A "." means the value is zero.
24
% c c c c c . . . <- kth row of L
37
% - - - - a - - - <- kth row of A
50
% . . . . c . . . <- kth row of D
57
% Copyright 2006-2007 by Timothy A. Davis, Univ. of Florida
69
% note the sparse triangular solve. For the sparse
70
% case, the pattern of y is the same as the pattern of
72
y = L (1:k-1, 1:k-1) \ A (1:k-1, k) ;
75
L (k, 1:k-1) = (y ./ D (1:k-1))' ;
78
% compute the diagonal
79
D (k) = A (k,k) - L (k, 1:k-1) * y ;