tags:

views:

326

answers:

4

Possible Duplicates:
Defining a matrix as an array of arrays and computation 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

A: 

Here's a link that you can use. Or you can just download the zip file without bothering the explanation.

Ngu Soon Hui
Nothing like doing his homework for him.
San Jacinto
I don't think it's helpful to suggest not bothering about the explanation. Somebody who doesn't understand how to invert a matrix isn't going to understand when and why either.
David Thornley
+8  A: 

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?"

dmckee
Great answer to the question given; not snarky, but makes a point.
San Jacinto
+1  A: 

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.

wheaties
+1  A: 

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

Ashish