Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "syn"
name = "synir"
version = "0.1.0"
edition = "2021"

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SYN
# synIR



Expand All @@ -20,7 +20,7 @@ make python_project_setup

### Rust

This project requires [rust](), please follow the guidelines for installation.
This project requires rust, please follow the guidelines for installation.

To run the basic rust setup, run:

Expand Down
35 changes: 17 additions & 18 deletions benches/clifford_tableau.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ use crate::connectivity::connectivity_benchmark;
use bitvec::bitvec;
use bitvec::prelude::Lsb0;
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};
use syn::data_structures::CliffordTableau;
use syn::data_structures::PauliString;
use syn::ir::clifford_tableau::naive::NaiveCliffordSynthesizer;
use syn::ir::clifford_tableau::CallbackCliffordSynthesizer;
use syn::ir::CliffordGates;
use syn::ir::Synthesizer;

mod connectivity;
use synir::data_structures::CliffordTableau;
use synir::data_structures::PauliString;
use synir::ir::clifford_tableau::naive::NaiveCliffordSynthesizer;
use synir::ir::clifford_tableau::CallbackCliffordSynthesizer;
use synir::ir::CliffordGates;
use synir::ir::Synthesizer;
use synir::IndexType;

mod connectivity;

Expand Down Expand Up @@ -44,43 +43,43 @@ impl MockCircuit {
}

