[petsc-users] Creating rectangular submatrix
Peder Jørgensgaard Olesen
pjool at mek.dtu.dk
Sun Nov 14 11:39:18 CST 2021
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?
Thanks in advance.
Best regards
Peder
[http://www.dtu.dk/-/media/DTU_Generelt/Andet/mail-signature-logo.png]
Peder Jørgensgaard Olesen
PhD student
Department of Mechanical Engineering
pjool at mek.dtu.dk<mailto:pjool at mek.dtu.dk>
Koppels Allé
Building 403, room 105
2800 Kgs. Lyngby
www.dtu.dk/english<https://www.dtu.dk/english>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20211114/2b932945/attachment-0001.html>
More information about the petsc-users
mailing list