I'm trying to create compiled function which computes a list of Gamma matrices named `GammaM`

and multiply them within the compiled code.

`cf = Compile[{{n, _Integer}}, Module[{M, GammaM}, M = Table[0.0 + 0.0 I, {i, 1, n}, {j, 1, n}]; GammaM = Table[gamma[i, n], {i, 1, n}]; M = GammaM[[1]].GammaM[[2]]; M], CompilationTarget -> "C", RuntimeOptions -> "Speed"]; `

However I am unable to get a compiled function; the error I get is:

Compile::cplist: GammaM[[1]] should be a tensor of type Integer, Real, or Complex; evaluation will use the uncompiled function. >>

Compile::cset: "Variable M of type !({\"_Complex\", 2}) encountered in assignment of type {!(\"_Integer\", 0)}."

The function `gamma[i,n]`

is defined recursively and returns a complex matrix:

`s3 = {{1.0, 0}, {0.0, -1.0}}; s2 = {{0.0, -I}, {I, 0.0}}; s1 = {{0.0, 1.0}, {1.0, 0.0}}; gamma[mu_, N_] := If[mu <= N - 2, -KroneckerProduct[gamma[mu, N - 2] , s3], If[mu == N - 1, KroneckerProduct[IdentityMatrix[2^((N - 2)/2)], s2], KroneckerProduct[IdentityMatrix[2^((N - 2)/2)], s1]] ] `

Any idea what I may be doing wrong will be appreciated.