[petsc-users] MatGetDiagonal

Clemens Domanig clemens.domanig at uibk.ac.at
Thu Aug 11 04:46:44 CDT 2011


I checked out the dev-version today but it doesn't fix my problem.
Is it possible that your fix is not in th dev-version?
Thx.

[0]PETSC ERROR: --------------------- Error Message 
----------------------------
--------
[0]PETSC ERROR: Object is in wrong state!
[0]PETSC ERROR: Not for factored matrix!
[0]PETSC ERROR: 
----------------------------------------------------------------
--------
[0]PETSC ERROR: Petsc Development HG revision: 
173a9704a10394abf9048b83aebd58c4c




Hong Zhang wrote:
> 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