What is the meaning of @ or & in PennyLane code like this one:

qml.expval(qml.PauliX(0) @ qml.PauliX(1))

1 Answer 1


The @ operator is syntactic sugar for the __matmul__ function in python. In the context you’re referring to, this operator has been overloaded to perform multiplication of Pauli operators. You can look at Pennylane’s repo if you want details of how exactly be operator is being defined but in essence, it is performing the product of Paulis in different qubits.

As for the & operator, you would need to provide context.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.