[petsc-users] MatGetDiagonal
Hong Zhang
hzhang at mcs.anl.gov
Tue Aug 9 14:04:49 CDT 2011
Clemens :
This is a bug in MatGetDiagonal_SeqSBAIJ() for cholesky factored matrix.
I fixed it and pushed to petsc-dev.
See http://www.mcs.anl.gov/petsc/petsc-as/developers/index.html
on how to get petsc-dev.
Thanks for reporting the problem. Contact us if you still get problem.
Hong
> Hi,
>
> I already talked to some of you about this in combination with some other
> problem, but somehow I don't get it.
> I want the diagonal entries of the matrix M. But my vector 'diag' is mainly
> full of zeros when using MatGetDiagonal().
> I can print 'DiagM' (VecView) where I see all the diagonal entries but I
> cannot access them using MatGetValue (Object is in wrong state. Not for
> factored matrix!).
> How can I get access to the diagonal?
> Thx - Clemens
>
>
> KSPCreate( coml, &kspBA);
> KSPGetPC( kspBA, &precond);
> PCSetType( precond, PCCHOLESKY);
> PCFactorSetMatSolverPackage( precond, MAT_SOLVER_PETSC);
> KSPSetOptionsPrefix( kspBA, "diag_pc_type cholesky");
> KSPSetFromOptions( kspBA);
> KSPSetOperators( kspBA, Kt, Kt, DIFFERENT_NONZERO_PATTERN);
> KSPSetUp( kspBA);
> PCFactorGetMatrix( precond, &DiagM); //DO NOT DESTROY DiagM !!!
> MatGetDiagonal( DiagM, diag);
>
More information about the petsc-users
mailing list