# C+C++ library for inversion of a large scale matrix over cluster

I need to implement a matrix inversion of a very big matrix that currently is exceeding the memory limits of my machine (unfortunately I have little memory running on 32-bit machines). I would like to use a few PCs together to get the result. I am using Linux and I have access to several machines with MPI.

Can you suggest a good C++ library that implements that function? If that's not available, any good article or algorithm on the topic is appreciated as well.

At the moment, I am reading these:

• Most of us work very hard to avoid inverting large matrices. Perhaps if you explained your requirements in more detail some smart person could recommend an approach which would obviate inversion. Sep 18 '13 at 9:12
• hi I am trying to use Levemberg Marquardt/Feed Forward neural network. I need to invert a matrix to solve a set of equations for calculating the wights increments during learning. $\Delta x=[J^\top(x)J(x)+\mu I]^{-1}J^\top(x)R$. THe number of neurons is very high (I am trying 10000). Sep 18 '13 at 11:03
• p.s. I am sorry but I don't know how to edit a formula here. I hope you can help me also to improve my quality of posting. Sep 18 '13 at 11:05
• @AbruzzoForteeGentile: StackExchange sites use MathJax to render mathematical formula, so if you write out your formula using LaTeX notation, the output will look like a LaTeX-typeset formula. Sep 18 '13 at 19:01
• @Geoff Great stuff! Thanks for your quick feedback. Sep 19 '13 at 8:25

Like HighPerformanceMark already pointed out, one does not need to invert a matrix explicitly to solve linear systems. In the Levenberg-Marquardt algorithm, the matrix is positive definite and symmetric and, consequently, you can use the Conjugate Gradient method to solve the linear system. This avoids the need to compute the exact inverse of a matrix and is generally faster and less memory intensive. It should not be a problem at all to solve linear systems with a few 100,000 unknowns with this even on small PCs (depending on how dense/sparse your matrix is).

• Hi Wolfgang. Thank for your response; anyway the neurons I am going to face will be higher soon and (as far as I remember) is calculated as the square of the neurons I use. Do you mind to recommend in any case a library for that? I just want to be prepared to the worst case. Sep 18 '13 at 12:13
• P.S. Off course I'll look at the Conjugate Gradient so I thank you for that. Sep 18 '13 at 12:23
• I think you should read a book on numerical methods to understand how CG works, at least to get the big picture. I would suggest using PETSc to solve your linear system. PETSc also works in parallel. Sep 18 '13 at 12:38