Skip to content

Commit

Permalink
Inital attempt at oxidizing unitary synthesis.
Browse files Browse the repository at this point in the history
  • Loading branch information
ElePT committed Sep 12, 2024
1 parent 2fa6dd6 commit e11ffe6
Show file tree
Hide file tree
Showing 10 changed files with 1,302 additions and 31 deletions.
4 changes: 2 additions & 2 deletions crates/accelerate/src/euler_one_qubit_decomposer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ pub fn generate_circuit(

const EULER_BASIS_SIZE: usize = 12;

static EULER_BASES: [&[&str]; EULER_BASIS_SIZE] = [
pub static EULER_BASES: [&[&str]; EULER_BASIS_SIZE] = [
&["u3"],
&["u3", "u2", "u1"],
&["u"],
Expand All @@ -593,7 +593,7 @@ static EULER_BASES: [&[&str]; EULER_BASIS_SIZE] = [
&["rz", "sx", "x"],
&["rz", "sx"],
];
static EULER_BASIS_NAMES: [EulerBasis; EULER_BASIS_SIZE] = [
pub static EULER_BASIS_NAMES: [EulerBasis; EULER_BASIS_SIZE] = [
EulerBasis::U3,
EulerBasis::U321,
EulerBasis::U,
Expand Down
1 change: 1 addition & 0 deletions crates/accelerate/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub mod synthesis;
pub mod target_transpiler;
pub mod two_qubit_decompose;
pub mod uc_gate;
pub mod unitary_synthesis;
pub mod utils;
pub mod vf2_layout;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ where
K: Eq + Hash + Clone,
V: Clone,
{
map: BaseMap<K, V>,
pub map: BaseMap<K, V>,
null_val: Option<V>,
}

Expand Down
21 changes: 12 additions & 9 deletions crates/accelerate/src/two_qubit_decompose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,11 @@ impl Specialization {
#[pyclass(module = "qiskit._accelerate.two_qubit_decompose", subclass)]
pub struct TwoQubitWeylDecomposition {
#[pyo3(get)]
a: f64,
pub a: f64,
#[pyo3(get)]
b: f64,
pub b: f64,
#[pyo3(get)]
c: f64,
pub c: f64,
#[pyo3(get)]
pub global_phase: f64,
K1l: Array2<Complex64>,
Expand Down Expand Up @@ -1146,17 +1146,18 @@ impl TwoQubitWeylDecomposition {

type TwoQubitSequenceVec = Vec<(Option<StandardGate>, SmallVec<[f64; 3]>, SmallVec<[u8; 2]>)>;

#[derive(Clone, Debug)]
#[pyclass(sequence)]
pub struct TwoQubitGateSequence {
gates: TwoQubitSequenceVec,
pub gates: TwoQubitSequenceVec,
#[pyo3(get)]
global_phase: f64,
pub global_phase: f64,
}

#[pymethods]
impl TwoQubitGateSequence {
#[new]
fn new() -> Self {
pub fn new() -> Self {
TwoQubitGateSequence {
gates: Vec::new(),
global_phase: 0.,
Expand Down Expand Up @@ -1188,10 +1189,12 @@ impl TwoQubitGateSequence {
}
}
}

#[derive(Clone, Debug)]
#[allow(non_snake_case)]
#[pyclass(module = "qiskit._accelerate.two_qubit_decompose", subclass)]
pub struct TwoQubitBasisDecomposer {
gate: String,
pub gate: String,
basis_fidelity: f64,
euler_basis: EulerBasis,
pulse_optimize: Option<bool>,
Expand Down Expand Up @@ -1575,7 +1578,7 @@ impl TwoQubitBasisDecomposer {
Ok(res)
}

fn new_inner(
pub fn new_inner(
gate: String,
gate_matrix: ArrayView2<Complex64>,
basis_fidelity: f64,
Expand Down Expand Up @@ -1713,7 +1716,7 @@ impl TwoQubitBasisDecomposer {
})
}

fn call_inner(
pub fn call_inner(
&self,
unitary: ArrayView2<Complex64>,
basis_fidelity: Option<f64>,
Expand Down
Loading

0 comments on commit e11ffe6

Please sign in to comment.