From 169f596545343a46cd2966beabec78ca412df87d Mon Sep 17 00:00:00 2001 From: Keefe Huang Date: Tue, 23 Dec 2025 20:33:05 +0100 Subject: [PATCH 01/10] Derive Clone for StrategyEnums --- Cargo.lock | 21 +++++++++++---------- synir/src/ir/pauli_polynomial.rs | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 93043ff8..132ee0b7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -417,9 +417,9 @@ dependencies = [ [[package]] name = "pyo3" -version = "0.27.1" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37a6df7eab65fc7bee654a421404947e10a0f7085b6951bf2ea395f4659fb0cf" +checksum = "ab53c047fcd1a1d2a8820fe84f05d6be69e9526be40cb03b73f86b6b03e6d87d" dependencies = [ "indoc", "libc", @@ -434,18 +434,18 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.27.1" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f77d387774f6f6eec64a004eac0ed525aab7fa1966d94b42f743797b3e395afb" +checksum = "b455933107de8642b4487ed26d912c2d899dec6114884214a0b3bb3be9261ea6" dependencies = [ "target-lexicon", ] [[package]] name = "pyo3-ffi" -version = "0.27.1" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dd13844a4242793e02df3e2ec093f540d948299a6a77ea9ce7afd8623f542be" +checksum = "1c85c9cbfaddf651b1221594209aed57e9e5cff63c4d11d1feead529b872a089" dependencies = [ "libc", "pyo3-build-config", @@ -453,9 +453,9 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.27.1" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf8f9f1108270b90d3676b8679586385430e5c0bb78bb5f043f95499c821a71" +checksum = "0a5b10c9bf9888125d917fb4d2ca2d25c8df94c7ab5a52e13313a07e050a3b02" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -465,9 +465,9 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.27.1" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70a3b2274450ba5288bc9b8c1b69ff569d1d61189d4bff38f8d22e03d17f932b" +checksum = "03b51720d314836e53327f5871d4c0cfb4fb37cc2c4a11cc71907a86342c40f9" dependencies = [ "heck", "proc-macro2", @@ -668,6 +668,7 @@ version = "0.1.0" dependencies = [ "bitvec", "pyo3", + "pyo3-ffi", "synir", ] diff --git a/synir/src/ir/pauli_polynomial.rs b/synir/src/ir/pauli_polynomial.rs index 47c420d3..ddd53b7e 100644 --- a/synir/src/ir/pauli_polynomial.rs +++ b/synir/src/ir/pauli_polynomial.rs @@ -3,7 +3,7 @@ pub mod naive; pub use naive::NaivePauliPolynomialSynthesizer; -#[derive(Default)] +#[derive(Default, Clone)] pub enum PauliPolynomialSynthStrategy { #[default] Naive, From 2f68e6ccf3e369f744fe328e49db70a8a3a7e583 Mon Sep 17 00:00:00 2001 From: Keefe Huang Date: Tue, 23 Dec 2025 20:32:36 +0100 Subject: [PATCH 02/10] Add new wrapper for Qiskit --- synir/src/ir/clifford_tableau.rs | 3 +- synpy/Cargo.toml | 1 + synpy/integration_tests/test_qiskit.py | 23 ++- synpy/src/lib.rs | 6 +- synpy/src/wrapper.rs | 66 +++++++++ synpy/src/wrapper/qiskit.rs | 194 +++++++++++++++++++++++++ 6 files changed, 290 insertions(+), 3 deletions(-) create mode 100644 synpy/src/wrapper.rs create mode 100644 synpy/src/wrapper/qiskit.rs diff --git a/synir/src/ir/clifford_tableau.rs b/synir/src/ir/clifford_tableau.rs index f843df98..03a06575 100644 --- a/synir/src/ir/clifford_tableau.rs +++ b/synir/src/ir/clifford_tableau.rs @@ -10,7 +10,7 @@ mod helper; mod naive; mod permrowcol; -#[derive(Default)] +#[derive(Default, Clone)] pub enum CliffordTableauSynthStrategy { #[default] Naive, @@ -18,6 +18,7 @@ pub enum CliffordTableauSynthStrategy { Custom(Vec, Vec), } + impl, To, Returns> Synthesizer for T { diff --git a/synpy/Cargo.toml b/synpy/Cargo.toml index c0f48ae8..90adc46c 100644 --- a/synpy/Cargo.toml +++ b/synpy/Cargo.toml @@ -11,4 +11,5 @@ crate-type = ["cdylib"] [dependencies] bitvec = "1.0.1" pyo3 = "0.27.1" +pyo3-ffi = "0.27.2" synir = { path = "../synir" } diff --git a/synpy/integration_tests/test_qiskit.py b/synpy/integration_tests/test_qiskit.py index 3df06263..16555fdd 100644 --- a/synpy/integration_tests/test_qiskit.py +++ b/synpy/integration_tests/test_qiskit.py @@ -2,16 +2,37 @@ from qiskit import QuantumCircuit from synpy.qiskit.plugin import SynPyCliffordPlugin +from synpy.synpy_rust import QiskitSynIR +def test_qiskit_synir() -> None: + qc = QuantumCircuit(2) + synir = QiskitSynIR(qc) + + synir.s(0) + synir.v(0) + synir.s_dgr(0) + synir.v_dgr(0) + synir.x(0) + synir.y(0) + synir.z(0) + synir.h(0) + synir.cx(0, 1) + synir.cz(0, 1) + synir.rx(0, 1.23) + synir.ry(0, 1.23) + synir.rz(0, 1.23) + + def test_qiskit_bell() -> None: qc = QuantumCircuit(2) qc.h(0) qc.cx(0, 1) + cliff = Clifford(qc) plugin = SynPyCliffordPlugin() circ = plugin.run(cliff, None, None, []) # circ.draw() - assert circ == qc + assert circ == qc \ No newline at end of file diff --git a/synpy/src/lib.rs b/synpy/src/lib.rs index aea297ae..c5ad398a 100644 --- a/synpy/src/lib.rs +++ b/synpy/src/lib.rs @@ -1,10 +1,13 @@ mod synthesis; mod tableau; mod validation; +mod wrapper; use crate::synthesis::synthesize_pauli_exponential; use crate::synthesis::{PyCommand, PyPauliString}; use crate::tableau::PyCliffordTableau; +use crate::wrapper::PyPauliExponential; +use crate::wrapper::qiskit::QiskitSynIR; use pyo3::prelude::{PyModule, PyModuleMethods}; use pyo3::{pymodule, wrap_pyfunction, Bound, PyResult}; @@ -15,6 +18,7 @@ fn synpy_rust(m: &Bound<'_, PyModule>) -> PyResult<()> { m.add_class::()?; let _ = m.add_function(wrap_pyfunction!(synthesize_pauli_exponential, m)?); m.add_class::()?; - + m.add_class::()?; + m.add_class::()?; Ok(()) } diff --git a/synpy/src/wrapper.rs b/synpy/src/wrapper.rs new file mode 100644 index 00000000..2ed4e196 --- /dev/null +++ b/synpy/src/wrapper.rs @@ -0,0 +1,66 @@ +pub(crate) mod qiskit; + +extern crate pyo3; +extern crate pyo3_ffi; + +use std::collections::VecDeque; + +use pyo3::prelude::*; +use synir::{ + data_structures::CliffordTableau, + ir::{ + clifford_tableau::CliffordTableauSynthStrategy, + pauli_exponential::{PauliExponential, PauliExponentialSynthesizer}, + pauli_polynomial::PauliPolynomialSynthStrategy, + CliffordGates, Gates, Synthesizer, + }, +}; + +use crate::wrapper::qiskit::QiskitSynIR; + +#[pyclass] +pub struct PyPauliExponential { + pe: PauliExponential, + pauli_strategy: PauliPolynomialSynthStrategy, + tableau_strategy: CliffordTableauSynthStrategy, +} + +#[pymethods] +impl PyPauliExponential { + #[new] + pub fn new(num_qubits: usize) -> Self { + let pe = PauliExponential::new(VecDeque::from(vec![]), CliffordTableau::new(num_qubits)); + Self { pe, pauli_strategy: PauliPolynomialSynthStrategy::Naive, tableau_strategy: CliffordTableauSynthStrategy::PermRowCol } + } + + pub fn synthesize_to_qiskit(&mut self, circuit: &mut QiskitSynIR) { + synthesize(self, circuit); + } + + pub fn set_pauli_strategy(&mut self, strategy: String) { + match strategy.as_str() { + "Naive" => self.pauli_strategy = PauliPolynomialSynthStrategy::Naive, + _ => panic!("Unknown Pauli polynomial synthesis strategy: {}", strategy), + } + } + + pub fn set_tableau_strategy(&mut self, strategy: String) { + match strategy.as_str() { + "Naive" => self.tableau_strategy = CliffordTableauSynthStrategy::Naive, + "PermRowCol" => self.tableau_strategy = CliffordTableauSynthStrategy::PermRowCol, + _ => panic!("Unknown Clifford tableau synthesis strategy: {}", strategy), + } + } +} + +pub fn synthesize(pe: &mut PyPauliExponential, circuit: &mut G) +where + G: CliffordGates + Gates, +{ + let mut synth = PauliExponentialSynthesizer::from_strategy( + pe.pauli_strategy.clone(), + pe.tableau_strategy.clone(), + ); + let pe = std::mem::take(&mut pe.pe); + synth.synthesize(pe, circuit) +} diff --git a/synpy/src/wrapper/qiskit.rs b/synpy/src/wrapper/qiskit.rs new file mode 100644 index 00000000..86e972a4 --- /dev/null +++ b/synpy/src/wrapper/qiskit.rs @@ -0,0 +1,194 @@ +extern crate pyo3; +extern crate pyo3_ffi; + +use pyo3::prelude::*; +use synir::ir::{CliffordGates, Gates}; + +#[pyclass] +pub struct QiskitSynIR { + circuit: Py, +} + +#[pymethods] +impl QiskitSynIR { + #[new] + pub fn new(qiskit_circuit: Py) -> Self { + QiskitSynIR { + circuit: qiskit_circuit, + } + } + + pub fn get_commands(&self, tgt: usize) { + Python::attach(|py| -> PyResult<()> { + self.circuit.call_method1(py, "h", (tgt,))?; + Ok(()) + }) + .unwrap(); + } + + pub fn s(&mut self, target: synir::IndexType) { + Python::attach(|py| -> PyResult<()> { + self.circuit.call_method1(py, "s", (target,))?; + Ok(()) + }) + .unwrap(); + } + + pub fn v(&mut self, target: synir::IndexType) { + Python::attach(|py| -> PyResult<()> { + self.circuit.call_method1(py, "sx", (target,))?; + Ok(()) + }) + .unwrap(); + } + + pub fn s_dgr(&mut self, target: synir::IndexType) { + Python::attach(|py| -> PyResult<()> { + self.circuit.call_method1(py, "sdg", (target,))?; + Ok(()) + }) + .unwrap(); + } + + pub fn v_dgr(&mut self, target: synir::IndexType) { + Python::attach(|py| -> PyResult<()> { + self.circuit.call_method1(py, "sxdg", (target,))?; + Ok(()) + }) + .unwrap(); + } + + pub fn x(&mut self, target: synir::IndexType) { + Python::attach(|py| -> PyResult<()> { + self.circuit.call_method1(py, "x", (target,))?; + Ok(()) + }) + .unwrap(); + } + + pub fn y(&mut self, target: synir::IndexType) { + Python::attach(|py| -> PyResult<()> { + self.circuit.call_method1(py, "y", (target,))?; + Ok(()) + }) + .unwrap(); + } + + pub fn z(&mut self, target: synir::IndexType) { + Python::attach(|py| -> PyResult<()> { + self.circuit.call_method1(py, "z", (target,))?; + Ok(()) + }) + .unwrap(); + } + + pub fn h(&mut self, target: synir::IndexType) { + Python::attach(|py| -> PyResult<()> { + self.circuit.call_method1(py, "h", (target,))?; + Ok(()) + }) + .unwrap(); + } + + pub fn cx(&mut self, control: synir::IndexType, target: synir::IndexType) { + Python::attach(|py| -> PyResult<()> { + self.circuit.call_method1(py, "cx", (control, target))?; + Ok(()) + }) + .unwrap(); + } + + pub fn cz(&mut self, control: synir::IndexType, target: synir::IndexType) { + Python::attach(|py| -> PyResult<()> { + self.circuit.call_method1(py, "cz", (control, target))?; + Ok(()) + }) + .unwrap(); + } + + pub fn rx(&mut self, target: synir::IndexType, angle: f64) { + Python::attach(|py| -> PyResult<()> { + self.circuit.call_method1(py, "rx", (angle, target))?; + Ok(()) + }) + .unwrap(); + } + + pub fn ry(&mut self, target: synir::IndexType, angle: f64) { + Python::attach(|py| -> PyResult<()> { + self.circuit.call_method1(py, "ry", (angle, target))?; + Ok(()) + }) + .unwrap(); + } + + pub fn rz(&mut self, target: synir::IndexType, angle: f64) { + Python::attach(|py| -> PyResult<()> { + self.circuit.call_method1(py, "rz", (angle, target))?; + Ok(()) + }) + .unwrap(); + } +} + +impl CliffordGates for QiskitSynIR { + fn s(&mut self, target: synir::IndexType) { + self.s(target); + } + + fn v(&mut self, target: synir::IndexType) { + self.v(target); + } + + fn s_dgr(&mut self, target: synir::IndexType) { + self.s_dgr(target); + } + + fn v_dgr(&mut self, target: synir::IndexType) { + self.v_dgr(target); + } + + fn x(&mut self, target: synir::IndexType) { + self.x(target); + } + + fn y(&mut self, target: synir::IndexType) { + self.y(target); + } + + fn z(&mut self, target: synir::IndexType) { + self.z(target); + } + + fn h(&mut self, target: synir::IndexType) { + self.h(target); + } + + fn cx(&mut self, control: synir::IndexType, target: synir::IndexType) { + self.cx(control, target); + } + + fn cz(&mut self, control: synir::IndexType, target: synir::IndexType) { + self.cz(control, target); + } +} + +impl Gates for QiskitSynIR { + fn rx(&mut self, target: synir::IndexType, angle: f64) { + self.rx(target, angle); + } + + fn ry(&mut self, target: synir::IndexType, angle: f64) { + self.ry(target, angle); + } + + fn rz(&mut self, target: synir::IndexType, angle: f64) { + self.rz(target, angle); + } +} + +#[cfg(test)] +mod tests { + #[test] + fn test_clifford_s() {} +} From 5e4139105f24db3777d858f29c9e6c840d675968 Mon Sep 17 00:00:00 2001 From: Keefe Huang Date: Tue, 13 Jan 2026 15:02:41 +0100 Subject: [PATCH 03/10] Stashed implementation --- synpy/src/wrapper.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/synpy/src/wrapper.rs b/synpy/src/wrapper.rs index 2ed4e196..ab24a0e6 100644 --- a/synpy/src/wrapper.rs +++ b/synpy/src/wrapper.rs @@ -30,7 +30,11 @@ impl PyPauliExponential { #[new] pub fn new(num_qubits: usize) -> Self { let pe = PauliExponential::new(VecDeque::from(vec![]), CliffordTableau::new(num_qubits)); - Self { pe, pauli_strategy: PauliPolynomialSynthStrategy::Naive, tableau_strategy: CliffordTableauSynthStrategy::PermRowCol } + Self { + pe, + pauli_strategy: PauliPolynomialSynthStrategy::Naive, + tableau_strategy: CliffordTableauSynthStrategy::PermRowCol, + } } pub fn synthesize_to_qiskit(&mut self, circuit: &mut QiskitSynIR) { @@ -43,7 +47,7 @@ impl PyPauliExponential { _ => panic!("Unknown Pauli polynomial synthesis strategy: {}", strategy), } } - + pub fn set_tableau_strategy(&mut self, strategy: String) { match strategy.as_str() { "Naive" => self.tableau_strategy = CliffordTableauSynthStrategy::Naive, From 26a57d3cfff976ed555e9a4734ef712900286bbd Mon Sep 17 00:00:00 2001 From: Keefe Huang Date: Tue, 13 Jan 2026 15:06:49 +0100 Subject: [PATCH 04/10] Format clifford tableau --- synir/src/ir/clifford_tableau.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/synir/src/ir/clifford_tableau.rs b/synir/src/ir/clifford_tableau.rs index 03a06575..a43a2718 100644 --- a/synir/src/ir/clifford_tableau.rs +++ b/synir/src/ir/clifford_tableau.rs @@ -18,7 +18,6 @@ pub enum CliffordTableauSynthStrategy { Custom(Vec, Vec), } - impl, To, Returns> Synthesizer for T { From 832fe137b0b65c3d3716b564023d00345f062167 Mon Sep 17 00:00:00 2001 From: Keefe Huang Date: Wed, 14 Jan 2026 17:33:30 +0100 Subject: [PATCH 05/10] Format files --- synpy/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synpy/src/lib.rs b/synpy/src/lib.rs index c5ad398a..e91400da 100644 --- a/synpy/src/lib.rs +++ b/synpy/src/lib.rs @@ -6,8 +6,8 @@ mod wrapper; use crate::synthesis::synthesize_pauli_exponential; use crate::synthesis::{PyCommand, PyPauliString}; use crate::tableau::PyCliffordTableau; -use crate::wrapper::PyPauliExponential; use crate::wrapper::qiskit::QiskitSynIR; +use crate::wrapper::PyPauliExponential; use pyo3::prelude::{PyModule, PyModuleMethods}; use pyo3::{pymodule, wrap_pyfunction, Bound, PyResult}; From f46f8ad2b24d9210bd1c5f3d8927f6dc9e40ef7d Mon Sep 17 00:00:00 2001 From: Keefe Huang Date: Wed, 14 Jan 2026 17:45:41 +0100 Subject: [PATCH 06/10] Add traililng white space --- synpy/integration_tests/test_qiskit.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/synpy/integration_tests/test_qiskit.py b/synpy/integration_tests/test_qiskit.py index 16555fdd..34f193ef 100644 --- a/synpy/integration_tests/test_qiskit.py +++ b/synpy/integration_tests/test_qiskit.py @@ -22,17 +22,17 @@ def test_qiskit_synir() -> None: synir.rx(0, 1.23) synir.ry(0, 1.23) synir.rz(0, 1.23) - + def test_qiskit_bell() -> None: qc = QuantumCircuit(2) qc.h(0) qc.cx(0, 1) - + cliff = Clifford(qc) plugin = SynPyCliffordPlugin() circ = plugin.run(cliff, None, None, []) # circ.draw() - assert circ == qc \ No newline at end of file + assert circ == qc From d6da2565e5719431842b4706ec0710aba771be9d Mon Sep 17 00:00:00 2001 From: Keefe Huang Date: Wed, 14 Jan 2026 17:46:30 +0100 Subject: [PATCH 07/10] Update pyi file --- synpy/python/synpy/synpy_rust.pyi | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/synpy/python/synpy/synpy_rust.pyi b/synpy/python/synpy/synpy_rust.pyi index a0abcc4d..6e2714ee 100644 --- a/synpy/python/synpy/synpy_rust.pyi +++ b/synpy/python/synpy/synpy_rust.pyi @@ -37,11 +37,39 @@ class PyCliffordTableau(object): def size(self, *args: Any, **kwargs: Any) -> Any: ... def compose(self, *args: Any, **kwargs: Any) -> Any: ... +class PyPauliExponential(object): + def add_cx(self, *args: Any, **kwargs: Any) -> Any: ... + def add_h(self, *args: Any, **kwargs: Any) -> Any: ... + def add_rz(self, *args: Any, **kwargs: Any) -> Any: ... + def synthesize_to_qiskit(self, *args: Any, **kwargs: Any) -> Any: ... + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def __new__(*args: Any, **kwargs: Any) -> Any: ... + +class QiskitSynIR(object): + def s(self, *args: Any, **kwargs: Any) -> Any: ... + def v(self, *args: Any, **kwargs: Any) -> Any: ... + def s_dgr(self, *args: Any, **kwargs: Any) -> Any: ... + def v_dgr(self, *args: Any, **kwargs: Any) -> Any: ... + def x(self, *args: Any, **kwargs: Any) -> Any: ... + def y(self, *args: Any, **kwargs: Any) -> Any: ... + def z(self, *args: Any, **kwargs: Any) -> Any: ... + def h(self, *args: Any, **kwargs: Any) -> Any: ... + def cx(self, *args: Any, **kwargs: Any) -> Any: ... + def cz(self, *args: Any, **kwargs: Any) -> Any: ... + def rx(self, *args: Any, **kwargs: Any) -> Any: ... + def ry(self, *args: Any, **kwargs: Any) -> Any: ... + def rz(self, *args: Any, **kwargs: Any) -> Any: ... + def get_circuit(self, *args: Any, **kwargs: Any) -> Any: ... + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def __new__(*args: Any, **kwargs: Any) -> Any: ... + __all__ = [ "PyCliffordTableau", "PyPauliString", "PyCommand", "synthesize_pauli_exponential", + "PyPauliExponential", + "QiskitSynIR", ] __loader__: Any = ... From c30603af5f11987e940a19b3ed1a3321ad7f0343 Mon Sep 17 00:00:00 2001 From: Keefe Huang Date: Thu, 15 Jan 2026 13:24:10 +0100 Subject: [PATCH 08/10] Remove unused test --- synpy/src/wrapper/qiskit.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/synpy/src/wrapper/qiskit.rs b/synpy/src/wrapper/qiskit.rs index 86e972a4..997d20cf 100644 --- a/synpy/src/wrapper/qiskit.rs +++ b/synpy/src/wrapper/qiskit.rs @@ -186,9 +186,3 @@ impl Gates for QiskitSynIR { self.rz(target, angle); } } - -#[cfg(test)] -mod tests { - #[test] - fn test_clifford_s() {} -} From 512a01a2282239b10839661cc9fa72c48c38a8e4 Mon Sep 17 00:00:00 2001 From: Keefe Huang Date: Thu, 15 Jan 2026 13:24:35 +0100 Subject: [PATCH 09/10] Remove stub of function --- synpy/src/wrapper/qiskit.rs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/synpy/src/wrapper/qiskit.rs b/synpy/src/wrapper/qiskit.rs index 997d20cf..7e7f7606 100644 --- a/synpy/src/wrapper/qiskit.rs +++ b/synpy/src/wrapper/qiskit.rs @@ -18,14 +18,6 @@ impl QiskitSynIR { } } - pub fn get_commands(&self, tgt: usize) { - Python::attach(|py| -> PyResult<()> { - self.circuit.call_method1(py, "h", (tgt,))?; - Ok(()) - }) - .unwrap(); - } - pub fn s(&mut self, target: synir::IndexType) { Python::attach(|py| -> PyResult<()> { self.circuit.call_method1(py, "s", (target,))?; From fe970b596769982bec14a1c291b11cf12fa81c24 Mon Sep 17 00:00:00 2001 From: Keefe Huang Date: Thu, 15 Jan 2026 13:31:07 +0100 Subject: [PATCH 10/10] Add test to ensure qiskit circuit is built --- synpy/integration_tests/test_qiskit.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/synpy/integration_tests/test_qiskit.py b/synpy/integration_tests/test_qiskit.py index 34f193ef..95dc3f37 100644 --- a/synpy/integration_tests/test_qiskit.py +++ b/synpy/integration_tests/test_qiskit.py @@ -23,6 +23,15 @@ def test_qiskit_synir() -> None: synir.ry(0, 1.23) synir.rz(0, 1.23) + reference_circuit = ["s", "sx", "sdg", "sxdg", "x", "y", "z", "h", "cx", "cz", "rx", "ry", "rz"] + reference_angles = [None, None, None, None, None, None, None, None, None, None, 1.23, 1.23, 1.23] + + for inst in qc.data: + assert inst.name == reference_circuit.pop(0) + reference_param = reference_angles.pop(0) + if inst.params: + assert inst.params[0] == reference_param + def test_qiskit_bell() -> None: qc = QuantumCircuit(2) @@ -33,6 +42,5 @@ def test_qiskit_bell() -> None: plugin = SynPyCliffordPlugin() circ = plugin.run(cliff, None, None, []) - # circ.draw() assert circ == qc