[petsc-users] MatMult for block matrix

Xiangdong epscodes at gmail.com
Mon Sep 11 15:22:15 CDT 2017


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


More information about the petsc-users mailing list