[petsc-users] Determinant of the matrix

Jelena Slivka slivkaje at gmail.com
Mon Feb 25 18:02:47 CST 2013


Hello,
I am trying to find the determinant of the matrix. I have found this thread:

http://lists.mcs.anl.gov/pipermail/petsc-users/2010-July/006716.html

But, could you please explain how to access the data structure directly?
So far I have tried the following:

#include <petsc-private/matimpl.h>
#include <../src/mat/impls/aij/seq/aij.h>
...
// (Solving the system A*x = rhs
MatSetOption(A, MAT_SPD, PETSC_TRUE);
Mat F;
MatGetFactor(A, MATSOLVERMUMPS, MAT_FACTOR_CHOLESKY, &F);
MatFactorInfo factinfo;
MatFactorInfoInitialize(&factinfo);
IS perm, iscol;
MatGetOrdering(A, MATORDERINGNATURAL, &perm, &iscol);
MatCholeskyFactorSymbolic(F, A, perm, &factinfo);
MatCholeskyFactorNumeric(F, A, &factinfo);
ISDestroy(&iscol);
ISDestroy(&perm);

MatSolve(F, rhs, x);

// Now I would like to access the diagonal part of the matrix F, can I do
something like:

Mat_SeqAIJ *aa = (Mat_SeqAIJ*)F->data;

Do you maybe have an example I could look at?

Grateful in advance,
Jelena
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130225/ff926393/attachment.html>


More information about the petsc-users mailing list