[petsc-users] Narrowing down "Matrix is missing diagonal entry" errors

Matthew Knepley knepley at gmail.com
Fri Aug 16 10:34:42 CDT 2013


On Fri, Aug 16, 2013 at 10:09 AM, Bill McGrory <mcgrory at aerosoftinc.com>wrote:

> More information pertaining to the referenced post.
>
> I am using default parameters for my KSP solver, so my routines are pretty
> simple I don't pass any options in through the command line, so this is all
> default stuff here.
>
>         I create, and fill A and b, and then call
> MatAssemblyBegin(A,MAT_FINAL_**ASSEMBLY);
>
>                 MatAssemblyEnd(A,MAT_FINAL_**ASSEMBLY);
>
>         VecAssemblyBegin(b);
>         VecAssemblyEnd(b);
>
>         VecSet(x,0.);
>
>         // Solve A x = b
>
>         KSPCreate(PETSC_COMM_WORLD,&**ksp);
>
>         KSPSetOperators(ksp,A,A,**DIFFERENT_NONZERO_PATTERN);
>
>         KSPSetFromOptions(ksp);
>
>         KSPSolve(ksp,b,x);
>
> The missing diagonals, I see are in the preconditioner, not the original
> Matrix, so I thought I would check my original.
>

>From the code above, this makes no sense. You do not have a separate
preconditioner matrix.

When I make a call to MatMissingDiagonal, after assembling my matrix, I get
> the error telling me that MatMissingDiagonal is not supported for a mpibaij
> matrix.
>
> Do I have any alternative for querying my assembled matrix?
>

You can always use MatGetValues().

   Matt


> Thanks again
> Bill
>
>
>


-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130816/00f14ca8/attachment.html>


More information about the petsc-users mailing list