I found some C++ code for finding the determinant of matrix, for 4x4 to 8x8. It works ok, but my project needs matrices that are 18x18 or more, and the code is too slow. The
I assume you're using the naive method of expanding Laplace's formula. If you want to gain in speed, you can decompose your matrix M using LU decomposition (into two lower- and upper-diagonal matrices) which you can achieve with a modified Gauss-Jordan elimination in 2*n^3/3 FLOPS and then calculate the determinant as:
det(M) = det(L) * det(U), which for triangular matrices is just the product of the entries in their diagonal.
This process will still be faster than O(n!).
Edit: you can also use Crout's method, which is widely implemented.