[petsc-users] Reordering rows of parallel matrix across processors

Matthew Knepley knepley at gmail.com
Thu Jul 7 09:48:06 CDT 2016


On Thu, Jul 7, 2016 at 3:37 AM, Cyrill Vonplanta <cyrill.von.planta at usi.ch>
wrote:

> Dear all,
>
> I would like to reorder the rows of a matrix across processors. Is this
> possible with MatPermute(…)?
>

Yes, this works with MatPermute().

Could you send this small example so I can reproduce it?


> To illustrate here is how an index set would look like for a matrix with
> M=35 on 2 CPU’s. Amongst other things I intend to swap the first and last
> row here.
>
> [0] Number of indices in set 24
> [0] 0 34
> [0] 1 1
> [0] 2 2
> [0] 3 3
> [0] 4 4
> [0] 5 5
> [0] 6 6
> [0] 7 7
> [0] 8 15
> [0] 9 16
> [0] 10 11
> [0] 11 8
> [0] 12 10
> [0] 13 21
> [0] 14 9
> [0] 15 12
> [0] 16 13
> [0] 17 14
> [0] 18 17
> [0] 19 18
> [0] 20 19
> [0] 21 20
> [0] 22 22
> [0] 23 23
> [1] Number of indices in set 11
> [1] 0 24
> [1] 1 25
> [1] 2 26
> [1] 3 27
> [1] 4 28
> [1] 5 29
> [1] 6 30
> [1] 7 31
> [1] 8 32
> [1] 9 33
> [1] 10 0
>
> Instead of exchanging the first and last row it seems to replace them with
> zeros only.
> If this can’t be done with MatPermute how could it be done?
>

You could also use MatGetSubMatrix().

  Thanks,

    Matt


> Thanks
> Cyrill
>
>


-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160707/17592267/attachment-0001.html>


More information about the petsc-users mailing list