1function [LD,p,q] = ldlchol (A,beta) %#ok 2%LDLCHOL sparse A=LDL' factorization 3% Note that L*L' (LCHOL) and L*D*L' (LDLCHOL) factorizations are faster than 4% R'*R (CHOL2 and CHOL) and use less memory. The LL' and LDL' factorization 5% methods use tril(A). A must be sparse. 6% 7% Example: 8% LD = ldlchol (A) return the LDL' factorization of A 9% [LD,p] = ldlchol (A) similar [R,p] = chol(A), but for L*D*L' 10% [LD,p,q] = ldlchol (A) factorizes A(q,q) into L*D*L', where q is a 11% fill-reducing ordering 12% LD = ldlchol (A,beta) return the LDL' factorization of A*A'+beta*I 13% [LD,p] = ldlchol (A,beta) like [R,p] = chol(A*A'+beta+I) 14% [LD,p,q] = ldlchol (A,beta) factorizes A(q,:)*A(q,:)'+beta*I into L*D*L' 15% 16% The output matrix LD contains both L and D. D is on the diagonal of LD, and 17% L is contained in the strictly lower triangular part of LD. The unit- 18% diagonal of L is not stored. You can obtain the L and D matrices with 19% [L,D] = ldlsplit (LD). LD is in the form needed by ldlupdate. 20% 21% Explicit zeros may appear in the LD matrix. The pattern of LD matches the 22% pattern of L as computed by symbfact2, even if some entries in LD are 23% explicitly zero. This is to ensure that ldlupdate and ldlsolve work 24% properly. You must NOT modify LD in MATLAB itself and then use ldlupdate 25% or ldlsolve if LD contains explicit zero entries; ldlupdate and ldlsolve 26% will fail catastrophically in this case. 27% 28% You MAY modify LD in MATLAB if you do not pass it back to ldlupdate or 29% ldlsolve. Just be aware that LD contains explicit zero entries, contrary 30% to the standard practice in MATLAB of removing those entries from all 31% sparse matrices. LD = sparse2 (LD) will remove any zero entries in LD. 32% 33% See also LDLUPDATE, LDLSOLVE, LDLSPLIT, CHOL2, LCHOL, CHOL, SPARSE2 34 35% Copyright 2006-2007, Timothy A. Davis, http://www.suitesparse.com 36 37error ('ldlchol mexFunction not found') ; 38