[petsc-users] Question about matrix permutation

Jed Brown jed at 59A2.org
Fri Jan 29 09:28:54 CST 2010

On Fri, 29 Jan 2010 15:54:36 +0100, Michel Cancelliere <michel.cancelliere at polito.it> wrote:
> Hi all,
> I'm implementing a preconditioner that involves to extract some submatrices,
> the system matrix is of type seqbaij, and i need to permute some rows and
> columns before extract the submatrices.

How big are these submatrices relative to the whole thing?  The way
MatGetSubMatrix is implemented, it needs sorted index sets, but you
could extract the submatrix and then sort.  It's not clear to me if this
optimization is important for performance in the context that
MatGetSubMatrix is normally used (i.e. a reasonable amount of work is
done with the submatrix).  And it would certainly not have a performance
impact to branch to a generic implementation when the index sets are

> I'm trying to use MatPermute() but i should need create and additional
> matrix

If the submatrix is much smaller than the original, this is probably not
a problem.  If it's large, and there isn't a better way to solve the
problem, then maybe MatGetSubMatrix should support unsorted index sets.

> and it seems not to work with baij matrices

It should work with MPIBAIJ matrices, it looks like it was never
implemented for SeqBAIJ, but this could be done fairly easily.


More information about the petsc-users mailing list