matrix inverse (awk)

I need to inverse a matrix given in a file.
The problem is I'm stuck with writing determinant finding algoritm into code.

I found this algoritm about finding determinant of nxn matrix. This is what i need:

Matrices and Determinants

and here:

a11 a12 a13
a21 a22 a23
a31 a32 a33

= a11(a22a33 a23a32) a12(a21a33 a23a31) + a13(a21a32 a22a31)
Note the pattern of + and signs.
The general formula is compact, but tedious to compute. Here it is for an n by n matrix A:
detA = ai1Ci1 + ai2Ci2 + � � � + ainCin

where Cij are referred to as the cofactors and are computed from
Cij = (1)i+j detMij
The term Mij is known as the �minor matrix� and is the matrix you get if you eliminate row
i and column j from matrix A. So to find the determinant of e.g. a 4�4 matrix, you end up
calculating a bunch of 3 � 3 matrix determinants (much easier). Obviously you can apply this
technique recursively (probably using a computer).

***************

Can some1 please write it into my code or if he has time even complete the full inverse.

I read the matrix from a file into an array "row":
----------------

#!/usr/bin/awk -f
BEGIN{}
{
m=1
while (m <= NF){
row[NR,m] = $m
m++
}
}

END{}

--------------

thank you.