The code uses cholinc
to perform an incomplete Cholesky
factorization. MathWorks recommends that you use ichol
instead. The ichol
function uses less memory, executes much
faster, and provides more features than cholinc
.
Suppose your original code creates a preconditioner, R
, for
use with pcg
, as
follows:
R = cholinc(A, '0');
x = pcg(A, b, tol, maxit, R', R);
For better performance, and to maintain the shape of R
,
replace the original code with this:
R = ichol(A, struct('shape', 'upper'));
x = pcg(A, b, tol, maxit, R', R);
For best performance and memory usage, replace the original code with the
following. However, note that ichol
, by default, generates
lower triangular factors.
L = ichol(A);
x = pcg(A, b, tol, maxit, L, L');