I would find Inverted matrix A ... (A)-1
can you help me?
- 3 Contributors
- forum3 Replies
- 147 Views
- 2 Days Discussion Span
- comment Latest Post by hana.shamsaldeen
mike_2000_17 2,669
I would find Inverted matrix A ... (A)-1
Like you would in any other language that don't have built-in methods to do so. There are many algorithms for this purpose, each with different properties (efficiency, stability, amplification of round-off errors, etc.) and for different kinds of matrices (general, normal, well-conditioned / ill-conditioned, symmetric, positive-/negative-definite, indefinite, rank-deficient (pseudo-inverse methods), etc.). By and large, however, inverting a matrix is rarely needed, so most methods are essentially methods to solve a system of linear equations (Ax = b), and by making the right-hand side equal to the identity matrix, you find the inverse (if that is really what you need). So, what you need to look for are methods to solve systems of linear equations. These include, but not limited to, Gaussian elimination (or its more sophisticated versions, the LU-decomposition or Cholesky decomposition (symmetric positive-definite)), QR decomposition (and variations like QL, RQ, and RRQR), Singular-value decomposition, etc... and the list goes on. There are entire books written on the subject, for example Golub and van Loan (this is pretty much the bible of matrix numerical methods).
There are also libraries that can do that for you, like Eigen, or my own, or the older classic (C) libraries like LAPACK or GSL.
DavidB 44
What, exactly, are you looking for? An explanation of an algorithm for doing the inversion?
Help writing code for an algorithm you have?
Or perhaps you don't need the program (source code) itself, you just need a tool that does the inversion? In this case, most scientific calculators have that function built-in.
Otherwise, Mike has listed several pretty good resources to get you started reading about the process.
yes , I'm looking for An explanation of an algorithm for doing the inversion
but thanks , I found it:::
int main()
{
float a[3][3]={2 ,0 , 0 ,0 ,1 ,0 ,0 ,0 ,5};
float b[3][3]={1 ,0 , 0 ,0 ,1 ,0 ,0 ,0 ,1};
int i,j,k,l;
float t;
for (j = 0; j<4; j++)
{
for (i=j; i<4; i++)
{
if (a[i][j] != 0)
{
t = 1.0/a[j][j];
for (k = 0; k<8; k++)
{
a[j][k] *= t;
b[j][k] *= t;
}
for (l = 0; l<4; l++)
{
if (l != j)
{
t = -a[l][j];
for (k = 0; k<4; k++)
{
a[l][k] = a[l][k] + t*a[j][k];
b[l][k] = b[l][k] + t*b[j][k];
}
}
}
}
}
}
}