[petsc-users] Return value of PCFactorGetMatrix

Barry Smith bsmith at mcs.anl.gov
Mon Dec 12 13:05:39 CST 2011


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

> I'm continuing Clemens Domanig's work. Currently I'm stuck at his problem as described here: http://lists.mcs.anl.gov/pipermail/petsc-users/2011-August/009571.html
> 
> As far as I understand, getting the diagonal matrix from MUMPS is not possible, so Clemens (and I) resort to MATSOLVERPETSC to obtain D.

   We could add support for MatGetDiagonal() for PETSc factored matrices if you really need it, but what are you using it for? Do you want the inertia? We could give that for PETSc factored matrices.


   Barry

> 
> 
> Uwe 
> 
> On 12.12.2011, at 18:40, Barry Smith wrote:
>> 
>>  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