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

Nico Schlömer nico.schloemer@gmail....
Fri Oct 1 05:06:30 CDT 2010

> Use the 'callback' argument.

That works alright I guess.
What I do right now is creating a *global array that's filled up as
the callback function is called, after which I go ahead and plot it.
Using a global variable here seems somewhat ugly to me -- might there
be a more elegant solution at all?


On Tue, Sep 28, 2010 at 5:19 PM, Pauli Virtanen <pav@iki.fi> wrote:
> 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.
> ...
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user

More information about the SciPy-User mailing list