Skip to content

Commit

Permalink
Cast to Qubit for type checking.
Browse files Browse the repository at this point in the history
  • Loading branch information
cqc-alec committed Jul 19, 2024
1 parent 464add5 commit fbea238
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pytket/extensions/pyquil/pyquil_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,11 @@ def pyquil_to_tk(prog: Program) -> Circuit:
raise NotImplementedError(
"Operation not supported by tket: " + str(i)
) from error
qubits = [qmap[q.index] for q in i.qubits]
qubits = [qmap[cast(Qubit_, q).index] for q in i.qubits]
params: list[Union[Expr, float]] = [param_from_pyquil(p) for p in i.params] # type: ignore
tkc.add_gate(optype, params, qubits)
elif isinstance(i, Measurement):
qubit = qmap[i.qubit.index]
qubit = qmap[cast(Qubit_, i.qubit).index]
reg = cregmap[i.classical_reg.name] # type: ignore
bit = reg[i.classical_reg.offset] # type: ignore
tkc.Measure(qubit, bit)
Expand Down

0 comments on commit fbea238

Please sign in to comment.