I want to implement incomplete Cholesky factorization to precondition, the algorithm I refer from incomplete Cholesky factorization,
function a = ichol(a) n = size(a,1); for k=1:n a(k,k) = sqrt(a(k,k)); for i=(k+1):n if (a(i,k)!=0) a(i,k) = a(i,k)/a(k,k); endif endfor for j=(k+1):n for i=j:n if (a(i,j)!=0) a(i,j) = a(i,j)-a(i,k)*a(j,k); endif endfor endfor endfor for i=1:n for j=i+1:n a(i,j) = 0; endfor endfor endfunction
but it seems not right.
The problem is the algorithm cannot guarantee that
a[k,k] is a positive integer. When
a[k,k] is not a positive integer, the algorithm will incur an error.
I want to ask for the correct version of Cholesky decomposition and some relevant references.