impl CliffordGates for MockCircuit {
fn s(&mut self, target: syn::IndexType) {
fn s(&mut self, target: IndexType) {
self.commands.push(MockCommand::S(target));
}

fn v(&mut self, target: syn::IndexType) {
fn v(&mut self, target: IndexType) {
self.commands.push(MockCommand::V(target));
}

fn s_dgr(&mut self, target: syn::IndexType) {
fn s_dgr(&mut self, target: IndexType) {
self.commands.push(MockCommand::SDgr(target));
}

fn v_dgr(&mut self, target: syn::IndexType) {
fn v_dgr(&mut self, target: IndexType) {
self.commands.push(MockCommand::VDgr(target));
}

fn x(&mut self, target: syn::IndexType) {
fn x(&mut self, target: IndexType) {
self.commands.push(MockCommand::X(target));
}

fn y(&mut self, target: syn::IndexType) {
fn y(&mut self, target: IndexType) {
self.commands.push(MockCommand::Y(target));
}

fn z(&mut self, target: syn::IndexType) {
fn z(&mut self, target: IndexType) {
self.commands.push(MockCommand::Z(target));
}

fn h(&mut self, target: syn::IndexType) {
fn h(&mut self, target: IndexType) {
self.commands.push(MockCommand::H(target));
}

fn cx(&mut self, control: syn::IndexType, target: syn::IndexType) {
fn cx(&mut self, control: IndexType, target: IndexType) {
self.commands.push(MockCommand::CX(control, target));
}

fn cz(&mut self, control: syn::IndexType, target: syn::IndexType) {
fn cz(&mut self, control: IndexType, target: IndexType) {
self.commands.push(MockCommand::CZ(control, target));
}
}
Expand Down
4 changes: 2 additions & 2 deletions benches/connectivity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use petgraph::visit::Walker;
use rand::prelude::IndexedRandom;
use rand::seq::SliceRandom;
use rand::Rng;
use syn::architecture::connectivity::Connectivity;
use syn::architecture::Architecture;
use synir::architecture::connectivity::Connectivity;
use synir::architecture::Architecture;

fn random_connected_connectivity(
num_nodes: usize,
Expand Down
2 changes: 1 addition & 1 deletion synpy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ crate-type = ["cdylib"]
[dependencies]
bitvec = "1.0.1"
pyo3 = "0.23.3"
syn = { path = "../" }
synir = { path = "../" }
51 changes: 27 additions & 24 deletions synpy/src/synthesis.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
use std::ops::Deref;
use pyo3::{pyfunction, PyRef, PyResult};
use pyo3::exceptions::PyException;
use pyo3::{pyclass, pymethods, PyErr};
use syn::data_structures::{CliffordTableau, PauliPolynomial};
use syn::data_structures::PropagateClifford;
use syn::ir::clifford_tableau::CliffordTableauSynthStrategy;
use syn::ir::CliffordGates;
use syn::ir::Gates;
use syn::ir::pauli_exponential::{PauliExponential, PauliExponentialSynthesizer};
use syn::ir::pauli_polynomial::PauliPolynomialSynthStrategy;
use std::ops::Deref;

use pyo3::{pyfunction, PyRef, PyResult};
use synir::data_structures::PropagateClifford;
use synir::data_structures::{CliffordTableau, PauliPolynomial};
use synir::ir::clifford_tableau::CliffordTableauSynthStrategy;
use synir::ir::pauli_exponential::{PauliExponential, PauliExponentialSynthesizer};
use synir::ir::pauli_polynomial::PauliPolynomialSynthStrategy;
use synir::ir::CliffordGates;
use synir::ir::Gates;
use synir::ir::Synthesizer;
use synir::IndexType;

use crate::validation::validate;
use syn::ir::Synthesizer;

#[pyclass]
#[derive(Debug, Copy, Clone)]
Expand Down Expand Up @@ -137,63 +140,63 @@ impl CommandCollector {
}
}

pub fn commands(&self) -> Vec<PyCommand> {
pub fn commands(&self) -> Vec<PyCommand> {
self.commands.clone()
}
}

impl CliffordGates for CommandCollector {
fn s(&mut self, target: syn::IndexType) {
fn s(&mut self, target: IndexType) {
self.commands.push(PyCommand::S(target));
}

fn v(&mut self, target: syn::IndexType) {
fn v(&mut self, target: IndexType) {
self.commands.push(PyCommand::V(target));
}

fn s_dgr(&mut self, target: syn::IndexType) {
fn s_dgr(&mut self, target: IndexType) {
self.commands.push(PyCommand::SDgr(target));
}

fn v_dgr(&mut self, target: syn::IndexType) {
fn v_dgr(&mut self, target: IndexType) {
self.commands.push(PyCommand::VDgr(target));
}

fn x(&mut self, target: syn::IndexType) {
fn x(&mut self, target: IndexType) {
self.commands.push(PyCommand::X(target));
}

fn y(&mut self, target: syn::IndexType) {
fn y(&mut self, target: IndexType) {
self.commands.push(PyCommand::Y(target));
}

fn z(&mut self, target: syn::IndexType) {
fn z(&mut self, target: IndexType) {
self.commands.push(PyCommand::Z(target));
}

fn h(&mut self, target: syn::IndexType) {
fn h(&mut self, target: IndexType) {
self.commands.push(PyCommand::H(target));
}

fn cx(&mut self, control: syn::IndexType, target: syn::IndexType) {
fn cx(&mut self, control: IndexType, target: IndexType) {
self.commands.push(PyCommand::CX(control, target));
}

fn cz(&mut self, control: syn::IndexType, target: syn::IndexType) {
fn cz(&mut self, control: IndexType, target: IndexType) {
self.commands.push(PyCommand::CZ(control, target));
}
}

impl Gates for CommandCollector {
fn rx(&mut self, target: syn::IndexType, angle: f64) {
fn rx(&mut self, target: IndexType, angle: f64) {
self.commands.push(PyCommand::Rx(target, angle));
}

fn ry(&mut self, target: syn::IndexType, angle: f64) {
fn ry(&mut self, target: IndexType, angle: f64) {
self.commands.push(PyCommand::Ry(target, angle));
}

fn rz(&mut self, target: syn::IndexType, angle: f64) {
fn rz(&mut self, target: IndexType, angle: f64) {
self.commands.push(PyCommand::Rz(target, angle));
}
}
Expand Down
13 changes: 6 additions & 7 deletions synpy/src/tableau.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ use bitvec::prelude::BitVec;
use pyo3::basic::CompareOp;
use pyo3::prelude::*;
use pyo3::PyResult;
use syn::data_structures::CliffordTableau as CliffordTableau;
use syn::data_structures::PauliString;
use syn::data_structures::PropagateClifford;

use syn::ir::clifford_tableau::NaiveCliffordSynthesizer;
use syn::ir::Synthesizer;
use synir::data_structures::CliffordTableau;
use synir::data_structures::PauliString;
use synir::data_structures::PropagateClifford;
use synir::ir::clifford_tableau::NaiveCliffordSynthesizer;
use synir::ir::Synthesizer;

#[pyclass(unsendable)]
pub struct PyCliffordTableau {
Expand Down Expand Up @@ -84,4 +83,4 @@ impl Synthesize for PyCliffordTableau {
synthesizer.synthesize(self.tableau.clone(), &mut tracker);
tracker.commands()
}
}
}
6 changes: 3 additions & 3 deletions tests/clifford_tableau.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ mod common;
use bitvec::bitvec;
use bitvec::prelude::Lsb0;
use common::{parse_clifford_commands, MockCircuit, MockCommand};
use syn::data_structures::{CliffordTableau, PauliString, PropagateClifford};
use syn::ir::clifford_tableau::{CallbackCliffordSynthesizer, NaiveCliffordSynthesizer};
use syn::ir::{AdjointSynthesizer, Synthesizer};
use synir::data_structures::{CliffordTableau, PauliString, PropagateClifford};
use synir::ir::clifford_tableau::{CallbackCliffordSynthesizer, NaiveCliffordSynthesizer};
use synir::ir::{AdjointSynthesizer, Synthesizer};

fn setup_sample_ct() -> CliffordTableau {
// Stab: ZZZ, -YIY, XIX
Expand Down
Loading
Loading