Skip to content

bicg

sparse · scripts/sparse/bicg.m

x = bicg (A, b, tol, maxit, M1, M2, x0)
[x, flag, relres, iter, resvec] = bicg (...)

Biconjugate gradients for A*x = b with a general square A.  A is a matrix
or a function handle afun (x, flag) returning A*x ("notransp") or A'*x
("transp"); a handle taking only x is used for both.  The preconditioner
is M = M1*M2 (matrices, or handles mfun (x, flag) returning M\x or M'\x).
flag: 0 converged, 1 maxit reached, 2 preconditioner failure,
3 stagnation, 4 breakdown.