In Matlab 2012 the cholinc command is marked as obsolete. The warning message says it is to be replaced by ichol. Until now I used cholinc(A,droptol), typically with droptol=1E-15. In the new version I tried to use ichol(A,struct('droptol',droptol,'type','ict')), which works most of the time, but sometimes I get a warning message
Error using ichol
Encountered nonpositive pivot.
Is this a fundamental problem (i.e. a problem cholinc also had but didn't report) or is there a way to make ichol behave in the way cholinc formerly did?
The error indicates that the incomplete Cholesky method has broken down, which is a well-known possibility for symmetric positive-definite, but not diagonally dominant matrices. That is, even if a matrix has a (complete) Cholesky factorization, it may not have an incomplete Cholesky factorization.
cholincdoesn't suffer breakdown because it is not a true incomplete Cholesky. Rather, it callsluincwith no pivoting, throws out L and then scales the resulting U to obtain a kind of incomplete Cholesky factor (see the doc forcholinc, first paragraph of the Algorithms section). You can obtain a factor very similar to that fromcholincby usingilu(note thatluincis also obsolete).Use of
icholis strongly encouraged, if possible. Note that you can use the'diagcomp'option to try to prevent breakdown in your factorization, but finding an effective parameteralphamay require experimentation. See the doc foricholfor an example. Whenicholdoes not breakdown, it tends to be much faster as it exploits symmetry. Also, it tends to produce sparser factors thancholincwhich results in faster application of the factor as a preconditioner, which can mean faster solution times withpcg. For example,To be fair, the timing of
cholincabove includes time to dispatch the warning, but a tic/toc of just a single warning shows that time to be in the noise of this particular computation.Finally, note that by default,
icholreferences the lower triangle of the input matrix and returns a lower triangular factor. Preferring lower triangular factors can give a notable performance increase:As a final remark, the drop tolerance of 1e-15 you reference above is very small. If that is the kind of tolerance you are using, you might be better off using a complete factorization such as
chol,ldl, orlu.