2 /* function det: computes the determinant of a square matrice in exponential
4 ran 50 times on 3 matrices of dimension 3*3 */
7 int mat1[9] = {-5, 2, -2, -10, 7, -1, 4, -8, 5};
8 int mat2[9] = {7, -9, 4, 8, 8, 10, -8, 10, 1};
10 void lmatrice (int mat[], int lmat[], int n, int l) {
11 int i, j, line = 0, m = n-1;
13 for (i = 0; i < n ; i++) {
15 for (j = 1 ; j < n ; j++)
16 lmat[line*m + j-1] = mat[i*n + j];
22 int det (int mat[], int n) {
23 int res = 0, signe = 1, i;
27 if (n == 1) return mat[0];
29 for (i = 0 ; i < n ; i++) {
30 lmatrice(mat, lmat, n, i);
31 /* The real computation has been disable to avoid overflow, but the
32 complexity is the same. */
34 // res += signe * mat[i] * det(lmat, n-1);
42 int i, res1, res2, res3;
45 int mat3[9] = {7, -9, 7, 6, -10, -10, -5, -4, 1};
47 for (i = 0 ; i < 50 ; i++) {
48 res1 = det(mat1, size);
49 res2 = det(mat2, size);
50 res3 = det(mat3, size);