Is there any existing library or repository library available to calculate inverse matrix, especially for large scale matrix?

**Best answer by Marcel Hunting**

+1

Is there any existing library or repository library available to calculate inverse matrix, especially for large scale matrix?

**Best answer by Marcel Hunting**

Hi

What do you mean by large scale? Using Eigen it takes a couple of seconds to calculate the inverse of a 1,000 x 1,000 matrix but for a 10,000 x 10,000 matrix it takes a long time.

Why do you need the inverse? The Eigen documentation mentions this disclaimer: “First of all, make sure that you really want this. While inverse and determinant are fundamental mathematical concepts, in *numerical* linear algebra they are not as useful as in pure mathematics.”.

+1

Hi Marcel,

The matrix I have is 9000 by 9000. But it is a very sparse matrix. It can be quickly inversed using Matlab.

Does Eigen have sparse matrix technique to calculate the inverse faster? Thank you!

+1

Please also shed some lights on how to connect Eigen with AIMMS using external procedure?

Hi

Attached is a zip file that contains three folders:

**CalcInverse**: small AIMMS project with an example to calculate the inverse.**EigenLinearAlgebra**: AIMMS library that calls an external procedure to calculate the inverse using Eigen. (It is used in the example project.)**src**: Visual Studio project with source code to calculate the inverse using Eigen. It retrieves the matrix from AIMMS and passes back the inverse matrix to AIMMS.

You have to build the DLL containing the external procedure yourself using Visual Studio. For that you need to download Eigen from here and then copy the Eigen sub-folder from the Eigen package to the src folder.

The external procedure prGetInverse in the AIMMS library has an argument ‘isPD’ which can be set to 1 to indicate that the matrix is positive definite. In that case a different method will be used which should be faster than the standard method.

The example loads the data for a 1,000x1,000 matrix by default. It also contains a case file for a 10,000x10,000 matrix.

+1

Thank you very much, Marcel. This is really helpful.

Already have an account? Login

**Please use your business or academic e-mail address to register**

No account yet? Create an account

Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.

Didn't find what you were looking for? Try searching on our documentation pages: