MAT_KEEP_ZEROED_ROWS && MatZeroRows() on empty rows.
Barry Smith
bsmith at mcs.anl.gov
Tue Jun 2 16:15:27 CDT 2009
MAT_KEEP_ZEROED_ROWS is a bad name for the option. It should be
MAT_KEEP_NONZERO_STRUCTURE
The error is correct because putting the diagonal value in will change
the nonzero structure in this case.
I will change MAT_KEEP_ZEROED_ROWS to MAT_KEEP_NONZERO_STRUCTURE
in petsc-dev unless
someone points out that I am wrong.
Barry
On Jun 2, 2009, at 4:00 PM, Lisandro Dalcin wrote:
> A co-worker (CC'ed) pointed me this:
>
> $ cat zerorows.py
> from petsc4py import PETSc
> A = PETSc.Mat().createAIJ(5)
> A[0,0] = 1
> A[4,4] = 1
> A.assemble()
> A.setOption(PETSc.Mat.Option.KEEP_ZEROED_ROWS, True)
> A.zeroRows([1,2,3])
> A.view()
>
>
> $ python zerorows.py
> Traceback (most recent call last):
> File "zerorows.py", line 7, in <module>
> A.zeroRows([2])
> File "Mat.pyx", line 621, in petsc4py.PETSc.Mat.zeroRows
> (src/petsc4py.PETSc.c:63679)
> petsc4py.PETSc.Error: error code 73
> [0] MatZeroRows() line 4822 in src/mat/interface/matrix.c
> [0] MatZeroRows_SeqAIJ() line 1367 in src/mat/impls/aij/seq/aij.c
> [0] Object is in wrong state
> [0] Matrix is missing diagonal entry in row 3
>
> If the setOption() is commented out, all work as expected.
>
> Is this a bug? What do you think?
> We could argue this is an abuse of ZeroRows() (I mean, use ZeroRows()
> to put something on diagonal when we know in advance that the whole
> row is empty).
> However, as the call succeed without the setOption(KEEP_ZEROED_...),
> I'm inclined to think this is actually a bug.
>
>
> --
> Lisandro Dalcín
> ---------------
> Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
> Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
> Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
> PTLC - Güemes 3450, (3000) Santa Fe, Argentina
> Tel/Fax: +54-(0)342-451.1594
More information about the petsc-dev
mailing list