[petsc-users] Efficiently build a matrix from two asymmetric diagonal block matrices

Emile Soutter emile.soutter at corintis.com
Thu Jul 21 06:27:31 CDT 2022


Dear all,

I am struggling with the simple following problem : Having a first matrix
B1 of size n1xm1, a second matrix B2 of size n2 x m2, build a matrix M of
size (n1+n2)x(m1+m2) where the blocks B1 and B2 are the "diagonal" of M
(M[0:n1,0:m1]=B1, M[n1:(n1+n2),m1:(m1+m2)]=B2). In my case, the blocks B1
and B2 are obtained from another routine, directly in the petsc matrix form
(or pyop2.Sparsity form). However the blocks are not squared (n1,n2,m1,m2
are all different integers). The operation is easy to do with the SetValues
option. However, it takes a large amount of time (too much) when the system
becomes large. I struggle to do it efficiently and in parallel. What method
do you recommend to use to do this as fast as possible?

Thanks you for any tips,

Emile
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220721/fc545624/attachment.html>


More information about the petsc-users mailing list