<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hi,<br>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.<br><br>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.<br><br>In PETSc I did the following:<br><br> call KSPCreate(PETSC_COMM_SELF,ksp1,ierr)<br> call KSPSetOperators(ksp1,PSASTF,PSASTF,SAME_NONZERO_PATTERN,ierr)<br> call KSPSetType(ksp1,KSPPREONLY,ierr)<br> call KSPGetPC(ksp1,prec1,ierr)<br> call PCSetType(prec1,PCLU,ierr)<br> call
PCFactorSetShiftNonzero(prec1,PETSC_DECIDE,IERR)<br> call KSPSetFromOptions(ksp1,ierr)<br> call KSPSetUp(ksp1,ierr)<br><br>Any idea why PETSc gives different answer than Matlab and Lapack routine (DGETRF).<br><br>Thanks<br><br>Waad <br></td></tr></table><br>