Treating arrays as functions, although very powerful, completely neglects the linear algebra structures we are familiar with, that is, matrix-vector and matrix-matrix operations. Fortunately, these linear algebra operations may all be written in a similar unified form:
The vector-vector operation:

The matrix-vector operation:

The matrix-matrix operation:

The vector-matrix operation:

The essential mathematical concept is that of reduction. For a matrix-vector operation, the reduction is given by:

In general, a reduction operation defined between two tensors,  and
, of respective number of dimensions
 and
 may be defined as:

Clearly, the shapes of the tensors must be compatible with that operation to make
any sense. This requirement is familiar for matrix-matrix multiplication. The multiplication Â
of matrices and
only makes sense if the number of columns ofÂ
 equals the number of...