inverse of matrix in c++ [duplicate]
Possible Duplicates:
Defining a matrix as an array of arrays and computa开发者_如何学编程tion its inverse matrix in C++ Simple 3x3 matrix inverse code (C++)
how to find a inverse of matrix in c++ . simple coding just to find inverse of 3by3 matrix and also for 4 by 4 matrix
C++ provides no language facility to do this. You must either code it yourself or use a library.
If the question is how to code it, the starting place is "Do you know how to invert a matrix on paper?"
This is not a programming question per se but rather a mathematical question. Finding inverses of a matrix on a computer does, however, require ample knowledge that floating point arithmetic is flawed and imprecise. If you don't believe me create a 3x3 array such that a_mn is 1/(m+n) and use the general inverse matrix solution you'd do on pen and paper. You should go here for all your simple math algorithms needs.
Check out this link to get inverse of the matrix , its very efficient method ( Gauss Jordan ) as compared to method based on co-factor and determinant.
Then think upon it and try to implement it yourself.
http://en.wikipedia.org/wiki/Gauss%E2%80%93Jordan_elimination
精彩评论