Matrix Multiplication in 3 Dimensions [duplicate]

Possible Duplicate:
Is there a 3-dimensional “matrix” by “matrix” product?

Is matrix multiplication of 3-dimensional matrices defined? I cannot wrap my mind around how it would even work. Equivalently, is matrix multiplication only defined for 2-dimensional matrices?

Edit: The linked question cleared things up for me. I was so used to coding in Matlab with multi-dimensional "matrices" that I didn't think about what I was really doing (eg. 3-dimensional element-wise multiplication isn't really matrix multiplication). Investigating tensors is probably the mathematically-correct answer to my less than precise question. The open-ended-ness of tensor contraction though, means that there isn't one solution to my question.

-
What do you mean by a $3$-dimensional matrix? Perhaps you are looking for tensors? –  Alex Becker Jul 26 '12 at 0:00
Whatdo you call "matrix-dimension" to? Do you mean $\,3\times 3\,$ matrices or what? –  DonAntonio Jul 26 '12 at 0:01
"Tensor contraction" is what you're looking for, but there is more than one way to contract tensors when you have many indices to choose from to sum over together. –  anon Jul 26 '12 at 0:02
JohnC, I guess one source of your confusion is "3D array" which are pervasive in programming. See Jon's answer below. –  user2468 Jul 26 '12 at 2:11
A matrix encodes a linear transformation $T:V\rightarrow W$ in terms of a basis $\{v_1,...,v_n\}$ of $V$ and a basis $\{w_1,...,w_m\}$ of W as follows. The $i^{th}$ column of the matrix is obtained by arranging the $a_{ik}$, $k=1,...,m$ in the column, where $Tv_{i}=a_{i1}w_1+...+a_{im}w_m$. Matrix multiplication tells us how to relate the matrix coefficients of a composition of two linear maps of compatible dimension to the coefficients of the matrices of the composed maps. A more basic question to ask (still interesting) along your lines is: what type of map between (what type of) vector spaces does a 3-dimensional "matrix block" encode? We could go and launch into tensors here, but it would be nice to sneak up on this in an elementary way like the above linear transformation picture. Perhaps it would be fun to think about bilinear maps $T:V \times V \rightarrow \mathbb{R}$ written in terms of bases, for starters. Anyhow, this is a long comment, but I think there are some fun things to do here.