471,066 Members | 1,567 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,066 software developers and data experts.

calculate the inverse of a matrix

how to you write program that calculate the inverse of a matrix
May 17 '07 #1
1 2784
11,448 Expert 8TB
how to you write program that calculate the inverse of a matrix
Take it from me: nobody wants to calculate an explicit form of the invers of a
matrix for two reasons:

1) numerical instability
2) performance.

Instead use a 'LUP' decomposition of a matrix A (google for it). A sketch of
the procedure runs like this:

PA = LU where P is a row permutation matrix (and identity matrix with its rows
permuted) and L and U are lower and upper triangular matrices with the additional
property that the diagonal of L are all 1s (one). Matrix P can be stored very efficiently.

Finding L and U is easy: it's just a partial Gaussian ellimination procedure,
the same thing you had to use for an explicit form of the inverse of a matrix.
Matrix P is found on the fly when you select a suitable pivot for a row.

Solving a linear system Ax= b is equivalent to PAx= Pb (permute the rows of b)
== LU= Pb which is nothing but a so called 'forward' and 'backward' substitution
thanks to the triangularity of matrices L and U.

Google for 'LUP decomposition' for the details.

kind regards,

May 17 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by vishnu mahendra | last post: by
1 post views Thread by praneeth | last post: by
1 post views Thread by ravleen bindra | last post: by
7 posts views Thread by ajeetbaraskar | last post: by
3 posts views Thread by aaram81 | last post: by
2 posts views Thread by hemasundar | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.