Question about two Factorization functions

junwang at uwm.edu junwang at uwm.edu
Wed May 23 14:49:34 CDT 2007


Hi, Hong:
   Thanks again for your reply! :)
   I have read this ex74 before. I am curious, when i call:
   ierr = MatCholeskyFactorNumeric(mat,&info,&result);CHKERRQ(ierr);
   which function will be called:
   MatCholeskyFactorNumeric_SeqSBAIJ_2(Mat A,MatFactorInfo *info,Mat *B);
   or
   MatCholeskyFactorNumeric_SeqSBAIJ_2_NaturalOrdering(Mat A,MatFactorInfo
*info,Mat *B);


   For the following codes:
   ierr = MatCreateSeqSBAIJ(PETSC_COMM_SELF,2,6,6,0,nnz,&mat);CHKERRQ(ierr);
   IS perm,colp;
   MatGetOrdering(mat,MATORDERING_NATURAL,&perm,&colp);
   ierr = ISDestroy(colp);CHKERRQ(ierr);
   MatFactorInfo info;
   info.fill=1.0;
   Mat result;
   ierr = MatCholeskyFactorSymbolic(mat,perm,&info,&result);CHKERRQ(ierr);
   ierr = MatCholeskyFactorNumeric(mat,&info,&result);CHKERRQ(ierr);

   I know when i call MatCholeskyFactorNumeric ,
MatCholeskyFactorNumeric_SeqSBAIJ_2_NaturalOrdering() will be called.
   So when is the first one will be called? This is not showed in ex74.
   Thank you!


Jun


Quoting Hong Zhang <hzhang at mcs.anl.gov>:

>
> Jun,
> >     I am trying to know the difference bewteen the following two functions:
> >     MatCholeskyFactorNumeric_SeqSBAIJ_2(Mat A,MatFactorInfo *info,Mat *B);
> >     MatCholeskyFactorNumeric_SeqSBAIJ_2_NaturalOrdering(Mat A,MatFactorInfo
> > *info,Mat *B);
> >
> >     Suppose I have a matrix "mat" stored in the SBAIJ format, the block
> size is
> > 2. When i am running the following code, it seems it calling the second
> > NatrualOrdering function:
> >
> >     ierr =
> MatCreateSeqSBAIJ(PETSC_COMM_SELF,2,6,6,0,nnz,&mat);CHKERRQ(ierr);
> >
> >     IS perm,colp;
> >     MatGetOrdering(mat,MATORDERING_NATURAL,&perm,&colp);
> >     ierr = ISDestroy(colp);CHKERRQ(ierr);
> >     MatFactorInfo info;
> >     info.fill=1.0;
> >     Mat result;
> >     ierr = MatCholeskyFactorSymbolic(mat,perm,&info,&result);
> CHKERRQ(ierr);
> >     ierr = MatCholeskyFactorNumeric(mat,&info,&result);CHKERRQ(ierr);
> >
> >     However, since the first function is not naturalordering, does that
> mean i
> > don't have to call the MatGetOrdering before I  call
> MatCholeskyFactor....().
> > If so, does that mean, it will reduce the time cost since it doesn't have
> to do
> > the ordering part.
>
> You must provide 'perm' when calling MatCholeskyFactorSymbolic().
> MatGetOrdering() takes ignorable time.
> You can run your code with option '-log_summary |grep MatGetOrdering' and
> see how much time spent on it.
>
> >     Is anyone can give any idea and give me a example for calling the first
> > function to do the factorization. Thank you very mcuh!
>
> You may see src/mat/examples/tests/ex74.c as an example (messy!).
>
> Hong
> >
> >
>
>






More information about the petsc-users mailing list