[SciPy-User] scipy.sparse.linalg.cg statistics?

Pauli Virtanen pav@iki...
Tue Sep 28 10:19:50 CDT 2010

Tue, 28 Sep 2010 15:34:21 +0200, Nico Schlömer wrote:

> Hi all,
> I was just running some test problems with scipy.sparse.linalg.cg and
> thing seem work work out fine.
> To compare preconditioners, I'd like to get more detailed information
> about the convergence history, but I haven't been able to figure out how
> to, e.g., get the number of performed iterations or the (relative)
> residual for each of those steps. Compare this with
> http://www.mathworks.com/help/techdoc/ref/pcg.html.
> Any hints?

Use the 'callback' argument.

>>> help(scipy.sparse.linalg.cg)
callback : function
    User-supplied function to call after each iteration.  It is called
    as callback(xk), where xk is the current solution vector.

More information about the SciPy-User mailing list