Hello everyone,

I have a block matrix B and vec x, and need to compute y=Bx many times. I
found that each time before I call MatMult(B,x,y,ierr), I need to call
VecSet(y,0.0,ierr). Otherwise, the result y is not correct (sometimes, but
not always). I have this puzzle even if x and y are created by
MatCreateVecs. I am using petsc 3.7.6 fortran api.

If I create the same B in non-block format, it works fine without the extra
vecset. It seems that I cannot reuse the allocation of vec y for block
matrix without a reset.

Is there any clue to explain this behavior?

Thank you.

Best,
Xiangdong

Reply via email to