Question about two Factorization functions

Hong Zhang hzhang at mcs.anl.gov
Wed May 23 21:12:02 CDT 2007



On Wed, 23 May 2007 junwang at uwm.edu wrote:

> 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);
MatCholeskyFactorNumeric_SeqSBAIJ_2_NaturalOrdering()
is called, because
MatGetOrdering(A,MATORDERING_NATURAL,&perm,&iscol)
is called before MatCholeskyFactorNumeric() in ex74.
You can use a debugger to follow the steps of the
calling procedure.

>    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.
Yes.
>    So when is the first one will be called? This is not showed in ex74.
Sorry,              ^^^^^^^^^^^^^?
I do not understand what do you mean "the first one"?
Again, a debugger can show exactly which
functions are being called.

Hong
>
>
> 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