[petsc-users] question about MatInvertBlockDiagonal_SeqBAIJ

Xiangdong epscodes at gmail.com
Thu Feb 22 08:55:22 CST 2018


Hello everyone,

I am curious about the purpose of mdiag in MatInverseBlockDiagonal_SeqBAIJ

http://www.mcs.anl.gov/petsc/petsc-current/src/mat/impls/baij/seq/baij.c.html

It seems that the inverse of the diagonal block is stored is a->idiag, and
the extra copy of diagonal block itself is stored in mdiag or
a->idiag+bs2*mbs. What is the purpose of storing this mdiag as an extra
copy of diagonal block? When will this mdiag be used?

Thank you.

Best,
Xiangdong


if (!a->idiag) {
 38:     PetscMalloc1(2*bs2*mbs,&a->idiag);
 39:     PetscLogObjectMemory((PetscObject)A,2*bs2*mbs*sizeof(PetscScalar));
 40:   }
 41:   diag  = a->idiag;
 42:   mdiag = a->idiag+bs2*mbs;


138:     for (i=0; i<mbs; i++) {
139:       odiag  = v + bs2*diag_offset[i];
140:       PetscMemcpy(diag,odiag,bs2*sizeof(PetscScalar));
141:       PetscMemcpy(mdiag,odiag,bs2*sizeof(PetscScalar));
142:
 PetscKernel_A_gets_inverse_A(bs,diag,v_pivots,v_work,allowzeropivot,&zeropivotdetected);
143:       if (zeropivotdetected) A->factorerrortype =
MAT_FACTOR_NUMERIC_ZEROPIVOT;
144:       diag  += bs2;
145:       mdiag += bs2;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180222/d94f281b/attachment.html>


More information about the petsc-users mailing list