I'm trying to use MATMPIDENSE matrices to solve a system of type Ax=b, but I have some problems. The KSP documentation says that KSPSolve for dense matrices requires to set a 'gmres' solver and a 'lu' preconditioner, the problem is that a 'lu' preconditioner doesn't work in parallel and the corresponding 'asm' doesn't work with dense matrices. How can I solve this "loop" ?

Also, I need to do some operations with these dense matrices, like call a MatMatMult that seems to not work with MATMPIDENSE. Is it the case ? What can I do ?

I have even tried to compute a gather of my matrices, to allow these operations, but I have an error message if run with more than 1 processor on the calls SetMatType(A,MATSEQDENSE) and MatGetRow(A,...).

Thank you in advance, Elisa

  • $\begingroup$ PETSc is concentrated mainly on sparse operators in your system, hence functionality for MATMPIDENSE is limited. Where does your problem come from and which size does it have? If you need a lot of dense algebra PETSc is probably not the right package for you. Consider Jack Poulson's projects, namely Elemental for dense dustributed algebra: users.ices.utexas.edu/~poulson $\endgroup$
    – Alexander
    Apr 20, 2012 at 9:57
  • $\begingroup$ I do need to use PETSC because of I'm implementing some new devices in a library that uses PETSC. It is a Finite Element Library, that implies a very large size of problems, that is why I'd like to use a parallel solver. Thank you. $\endgroup$
    – Elisa
    Apr 20, 2012 at 11:28
  • $\begingroup$ @Elisa: Aren't finite element stiffness matrices usually sparse? Why is yours dense? $\endgroup$
    – Dan
    Apr 20, 2012 at 17:05

1 Answer 1


Configure with PLAPACK support and those operations will work. We are hoping to also add Elemental support this summer.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.