LU in PETSc

Waad Subber w_subber at yahoo.com
Wed Mar 18 11:32:53 CDT 2009


Hi,
I am trying to do LU factorization to an ill-conditioned system. PETSc gives me "Detected zero pivot in LU factorization". The problem is solved when I use PCFactorSetShiftNonzero.

Just to be sure, I used Matlab and Lapack(DGETRF) to do the factorization. They did it without any complain and they gave me the same answer. However, the answer I got from PETSc is completely different.

In PETSc I did the following:

      call KSPCreate(PETSC_COMM_SELF,ksp1,ierr)
      call KSPSetOperators(ksp1,PSASTF,PSASTF,SAME_NONZERO_PATTERN,ierr)
      call KSPSetType(ksp1,KSPPREONLY,ierr)
      call KSPGetPC(ksp1,prec1,ierr)
      call PCSetType(prec1,PCLU,ierr)
      call PCFactorSetShiftNonzero(prec1,PETSC_DECIDE,IERR)
      call KSPSetFromOptions(ksp1,ierr)
      call KSPSetUp(ksp1,ierr)

Any idea why PETSc gives different answer than Matlab and Lapack routine (DGETRF).

Thanks

Waad 



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20090318/32989fdd/attachment.htm>


More information about the petsc-users mailing list