[petsc-users] How to adapt vectors to matrices loaded from a viewer

Junchao Zhang jczhang at mcs.anl.gov
Fri Apr 20 13:55:36 CDT 2018


    In a PETSc example (ex10.c
<http://www.mcs.anl.gov/petsc/petsc-current/src/ksp/ksp/examples/tutorials/ex10.c.html>)
one MatLoad A and then VecLoad b from a viewer. Since one can change mat
block size through option -matload_block_size, the code tries to pad b if A
and b's sizes mismatch, using the following test

186:   MatGetSize(A,&M,NULL);187:   VecGetSize(b,&m);188:   if (M !=
m) {   /* Create a new vector b by padding the old one */

  I think the code is wrong. One has to compare local column size of A and
local size of b, and if there is a mismatch on ANY processor, then one has
to create a new b.
  My questions are: Are users supposed to take this complexity? Does PETSc
provide a neat way to do that, for example, MatVecLoad(A,b,viewer)

 Thanks.
--Junchao Zhang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180420/e1b0572d/attachment.html>


More information about the petsc-users mailing list