[petsc-users] Questions about matrix permutation

晓峰 何 tlanyan at hotmail.com
Wed Oct 26 21:59:42 CDT 2022


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<https://petsc.org/main/docs/manualpages/Mat/Mat/> Aperm;
176:     MatGetOrdering<https://petsc.org/main/docs/manualpages/MatOrderings/MatGetOrdering/>(A, ordering, &rowperm, &colperm);
177:     MatPermute<https://petsc.org/main/docs/manualpages/Mat/MatPermute/>(A, rowperm, colperm, &Aperm);
178:     VecPermute<https://petsc.org/main/docs/manualpages/Vec/VecPermute/>(b, colperm, PETSC_FALSE<https://petsc.org/main/docs/manualpages/Sys/PETSC_FALSE/>);
179:     MatDestroy<https://petsc.org/main/docs/manualpages/Mat/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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20221027/3ce7f667/attachment.html>


More information about the petsc-users mailing list