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 Jun 27, 2024
1 parent 0c346b8 commit bc11ce9
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 bc11ce9

Please sign in to comment.