[petsc-users] MatSetValues

Vasileios Kalantzis kalan019 at umn.edu
Mon Jan 25 12:15:04 CST 2016

Dear all,

I am trying to form an approximation of the
Schur complement S = C-E'*(B\E) of a matrix
A = [B, E ; E', C]. Matrix C is stored as a
distributed Mat object while matrices B and E
are locally distributed to each processor (the
block partitioning comes from a Domain
Decomposition point-of-view). All matrices B, E,
and C are sparse.

I already have a sparse version of -E'*(B\E)
computed. Moreover, -E'*(B\E)  is block-diagonal.
The only issue now is how to merge (add) C and
-E'*(B\E). The way i do the addition right now is
based on checking every entry of -E'*(B\E) and,
if larger than a threshold value, add it to C using
the MatSetValue routine. The above is being done
in parallel for each diagonal block of -E'*(B\E).

The code works fine numerically but my approach
is too slow if -E'*(B\E) is not highly sparse.

I know that I can set many entries together by
using the MatSetValues routine but I am not
sure how to do it because the sparsity pattern of
each column of -E'*(B\E) differs. Maybe I can
assemble the sparsified Schur complement
column-by-column using MatSetValues but is
there any other idea perhaps?

Thanks ! :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160125/af1350e2/attachment.html>

More information about the petsc-users mailing list