[petsc-users] Questions about matrix permutation
Mark Adams
mfadams at lbl.gov
Thu Oct 27 08:55:41 CDT 2022
On Wed, Oct 26, 2022 at 11:00 PM 晓峰 何 <tlanyan at hotmail.com> wrote:
> 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?
>
>
I get confused by this also. I just test it. Try one and if thats wrong,
its the other!
As I recall a permutation vector has the place where the equation sould _go_
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.
>
>
It has not been implemented. You could do this, clone the MATSEQAIJ one for
the matrix type that you want.
See https://petsc.org/release/developers/contributing/ for instructions on
contributing to PETSc.
Thanks,
Mark
>
> Thanks,
>
> Xiaofeng
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20221027/f2a25cc6/attachment-0001.html>
More information about the petsc-users
mailing list