[petsc-users] reorder a sparse matrix

Jed Brown jed at 59A2.org
Mon Sep 27 11:46:42 CDT 2010


On Mon, Sep 27, 2010 at 18:38, Umut Tabak <u.tabak at tudelft.nl> wrote:
> Dear all,
>
> How can I reorder a sparse matrix in Petsc?
>
> Sth like in a dirty MATLAB like pseudo-code:
> A = diag([1 3 4 5]);
> neworder = [2 4 1 3];
> B = A(neworder, neworder)

Use MatPermute or (less storage) put the permutation in a wrapper to
MatSetValues (like the localtoglobalmapping with MatSetValuesLocal),
so that you assemble the matrix you want to begin with.

Jed


More information about the petsc-users mailing list