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
