2
$\begingroup$

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

qml.expval(qml.PauliX(0) @ qml.PauliX(1))
$\endgroup$

1 Answer 1

3
$\begingroup$

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.

$\endgroup$

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.