[petsc-dev] Is MatZeroRows too severe?

Stefano Zampini stefano.zampini at gmail.com
Wed Jan 18 10:07:35 CST 2017


Perhaps this is a valid fix

-      if (missing) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Matrix is missing diagonal entry in row %D",d);
+      if (missing) {
+        for (i=0; i<N; i++) {
+          if (rows[i] == d) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Cannot insert diagonal value! Matrix is missing diagonal entry in row %D",d);
+        }
+      }

> On Jan 18, 2017, at 6:58 PM, Eric Chamberland <Eric.Chamberland at giref.ulaval.ca> wrote:
> 
> Hi,
> 
> we are calling MatZeroRows_SeqAIJ (petsc 3.7.5) with:
> 
> N=3
> 
> rows[0]=15
> rows[1]=30
> rows[2]=65
> 
> diag = 1
> x=0
> b=0
> 
> and (Mat_SeqAIJ*)A->data->keepnonzeropattern is true.
> 
> but MatMissingDiagonal_SeqAIJ finds a missing diagonal at line 1 and then return on error here:
> 
> if (missing) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Matrix is missing diagonal entry in row %D",d);
> 
> with d=1
> 
> I understand that MatZeroRows verify all the lines for missing diagonals with MatMissingDiagonal_SeqAIJ, even if I try to zero only some lines.
> 
> Is that the wanted behavior?
> 
> Thanks,
> 
> Eric

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20170118/f4062d49/attachment.html>


More information about the petsc-dev mailing list