0
votes

I am looking for the most efficient way to calculate an inverse of a matrix. I know that it has something to do with the LU decomposition, or separating it in two matrix, superior triangular and inferior triangular matrix and the solving the two systems, but I can't work out the code in MATLAB. I don't even know where to start, or how to use the system's results in my problem. I really need it because I have to solve a 10.000 X 10.000 matrix and the simple way takes forever.

1
Matlab's builtin inv is probably about the most efficient you can use. And if you need to solve a linear system, rather than computing the matrix inverse, take a look at mldivide - Luis Mendo

1 Answers

1
votes

Often a matrix inverse is not really needed to solve a matrix problem. For example, the standard solution of A x = b, where A is square and non-singular, is often expressed as x = inv(A) * b. But this is not how such a system is solved in practice.

So the naive solution in MATLAB would be:

x = inv(A)*b;

but the efficient solution would be

x = A\b;

where the latter uses a number of advanced techniques that do not require an explicit inverse of the matrix A. See Matrix Inverse documentation for details.