1function [L,D] = ldlsplit (LD) %#ok 2%LDLSPLIT split an LDL' factorization into L and D. 3% 4% Example: 5% [L,D] = ldlsplit (LD) 6% 7% LD contains an LDL' factorization, computed with LD = ldlchol(A), 8% for example. The diagonal of LD contains D, and the entries below 9% the diagonal contain L (which has a unit diagonal). This function 10% splits LD into its two components L and D so that L*D*L' = A. 11% 12% See also LDLCHOL, LDLSOLVE, LDLUPDATE. 13 14% Copyright 2006-2007, Timothy A. Davis, http://www.suitesparse.com 15 16n = size (LD,1) ; 17D = diag (diag (LD)) ; 18L = tril (LD,-1) + speye (n) ; 19