I just started using python cirq library and I came across the following line of code in the tutorial:
XX_obs = cirq.X(q0) * cirq.X(q1)
I just want to find in the code what this *
operator do on this two specific cirq objects. How to do so?
First, you need to find what the type of cirq.X(q0)
is:
print(type(cirq.X(q0)))
Then look for the definition, in that class, of the method __mul__
. The __mul__
method of a class defines how an object behaves as a left operant of a multiplication operation.