I have cholrank1 update procedure (wikipedia) for the symmetric positive definite (SPD) matrix.
function [L] = cholupdate(L,x)
p = length(x);
for k=1:p
r = sqrt(L(k,k)^2 + x(k)^2);
c = r / L(k, k);
s = x(k) / L(k, k);
L(k, k) = r;
L(k+1:p,k) = (L(k+1:p,k) + s*x(k+1:p)) / c;
x(k+1:p) = c*x(k+1:p) - s*L(k+1:p,k);
end
end
It works with LL decomposition. I try to fix procedure to work with LDL decomposition (ie without calling sqrt) like this:
function [L] = cholupdate_ldl(L,x)
p = length(x);
for k=1:p
r = L(k,k) + x(k)^2;
c = r / L(k, k);
s = x(k) / L(k, k);
L(k, k) = r;
L(k+1:p,k) = (L(k+1:p,k) + s*x(k+1:p)) / c;
x(k+1:p) = sqrt(c)*(x(k+1:p) - x(k)*L(k+1:p,k));
end
end
It works fine but I was forced to use sqrt. How can I update LDL decomposition without using sqrt at all?
There are a number of ways. See Gill, Golub, Murray and Saunders (1974): Methods for Modifying Matrix Factorizations in Mathematics of Computation. To summarize your question formally, I quote from the paper:


Finally we get to the algorithm:

And here is my implementation in MATLAB:
function [L1,D1] = ldlt_update(L0,D0,z)
n = size(L0,1) ;
D1 = zeros(n,n) ;
L1 = zeros(n,n) ;
a = 1 ;
w = z ;
for jj = 1:n
p = w(jj) ;
D1(jj,jj) = D0(jj,jj) + a*p^2 ;
b = p*a/D1(jj,jj) ;
a = D0(jj,jj)*a/D1(jj,jj) ;
for r = jj+1:n
w(r) = w(r) - p*L0(r,jj) ;
L1(r,jj) = L0(r,jj) + b*w(r) ;
end
end
end
There is an alternative algorithm in the paper cited above and in Gill, Murray, and Wright (1982): Practical Optimization. Brian Borchers has a complete set of MATLAB code for working with real symmetric positive definite LDLT factorizations as defined in Golub and Van Loan (2013): Matrix Computations and on his web site.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With