Skip to main content
added 13 characters in body; edited tags
Source Link
Anton Menshov
  • 8.7k
  • 7
  • 41
  • 94

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.

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

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.

Source Link

Incomplete Cholesky factorization algorithm

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