[petsc-users] MatMult for block matrix

Barry Smith bsmith at mcs.anl.gov
Mon Sep 11 17:11:56 CDT 2017


  This is either a bug in PETSc or some misunderstanding. You certainly should not have to call VecSet() on y first. Can you send (or point to) us a code that demonstrates the problem so we can debug?

  Barry

> On Sep 11, 2017, at 4:22 PM, Xiangdong <epscodes at gmail.com> wrote:
> 
> 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
> 
> 
> 
> 



More information about the petsc-users mailing list