Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
cqc-melf committed Sep 14, 2023
1 parent e3f6214 commit 1db170a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions pytket/extensions/pyquil/backends/forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from pyquil.paulis import ID, PauliSum, PauliTerm
from pyquil.quilatom import Qubit as Qubit_

from pytket.circuit import Circuit, OpType, Qubit # type: ignore
from pytket.circuit import Circuit, OpType, Qubit, Node # type: ignore
from pytket.backends import (
Backend,
CircuitNotRunError,
Expand Down Expand Up @@ -145,9 +145,9 @@ def default_compilation_pass(self, optimisation_level: int = 2) -> BasePass:
elif optimisation_level == 2:
passlist.append(FullPeepholeOptimise())
passlist.append(
CXMappingPass(
CXMappingPass( # type: ignore
self.backend_info.architecture,
NoiseAwarePlacement(
NoiseAwarePlacement( # type: ignore
self._backend_info.architecture,
self._backend_info.averaged_node_gate_errors,
self._backend_info.averaged_edge_gate_errors,
Expand All @@ -156,7 +156,7 @@ def default_compilation_pass(self, optimisation_level: int = 2) -> BasePass:
delay_measures=True,
)
)
passlist.append(NaivePlacementPass(self.backend_info.architecture))
passlist.append(NaivePlacementPass(self.backend_info.architecture)) # type: ignore
if optimisation_level == 2:
passlist.append(CliffordSimp(False))
if optimisation_level > 0:
Expand Down Expand Up @@ -280,7 +280,7 @@ def _get_backend_info(cls, qc: QuantumComputer) -> BackendInfo:
char_dict: dict = process_characterisation(qc)
arch = char_dict.get("Architecture", Architecture([]))
node_errors = char_dict.get("NodeErrors")
link_errors = char_dict.get("EdgeErrors")
link_errors: dict[tuple[Node, Node], float] = char_dict.get("EdgeErrors")
averaged_errors = get_avg_characterisation(char_dict)
return BackendInfo(
cls.__name__,
Expand Down
10 changes: 5 additions & 5 deletions pytket/extensions/pyquil/pyquil_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def pyquil_to_tk(prog: Program) -> Circuit:
tkc = Circuit()
qmap = {}
for q in prog.get_qubits():
uid = Qubit("q", int(q))
uid = Qubit("q", q) # type: ignore
tkc.add_qubit(uid)
qmap.update({q: uid})
cregmap: Dict = {}
Expand Down Expand Up @@ -269,7 +269,7 @@ def tk_to_pyquil(
op = command.op
optype = op.type
if optype == OpType.Measure:
qbt: Qubit = Qubit_(command.args[0].index[0])
qbt = Qubit_(command.args[0].index[0])
if qbt in measured_qubits:
raise NotImplementedError(
"Cannot apply gate on qubit "
Expand All @@ -278,7 +278,7 @@ def tk_to_pyquil(
)
bit = command.args[1]
b = cregmap[bit.reg_name][bit.index[0]] # type: ignore
measures.append(Measurement(qbt, b))
measures.append(Measurement(qbt, b)) # type: ignore
measured_qubits.append(qbt)
used_bits.append(bit)
continue
Expand Down Expand Up @@ -317,7 +317,7 @@ def process_characterisation(qc: QuantumComputer) -> dict:
:return: A dictionary containing Rigetti device characteristics
"""
isa = qc.quantum_processor.to_compiler_isa()
coupling_map = [tuple([int(i) for i in e.ids]) for e in isa.edges.values()]
coupling_map = [(int(e.ids[0]), int(e.ids[1])) for e in isa.edges.values()]

str_to_gate_1qb = {
"RX": {
Expand Down Expand Up @@ -399,7 +399,7 @@ def process_characterisation(qc: QuantumComputer) -> dict:

characterisation = dict()
characterisation["NodeErrors"] = node_errors
characterisation["EdgeErrors"] = link_errors
characterisation["EdgeErrors"] = link_errors # type: ignore
characterisation["Architecture"] = arc
characterisation["t1times"] = t1_times_dict
characterisation["t2times"] = t2_times_dict
Expand Down

0 comments on commit 1db170a

Please sign in to comment.