I want to implement incomplete Cholesky factorization to precondition, the algorithm I refer from [incomplete Cholesky factorization] (https://en.wikipedia.org/wiki/Incomplete_Cholesky_factorizationincomplete 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
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.
The problem is the algorithm cannot guarantee that a[k,k]
is a positive integer, when. When a[k,k]
is not a positive integer,the the algorithm will occurincur an error,I.
I want to ask for athe correct version of Cholesky decomposition,Can you give me and some relevant references,thanks in advance.