function R=cholesky(K,eta) %function R=cholesky(K,eta) % % Performs inncomplete cholesky of the kernel matrix K % %INPUTS % K = the kernel matrix (ell x ell matrix) % eta = tolerance parameter % %OUTPUTS % R = the T first cholesky components of K (R is ell x T) % % %For more info, see www.kernel-methods.net % original kernel matrix stored in variable K % of size ell x ell. % new features stored in matrix R of size T x ell % eta gives threshold residual cutoff ell=size(K,1); j = 0; R = zeros(ell,ell); d = diag(K); [a,I(j+1)] = max(d); while a > eta j = j + 1; nu(j) = sqrt(a); for i = 1:ell R(j,i) = (K(I(j),i) - R(:,i)'*R(:,I(j)))/nu(j); d(i) = d(i) - R(j,i)^2; end [a,I(j+1)] = max(d); end T = j; R = R(1:T,:);