[petsc-users] preconditionning with a Matshell

Jed Brown jed at jedbrown.org
Wed Jul 29 11:11:33 CDT 2015


Nicolas Pozin <nicolas.pozin at inria.fr> writes:

> Hello everyone, 
>
> I'm trying to solve a system iteratively through conjugate gradient with jacobi preconditionning. 
> Thing is the system matrix is a matshell. 
> When I run the code matgetdiagonal returns an error : "MatGetDiagonal() line ......... /petsc/3.4.3/src/mat/interface/matrix.c Mat type shell" 
> Is matgetiagonal function enable to act on a matshell? 

MatShell is not magic -- it can't guess the diagonal without more
information or unreasonably high cost.  You have to implement
MatGetDiagonal to use Jacobi:

  MatShellSetOperation(mat,MATOP_GET_DIAGONAL,yourfunction)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150729/466c9e8f/attachment.pgp>


More information about the petsc-users mailing list