Why MatSetSizes_SeqDense memzeroes values?

Lisandro Dalcin dalcinl at gmail.com
Wed Dec 3 12:09:21 CST 2008

Please, review the changeset below, just pushed. Why is the memzero
call being issued? Should it be completely removed?

changeset:   13056:4ea189951503
tag:         tip
user:        Lisandro Dalcin <dalcinl at gmail.com>
date:        Wed Dec 03 16:06:12 2008 -0200
summary:     protect memzero call in MatSetSizes_SeqDense()

I discovered the problem doing this:

In [1]: from petsc4py import PETSc
In [2]: A = PETSc.Mat().create()
In [3]: A.setSizes([4,4])
In [4]: A.setType('seqdense')
In [5]: A.setSizes([4,4])
Error                                     Traceback (most recent call last)
Error: error code 85
[0] MatSetSizes() line 128 in src/mat/utils/gcreate.c
[0] MatSetSizes_SeqDense() line 1529 in src/mat/impls/dense/seq/dense.c
[0] PetscMemzero() line 189 in src/sys/utils/memc.c
[0] Null argument, when expecting valid pointer
[0] Trying to zero at a null pointer

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