Is there a fast rank k cholupdate?
4 次查看(过去 30 天)
显示 更早的评论
Is there/will there be a rank k update to a cholesky factor? LAPACK has a symmetric rank k (but not cholupdate that I can find) and LINPACK I think had a rank k cholupdate, but the matlab version seems to be only rank one.
Further, doing the updates in a loop is slower by about 0.04s than just squaring the original matrices, updating, and doing the chol. For example, when moment matching with square roots of covariances its faster to square the covariance, do the moment matching and take chols. That is:
Given
for i=1:n;U(:,:,i) = chol(X(:,:,i));end %where each X is a covariance matrix of size p,
x(:,i) is a mean vector of length p, x is (p by n), and w(i) is a weight such that sum(w)==1, and all(w>0)
Then the loop:
Ufin = zeros(p,p);
for i=1:n; Ufin = Ufin + w(i)*(U(:,:,i)'*U(:,:,i) + x(:,i)*x(:,i)');end
xfin = x*w;
Ufin = Ufin - xfin*xfin';
Ufin = chol(Ufin);
is faster than:
x = bsxfun(@minus,x,x*w);
Ufin = w(1)*cholupdate(U(:,:,1),x(:,1));
for i=2:n;
U(:,:,i) = w(i)*cholupdate(U(:,:,i),x(:,i));
for j=1:p; Ufin=cholupdate(Ufin,U(j,:,i)'); end
end
My assumption is that the second loop over p is the cause of the slowdown (the first takes about 0.008s for p=60 while the second takes 0.05s). The first method seems silly, but its faster than the second. Is there an alternative? Will the rank k be added in the future?
Thank you
0 个评论
回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!