I see, thanks.
Is there some clever way to have PETSc decide for me which column goes where? ________________________________ Fra: Mark Adams <[email protected]> Sendt: 14. november 2021 19:17:07 Til: Peder Jørgensgaard Olesen Cc: [email protected] Emne: Re: [petsc-users] Creating rectangular submatrix On Sun, Nov 14, 2021 at 12:39 PM Peder Jørgensgaard Olesen via petsc-users <[email protected]<mailto:[email protected]>> 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 [http://www.dtu.dk/-/media/DTU_Generelt/Andet/mail-signature-logo.png] Peder Jørgensgaard Olesen PhD student Department of Mechanical Engineering [email protected]<mailto:[email protected]> Koppels Allé Building 403, room 105 2800 Kgs. Lyngby www.dtu.dk/english<https://www.dtu.dk/english>
