The function InvertMatrix inverts the (square) matrix Data. The inverse matrix is stored on top of the original data (thereby destroying the original contents). The matrix inversion is carried out using the LUdecomposition procedure (decomposition into two triangle matrices). It must not be applied to nonquadratic matrices.
The function returns the following error codes:
0 ... everything is OK
1 ... Data is not a square matrix
2 ... not enough memory on heap
3 ... LU decomposition was not possible (the matrix is singular)
In the case of a nonzero return code the resulting matrix is undefined.
