[petsc-users] Return value of PCFactorGetMatrix

Barry Smith bsmith at mcs.anl.gov
Mon Dec 12 11:40:18 CST 2011


   A "factored" matrix in PETSc whether with a PETSc implementation or an external implementation such as MUMPS, or SuperLU is a weird beast. It is likely in some strange convoluted data structure from which extracting information is not easy.

   What information, exactly do you want to obtain from the factored matrix? If we know that we might be able to help you get it.

    Barry

On Dec 12, 2011, at 11:35 AM, Uwe Schlifkowitz wrote:

> Dear list,
> 
> following advice from this list and petsc documentation (especially http://www.mcs.anl.gov/petsc/petsc-current/src/ksp/ksp/examples/tutorials/ex52.c.html ), i have the following code:
> 
> //---------
> 				ierr = KSPCreate( coml,&kspBA);CHKERRQ(ierr);
> 				ierr = KSPSetOperators( kspBA, Kt, Kt, DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr);
> 
> 				ierr = KSPSetType(kspBA,KSPPREONLY);CHKERRQ(ierr);
> 
> 				ierr = KSPGetPC(kspBA, &pcba);
> 
> 				ierr = PCSetType(pcba, PCCHOLESKY);CHKERRQ(ierr);
> 
> 				ierr = PCFactorSetMatSolverPackage(pcba, MATSOLVERPETSC);CHKERRQ(ierr);
> 				ierr = PCFactorSetUpMatSolverPackage(pcba);CHKERRQ(ierr);
> 				ierr = MatGetFactor(Kt,"petsc",MAT_FACTOR_CHOLESKY,&DiagM);CHKERRQ(ierr);
> 				ierr = PCFactorGetMatrix(pcba, &DiagM);CHKERRQ(ierr);
> 
> 				ierr = KSPSetUp(kspBA);CHKERRQ(ierr);
> 				//ierr = MatView(DiagM,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);
> 				//ierr = MatView(DiagM,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);
> 				ierr = VecDuplicate(fin,&diag);CHKERRQ(ierr);
> 				ierr = MatGetDiagonal(DiagM,diag);CHKERRQ(ierr);
> //-----------
> 
> where Kt is a stiffness matrix. I was hoping that PCFactorGetMatrix() makes DiagM become D from a LDL^T factorization, but to me it seems as if this is not true.
> 
> Can anyone clarify?
> 
> Regards,
> Uwe



More information about the petsc-users mailing list