2
$\begingroup$

I want to reset a single qubit that is part of a larger register. Is this possible in pytket?

Resetting the single qubit

qc.add_gate(OpType.Reset,q_register[0])

throws

TypeError: add_gate(): incompatible function arguments. The following argument types are supported:

Resetting the whole register

qc.add_gate(OpType.Reset,q_register)

results in

RuntimeError: 30 args provided, but Reset requires 1

Maybe I just have the syntax wrong.

$\endgroup$

1 Answer 1

1
$\begingroup$

Great question, it turns out that add_gate takes a list of unit ids

pytket add_gate

Hence try:

qc.add_gate(OpType.Reset,[q_register[0]])
$\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.