Dot
Dot(x, y)
x . y
computes products of vectors, matrices, and tensors.
Note: the Dot
operator has the attribute Flat
(associative property) but not Orderless
(commutative property).
See:
- Wikipedia - Matrix multiplication
- YouTube - Matrix multiplication as composition | Essence of linear algebra, chapter 4
Examples
Scalar product of vectors:
>> {a, b, c} . {x, y, z}a*x+b*y+c*z
Product of matrices and vectors:
>> {{a, b}, {c, d}} . {x, y}{a*x+b*y,c*x+d*y}
Matrix product:
>> {{a, b}, {c, d}} . {{r, s}, {t, u}}{{a*r+b*t,a*s+b*u}, {c*r+d*t,c*s+d*u}}
>> a . ba.b
Wrong dimensions print an error message:
{{a, b}, {c, d}}.{{x, y}}
Dot: Tensors {{a,b},{c,d}} and {{x,y}} have incompatible shapes.
Related terms
Flat, MatrixPower, Orderless, Times
Implementation status
- ✅ - full supported