accessing iterative vectors in CG

Matthew Knepley knepley at
Thu May 15 11:10:42 CDT 2008

On Thu, May 15, 2008 at 11:04 AM, Pearl Flath <pflath at> wrote:
> Hi,
> I'd like to do some additional calculations for another purpose with the
> iterative vectors in each step of the KSP CG solve. How do I get access to
> them?

We do not expose those vectors to the user in the interface. I think the easiest
thing to do is copy the cg.c code into another solver, mycg.c and do
the requisite
calculations in that one.

You register the solver in the same way as CG is registered in
with a call to KSPRegisterDynamic(). Then from the command-line you
can use -ksp_type mycg.


> Pearl Flath
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which
their experiments lead.
-- Norbert Wiener

More information about the petsc-users mailing list