[ Home  |  FAQ-Related Q&As  |  General Q&As  |  Answered Questions ]


    Search the Q&A Archives


I need a program to compute the inverse and the transpose of...

<< Back to: Available C++ Libraries FAQ

Question by sharaid
Submitted on 11/6/2003
Related FAQ: Available C++ Libraries FAQ
Rating: Rate this question: Vote
I need a program to compute the inverse and the transpose of a 3*3 matrix A.Applying the program to the case where

   A= 1  -1  2
      2   0  1
      0   3  1


Answer by Asmodean
Submitted on 3/11/2004
Rating:  Rate this answer: Vote
Transpose:
trans(i,j) = A(j, i);

Inverse:
write method for calculating cofactor:

Cofactor(Aij)=(-1)^(i+j)Dij

Where Dij is the sub-determinant of the matrice A when row i and column j has been deleted.

This can be used recursively to get the determinant of any matrice, just go down till you get to  base case (1x1 or 2x2).

Inverse:
D = det(A); if D != 0, inverse exists
invAij = (1 / D)*Aji

Translating this to actual code should not be any problem IMO. This sounds lika a typical homework assignment so....

 

Your answer will be published for anyone to see and rate.  Your answer will not be displayed immediately.  If you'd like to get expert points and benefit from positive ratings, please create a new account or login into an existing account below.


Your name or nickname:
If you'd like to create a new account or access your existing account, put in your password here:
Your answer:

FAQS.ORG reserves the right to edit your answer as to improve its clarity.  By submitting your answer you authorize FAQS.ORG to publish your answer on the WWW without any restrictions. You agree to hold harmless and indemnify FAQS.ORG against any claims, costs, or damages resulting from publishing your answer.

 

FAQS.ORG makes no guarantees as to the accuracy of the posts. Each post is the personal opinion of the poster. These posts are not intended to substitute for medical, tax, legal, investment, accounting, or other professional advice. FAQS.ORG does not endorse any opinion or any product or service mentioned mentioned in these posts.

 

<< Back to: Available C++ Libraries FAQ


[ Home  |  FAQ-Related Q&As  |  General Q&As  |  Answered Questions ]

© 2008 FAQS.ORG. All rights reserved.