When I try to put an Ry gate into my circuit in cirq, I get an error saying that it only takes one argument.

import cirq
import numpy as np
q = cirq.LineQubit(0)
cirq.Circuit(cirq.Ry(np.pi / 2, q))
TypeError: Ry() takes 1 positional argument but 2 were given

cirq.Ry is a method that, given an angle, returns a gate. You then apply the gate to a qubit:


or, equivalently but a bit more confusingly:

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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