static char help[] = "Tests reordering a matrix.\n\n"; #include int main(int argc,char **args) { Mat C; PetscInt i,j,m = 5,n = 5,Ii,J; PetscScalar v; IS perm,iperm; PetscCall(PetscInitialize(&argc,&args,(char*)0,help)); PetscCall(MatCreate(PETSC_COMM_SELF,&C)); PetscCall(MatSetSizes(C,PETSC_DECIDE,PETSC_DECIDE,m*n,m*n)); PetscCall(MatSetFromOptions(C)); PetscCall(MatSetUp(C)); /* create the matrix for the five point stencil, YET AGAIN*/ for (i=0; i0) {J = Ii - n; PetscCall(MatSetValues(C,1,&Ii,1,&J,&v,INSERT_VALUES));} if (i0) {J = Ii - 1; PetscCall(MatSetValues(C,1,&Ii,1,&J,&v,INSERT_VALUES));} if (j