This is pretty good C code for determinants.
It is recursive on the order of the input matrix.
I can’t improve here on the calling convention described in the first four lines of the source.
The program computes the determinant in about k3 steps.
Avoiding division seems to require about k! steps.
This routine is vulnerable to ill conditioned matrices such as when m[1, 1] is orders of magnitude less than other typical elements.
I know how to avoid this particular problem, but not other similar problems.
Here is a short test program.
“gcc d.c t.c; ./a.out” runs the test.
The recapitulation of the matrix in parens facilitates testing against this Scheme code.
Algol68 Determinant
The slice feature of Algol68 leads to a much more straight forward version if you speak the language.
(Here is one that eliminates a GOTO.)
PL/I has similar features but I have no such compiler.
With a parenthesis savvy editor you can navigate this version more easily where
the construct IF a THEN b ELSE c FI is replaced by the equivalent (a | b | c).
A slower A68 determinant program that avoids divide.
OCaml Matrix Module
This OCaml module includes a determinant procedure.