Advertisement

Inverse of a Matrix

Started by March 29, 2000 07:03 PM
1 comment, last by PRISMA 24 years, 5 months ago
Hey everyone. I need some help. I have forgotten how to inver a 4x4 matrix. I remember how to inver a 2x2 and a 3x3, but a 4x4 (or an NxN for that matter) uses a different algorithm. Any replies (relevant) will be greatly appreciated.
Actually we just talked about this is the rotation about an arbitrary axis thread.

Do you know how to do a Gauss-Jordan reduction on a matrix?

If so, in order to calculate the inverse of an n x n matrix you can simply create a new matrix with the n x 2n matrix with the right square being the matrix to be inverted and the left square being the n x n identity matrix, and perform a gaussian reduction on the matrix.

So if you want to invert:
[1 2 3]
[1 4 9]
[1 1 1]
create a matrix:
[1 2 3 1 0 0]
[1 4 9 0 1 0]
[1 1 1 0 0 1]
And perform the reduction and you''d get:
[1 0 0 -2.5 .5 3]
[0 1 0 4.0 -1 -3]
[0 0 1 -1.5 .5 1]

And the matrix
[-2.5 .5 3]
[4.0 -1 -3]
[-1.5 .5 1]
is the inverse.
Advertisement
There''s source code for both Gaussian elimination and Cramer''s rule in this article from Intel:

AP-928 Streaming SIMD Extensions -Inverse of 4x4 Matrix

Oh, and don''t mind that it says SIMD Extensions, it shows how to do it with normal instructions as well.

This topic is closed to new replies.

Advertisement