diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 30cec2f..08f96db 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: fail-fast: false matrix: os: ['ubuntu-latest', 'windows-2022', 'macos-latest'] - python: ['3.9', '3.10', '3.11', '3.12'] + python: ['3.10', '3.11', '3.12', '3.13'] name: "Python ${{ matrix.python }} / ${{ matrix.os }}" runs-on: ${{ matrix.os }} diff --git a/examples/gallery/aer_sim.py b/examples/gallery/aer_sim.py index 2e01b70..1939e55 100644 --- a/examples/gallery/aer_sim.py +++ b/examples/gallery/aer_sim.py @@ -67,10 +67,7 @@ def swap(circuit, a, b): # transpile and plot the graph pattern = circuit.transpile().pattern -nodes, edges = pattern.get_graph() -g = nx.Graph() -g.add_nodes_from(nodes) -g.add_edges_from(edges) +g = pattern.extract_graph() np.random.seed(100) nx.draw(g) plt.show() diff --git a/graphix_ibmq/compiler.py b/graphix_ibmq/compiler.py index 8751d4e..9cf718a 100644 --- a/graphix_ibmq/compiler.py +++ b/graphix_ibmq/compiler.py @@ -110,7 +110,8 @@ def _apply_e(self, cmd: E) -> None: def _apply_m(self, cmd: M) -> None: """Handles the M command: perform a measurement.""" - if cmd.plane != Plane.XY: + measurement = cmd.measurement.to_bloch() + if measurement.plane != Plane.XY: raise NotImplementedError("Non-XY plane measurements are not supported.") circ_idx = self._qubit_map[cmd.node] @@ -118,8 +119,8 @@ def _apply_m(self, cmd: M) -> None: self._apply_classical_feedforward("X", circ_idx, cmd.s_domain) self._apply_classical_feedforward("Z", circ_idx, cmd.t_domain) - if cmd.angle != 0: - self._circuit.p(-cmd.angle * np.pi, circ_idx) + if measurement.angle != 0: + self._circuit.p(-measurement.angle * np.pi, circ_idx) self._circuit.h(circ_idx) self._circuit.measure(circ_idx, self._next_creg_idx) diff --git a/graphix_ibmq/converter.py b/graphix_ibmq/converter.py index 243927a..25b8aa8 100644 --- a/graphix_ibmq/converter.py +++ b/graphix_ibmq/converter.py @@ -1,6 +1,7 @@ from __future__ import annotations from graphix import Circuit +from graphix.fundamentals import rad_to_angle from qiskit import QuantumCircuit, transpile @@ -28,9 +29,9 @@ def qiskit_to_graphix(qc: QuantumCircuit) -> Circuit: circuit.h(idx) for ci in qc.data: if ci.operation.name == "rx": - circuit.rx(ci.qubits[0]._index, ci.operation.params[0]) + circuit.rx(ci.qubits[0]._index, rad_to_angle(ci.operation.params[0])) elif ci.operation.name == "rz": - circuit.rz(ci.qubits[0]._index, ci.operation.params[0]) + circuit.rz(ci.qubits[0]._index, rad_to_angle(ci.operation.params[0])) elif ci.operation.name == "cx": circuit.cnot(ci.qubits[0]._index, ci.qubits[1]._index) else: diff --git a/requirements.txt b/requirements.txt index ad46ef2..beaae77 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,4 @@ numpy qiskit>=1.0,<2 qiskit_ibm_runtime qiskit-aer -graphix +graphix @ git+https://github.com/thierry-martinez/graphix@fix/181-pauli_plane_measurements diff --git a/setup.py b/setup.py index 8344a5a..ef19938 100644 --- a/setup.py +++ b/setup.py @@ -27,15 +27,15 @@ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Science/Research", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Topic :: Scientific/Engineering :: Physics", ], - "python_requires": ">=3.8,<3.13", + "python_requires": ">=3.10,<3.14", "install_requires": requirements, "extras_require": {"test": ["graphix"]}, }