Skip to content

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:

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 . b
a.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.

Flat, MatrixPower, Orderless, Times

Implementation status

  • ✅ - full supported

Github