Dear developers,

To avoid zero pivot error in IC/ILU preconditioners,  I plan to permute matrix before solving the linear system. I referred example ex10(https://petsc.org/main/src/ksp/ksp/tutorials/ex10.c.html) and ex18(https://petsc.org/main/src/ksp/ksp/tutorials/ex18.c.html), and was confused that why vector b is permuted by column permutation index set:

// in ex18.c
174:   if (permute) {
175:     Mat Aperm;
176:     MatGetOrdering(A, ordering, &rowperm, &colperm);
177:     MatPermute(A, rowperm, colperm, &Aperm);
178:     VecPermute(b, colperm, PETSC_FALSE);
179:     MatDestroy(&A);
180:     A = Aperm; /* Replace original operator with permuted version */
181:   }
As far as I understand, vector b should be only  affected by permuting rows in matrix A, instead of column permutation. How to understand that permuting vector b with column permutation index set of matrix A?

Another question is why  MatReorderForNonzeroDiagonal function only works for type MATSEQAIJ? If it works for other matrix types, then this function will meet my requirement.


Thanks,

Xiaofeng