1

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?

Adam Zalcman
  • 26,643
  • 4
  • 71
  • 92
Fallen Apart
  • 723
  • 8
  • 20

1 Answers1

2

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.

Amitai Irron
  • 1,973
  • 1
  • 12
  • 14