Krylov vectors of matrix-free KSP
Barry Smith
bsmith at mcs.anl.gov
Thu Sep 24 11:31:27 CDT 2009
I assume that you are working with GMRES? If so, rather than
trying to "trap" this information during the computation I suggest
using the data structures that KSPGMRES constructs AFTER the solve to
do your own calculations. The GMRES data structure is defined in src/
ksp/ksp/impls/gmres/gmresp.h and the code that uses it is in the
various source files in that directory.
Barry
On Sep 24, 2009, at 10:42 AM, SUN Chun wrote:
> Hi,
>
> Sorry for the intrusion.
>
> I am planning to use MATSHELL together with KSP to achieve matrix-free
> Krylov solve. I understand that I need to provide a function as MatVec
> to build the Krylov space.
>
> I also want to retain all the input vectors that I got from PETSC.
> i.e.
> I want to keep the Krylov vectors on my own side, together with some
> intermediate results. However I found that my MatVec is not only
> called
> during the building of Krylov space, it's also called else where like
> initialization and norm calculation. If I say -ksp_norm_type=no, the
> number of MatVec calls might still slightly off from what I see for
> the
> number of iterations.
>
> I just want to check: Is there a way to know if a particular MatVec
> call
> is from Krylov iteration or from elsewhere like norm check?
>
> Or after -ksp_norm_type=no I should see exactly the same number of
> Krylov iterations comparing to the number that MatVec is called?
>
> The reason for doing this is that I want to obtain each coefficient of
> all the Krylov basis from *this* solve and use them elsewhere to build
> solution to another related equation from the same Krylov space. I
> guess
> I can't access these coefficients but if I can take advantage of all
> vectors being orthogonal, I can recover the coefficients in a rather
> cheap way. Do you see any way around this?
>
> Thank you very much,
> Chun
More information about the petsc-users
mailing list