# What does the @-operator do?

I've been trying to figure out what the @ in the following code does:

T_world2bcam = -1*R_world2bcam @ cam.location

where R_world2bcam is a 3x3 Matrix and cam.location is a Vector.

The code is from this blender answer.

I have searched for this in the python docs, numpy docs, blender docs but was not able to find anything. Please excuse me, if this is a dumb answer, but I'm quite frustrated not being able to find anything about that ominous @.

• In this case it's matrix-vector multiplication. It also does matrix-matrix multiplication and quaternion-quaternion multiplication. Feb 28, 2022 at 19:44

In math, you can multiply any two matrices $$X$$ and $$Y$$ provided that the second dimension of $$X$$ is the same as the first dimension of $$Y$$, that is, so long as $$X$$ is an $$m$$ x $$n$$ matrix and $$Y$$ is an $$n$$ x $$o$$ matrix. The result will be a $$m$$ x $$o$$ matrix. In math this is represented usually with the simple multiply operator $$X * Y$$ but for reasons described in PEP 465, it was decided to adopt the @ character in Python to distinguish matrix multiply, which is not commutative, from scaler multiply, which in the case of two scalers is commutative.