Question about two Factorization functions

Hong Zhang hzhang at mcs.anl.gov
Wed May 23 13:58:18 CDT 2007


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