Re: [petsc-users] question about MatInvertBlockDiagonal_SeqBAIJ

2018-02-22 Thread Smith, Barry F.

  Removed in the branch barry/remove-mdiag-baij

  Barry


> On Feb 22, 2018, at 6:55 AM, Xiangdong  wrote:
> 
> 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 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;
> 



Re: [petsc-users] question about MatInvertBlockDiagonal_SeqBAIJ

2018-02-22 Thread Smith, Barry F.

   It looks like this was copied from the AIJ format but is never used for 
BAIJ. Could probably be removed.


   Barry


> On Feb 22, 2018, at 6:55 AM, Xiangdong  wrote:
> 
> 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 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;
> 



[petsc-users] question about MatInvertBlockDiagonal_SeqBAIJ

2018-02-22 Thread Xiangdong
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; ifactorerrortype =
MAT_FACTOR_NUMERIC_ZEROPIVOT;
144:   diag  += bs2;
145:   mdiag += bs2;