A generalisation of a dot operation, which is a multiplicative
expansion of two arrays and sum contraction along the middle two
dimensions.
matrix multiplication
>>> let b = fromFlatList [2,3] [1..6] :: Array Int
>>> dot sum (*) b (transpose b)
[[14, 32],
[32, 77]]
inner product
>>> let v = fromFlatList [3] [1..3] :: Array Int
>>> dot sum (*) v v
14
matrix-vector multiplication Note that an `Array Int` with shape [3]
is neither a row vector nor column vector.
dot is not turning
the vector into a matrix and then using matrix multiplication.
>>> dot sum (*) v b
[9, 12, 15]
>>> dot sum (*) b v
[14, 32]