Inner Product (f.g)¶
Syntax¶
f and g are dyadic scalar functions. X and Y are arrays.
Description¶
Generalised inner product. Applies g to corresponding pairs along the last axis of X and the first axis of Y, then reduces the results with f.
The classic case is +.× (matrix multiply / dot product).
Vector dot product¶
Computes (1×4)+(2×5)+(3×6).
Matrix multiply¶
The left array has shape 2 3, the right has shape 3 2, and the result has shape 2 2.
Other inner products¶
You can use any pair of dyadic functions. For example, ∧.= tests whether two vectors are identical element-wise:
Shape rules¶
| Left shape | Right shape | Result shape |
|---|---|---|
n |
n |
scalar |
m n |
n p |
m p |
n |
n p |
p |
The last axis of the left argument must equal the first axis of the right argument (LENGTH ERROR otherwise).
See also¶
- Outer Product (
∘.f)