[petsc-users] Creating rectangular submatrix

Mark Adams mfadams at lbl.gov
Sun Nov 14 12:17:07 CST 2021


On Sun, Nov 14, 2021 at 12:39 PM Peder Jørgensgaard Olesen via petsc-users <
petsc-users at mcs.anl.gov> wrote:

> Hello
>
>
> I need to extract a submatrix consisting of a number columns from a
> rectangular matrix. The documentation
> <https://petsc.org/release/docs/manualpages/Mat/MatCreateSubMatrix.html>for
> MatCreateSubMatrix states that "each process should list the columns that
> will be in its "diagonal part" in the new matrix".
>
>
> However, is it not the case that not all columns are necessarily in some
> process's diagonal part? Consider the example of a 2x5 matrix stored on
> two processes. Each process then stores one row. Suppose we wish to create
> a submatrix with rows 0 and 1, and columns 2, 3, and 4 from the original
> matrix. The diagonal parts of the matrix created then each hold one
> element, namely (0,2) and (1,3), respectively (using source matrix
> indices). But how would the ISs for creating this submatrix look?
> Taking the syntax described in the documentation at face value tthe ISs
> would be row_is = [0 | 1] and col_is = [2 | 3]. Thus, there doesn't seem
> to be a way to tell MatCreateSubMatrix that we also want column 4 (unless
> we may simply let col_is = [2 | 3  4], and the new matrix' "diagonal part"
> becomes non-square - which might also explain the scare quotes around the
> term in the documentation?)
>
>
> I'd be surprised if the syntax does not allow certain submatrices to be
> formed; more likely I'm misunderstanding the documentation. Could someone
> shed some light on this?
>

You are on the right track. You have to decide what processor is going to
have each column. This is the partitioning of the left hand side vector
will need when applying this new matrix.
So [2 | 3  4]  is valid. This would give you
[01]*  [03 04]
[11]   [13 14]*
* diagonal part


>
> Thanks in advance.
>
>
> Best regards
>
> Peder
>
>
>
> Peder Jørgensgaard Olesen
> PhD student
> Department of Mechanical Engineering
>
> pjool at mek.dtu.dk
> Koppels Allé
> Building 403, room 105
> 2800 Kgs. Lyngby
> www.dtu.dk/english
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20211114/d0002e72/attachment.html>


More information about the petsc-users mailing list