I'm a linear algebra weakling and am looking for help anywhere I can find it.
I'm attempting to calculate the inverse of a 14x14 square matrix using Gauss-Jordan elimination. This seems to work for some matrix input, but not all. I end up with an almost zero value on the diagonal, which really blows up the scaling of the values in the matrix.
I'm comparing my results to those calculated by Matlab. For my initial set of matricies, the results match (within rounding differences). But for the following matrix, they do not. (sorry for the large data set: if there's a better way to show this please let me know).
-10.685512 -1.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
63.545570 1.000000 -1.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
-213.193800 0.000000 1.000000 -1.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
493.092433 0.000000 0.000000 1.000000 -1.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
-831.846712 0.000000 0.000000 0.000000 1.000000 -1.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
1055.702065 0.000000 0.000000 0.000000 0.000000 1.000000 -1.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
-1024.015861 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000 -1.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
762.935063 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000 -1.000000 0.000000 0.000000 0.000000 0.000000 0.000000
-434.501577 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000 -1.000000 0.000000 0.000000 0.000000 0.000000
186.205620 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000 -1.000000 0.000000 0.000000 0.000000
-58.228421 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000 -1.000000 0.000000 0.000000
12.560150 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000 -1.000000 0.000000
-1.672796 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000 -1.000000
0.103779 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000
Element (14,14) becomes nearly zero [~4.354*10^-12] when eliminating element (14,13) by scaling and subtracting row 13 from row 14. So when I go to scale row 14 to get the diagonal value to equal 1.0, the scaling just gets huge. [Note: I'm using long double data types to operate on.]
The Matlab result is also a matrix with very large values, but they are quite different than mine. I'm guess the very small/very large numbers are throwing things off, but I can't tell where. Is there a different technique I need to employ to get the same answer as Matlab?