function ShowLDLSemiDef()

clc
format short
n = 6;
r = 4;
X = randn(n,r);
% Construct a matrix that is nearly rank r...
A = X*X' + diag(10^-6*rand(n,1));

[L,D,P] = ldl(A)
format long
diagEntries = diag(D)