Conjugate gradient with incomplete Cholesky preconditioner

It seems I wasn’t clear.
In option (3), the way I get it, one could select arbitrary number. Since the documentation mentioned the memory is multiplied by the nnz I though it means it is (2).

Anyhow, what about the diagonal modification? It is not mentioned on documentation but code does mention something like it.

Like I said, and as explained in the docstring, the total amount of memory is nnz(A) + p * n, where n is the matrix size. It’s not an arbitrary number, but it can be controled to some degree. I don’t know if that’s also what Matlab does.

The same docstring also mentions diagonal shift:

  • α::Tv=Tv(0) : initial value of the shift in case the incomplete LDLᵀ factorization of A is found to not exist. The shift will be gradually increased from this initial value until success.

The feature that’s not properly documented is that a negative shift is introduced at diagonal places where A[i,i] ≤ 0 to perform limited-memory SQD factorizations.

I am not talking about the diagonal shift. I am talking about what is called modified incomplete Cholesky factorization:

This is taken from Yousef Saad - Iterative Methods for Sparse Linear Systems (2nd Edition):

MATLAB’s ichol() borrows this trick from ILU into IC. I think the reference you use has done it as well (At least links to it).

Assume I understand all the documentation you have written. I am not talking about shifting, I am talking about diagonal compensation which improves the conditioning.

By the way, (3) means the user can chose arbitrary number of elements. If the user selected 5, the decomposition will leave the 5 largest components.
In (2) it means the memory allocation is a multiplication of the number of elements of the matrix to start with (As it saves components within l steps from the given structure).

From documentation I don’t understand what’s the policy you have. Also if the algorithm is (3) why are the memory allocations a multiplication of n?