[petsc-users] Question about MatGetRow

Matthew Knepley knepley at gmail.com
Fri Feb 3 07:26:36 CST 2023


On Fri, Feb 3, 2023 at 8:06 AM 김성익 <ksi2443 at gmail.com> wrote:

> Following your comments,
> I want to check below things.
> For example, the global dense matrix are as below.
> [image: image.png]
> If I want to get first row ('1 2 0 0 3 0 0 4') in Proc 1.
> Then I should put 'MatCreateSubMatrix
> <https://petsc.org/main/docs/manualpages/Mat/MatCreateSubMatrix/>(mat,
> isrow, NULL, MAT_INITIAL_MATRIX, *&*newmat)'
> and isrow will be [0 1 2 3 4 5 6 7].
>
> In this case, How can I make isrow?
> Actually I can't understand the procedure of handling isrow.
>

You create an IS object of type ISGENERAL and give it the array of global
indices that you want to extract.

  Thanks,

     Matt


> Hyung Kim
>
> 2023년 2월 3일 (금) 오후 9:03, Mark Adams <mfadams at lbl.gov>님이 작성:
>
>> https://petsc.org/main/docs/manualpages/Mat/MatCreateSubMatrix/
>>
>> Note, PETSc lets you give NULL arguments if there is a reasonable default.
>> In this case give NULL for the column IS and you will get the whole
>> columns.
>>
>> Mark
>>
>> On Fri, Feb 3, 2023 at 4:05 AM 김성익 <ksi2443 at gmail.com> wrote:
>>
>>> Hello,
>>>
>>>
>>> By using MatGetRow, user can get vectors from local matrix (at each
>>> process).
>>>
>>> However, I need other process's row values.
>>> So I have 2 questions.
>>>
>>> 1. Is there any function for getting arrays from other process's??
>>>
>>> 2. Or is there any function like matrix version of vecscattertoall??
>>>
>>> Thanks,
>>> Hyung Kim
>>>
>>

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230203/10862122/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 6931 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230203/10862122/attachment.png>


More information about the petsc-users mailing list