CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   How can I find the inverse of a sparse matrix (https://www.cfd-online.com/Forums/openfoam-programming-development/128684-how-can-i-find-inverse-sparse-matrix.html)

mechy January 18, 2014 17:10

How can I find the inverse of a sparse matrix
 
I have a matrix n*n and I want to find its inverse.
the matrix is not a 3 diagonal matrix (lower-upper- diagonal)and therefor I can not use the lduMatrix
any help will be appreciated

wyldckat January 19, 2014 10:47

Hi mechy,

I'm just dropping by to help future readers on where you found part of the solution to your problem and a link to another thread that is on a related topic:
Best regards,
Bruno

chegdan January 19, 2014 21:29

Quote:

the matrix is not a 3 diagonal matrix (lower-upper- diagonal)and therefor I can not use the lduMatrix
This is an incorrect assumption. lduMatrix can be used to represent a sparse matrix with any pattern**, not just 3 diagonals like you are assuming. The whole idea of the lduSolvers (preconditioned conjugate gradient, preconditioned bi-conjugate gradient, etc.) is to find the inverse of a sparse matrix, and also one of the key components of implicit finite volume methods. Your choice of algorithms depends on the system characteristics (mainly symmetric or asymmetric A, as in Ax=b ). The following threads may get you started at least with the storage format

If you want to look into the actual methods, i would look at the book "iterative methods for sparse linear systems" and the paper "An introduction to the conjugate gradient method without the agonizing pain". Good luck.

**much like CSR, CSC, ELL, and others...but some are better suited for certain sparse patterns


All times are GMT -4. The time now is 09:16.