Disclaimer: I'm new to Mathematica.
I have an array $\gamma[i]$ of length $n$, each element of which holds an $m\times m$-matrix. I would like to multiply all of them,
$$\prod_{i=1}^n \gamma[i].$$
I started out thinking this should be incredibly simple but after searching through the documentation and on StackExchange for over an hour, the only information I could find is this post, in which the best answer suggests
Apply[Dot, matrixList]
. Since my matrices are not in a list this doesn't seem to help me much.
gamma[1]
,gamma[2]
, and so forth (notgamma[[1]]
as in a list-array)? $\endgroup$Apply[Dot, Array[gamma, n]]
? $\endgroup$Module[{res = gamma[1]}, Do[res = res . gamma[i], {i, 2, n}]; res]
is a C-like way to go....The previous might be more efficient. Would have to test. $\endgroup$KroneckerPower
-like function. I would useKroneckerProduct @@ Table[m, {n}]
. (@@
is short infix forApply
.)Table
will copy only pointers tom
, so it's memory-efficient. But the Kronecker product will be so much bigger, that's not a major consideration here. $\endgroup$