yorick banner




Global Index


Quick Reference

Yorick Function Reference

Matrix Multiplication

The * binary operator normally represents the product of its operands element-by-element, following the same conformability rules as the other binary operators. However, by marking one dimension of its left operand and one dimension of its right operand with +, * will be interpreted as a matrix multiply along the marked dimensions. The marked dimensions must have the same length. The result will have the unmarked dimensions of the left operand, followed by the unmarked dimensions of the right operand.

For example, if x is a 12-by-25-by-35 array, y and z are vectors of length 35, and w is a 9-by-12-by-7 array, then:
x(,,+)*y(+) is a 12-by-25 array
y(+)*z(+) is the inner product of y and z
x(+,,)*w(,+,) is a 25-by-35-by-9-by-7 array