[petsc-users] Solving a linear system with sparse matrices
Jose E. Roman
jroman at dsic.upv.es
Sat May 21 12:50:08 CDT 2022
The matrix inv(A)*B can be represented with a shell matrix that calls MatMult() followed by KSPSolve(), if you only need to apply this operator to a vector. It depends on what you are trying to do.
Jose
> El 21 may 2022, a las 18:41, Mateo José Moinelo <mateojmoinelo at gmail.com> escribió:
>
> Hi. I am working on a Petsc program, and I have a problem. I have two sparse matrices A and B, and I want to compute inv(A)*B. I understand that computing the inverse of a matrix directly is not effective, and that in this case, the best way to do the operation is instead solving the system A*X = B, being X the result. I reviewed the documentation, and found some interesting options, like the function MatMatSolve, or using a KSP.
>
> The problem I found is that these options seem to work only for dense matrices, and I do not know how to convert my sparce matrices to dense. What can I do in this case?.
>
> Thanks in advance.
More information about the petsc-users
mailing list