Skip to content
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
54cab06
add a function append_1q_sequence
ShellyGarion May 3, 2026
c5efa44
use append_1q_sequence function
ShellyGarion May 3, 2026
8ecc1ca
reduce 1-qubit gtaes, need to debug failing tests
ShellyGarion May 5, 2026
4fefebc
update matrix calculation. still need to fix failing tests
ShellyGarion May 5, 2026
52158f8
minor fix
ShellyGarion May 5, 2026
01627ba
fix bugs, tests are passing now!
ShellyGarion May 6, 2026
cc29100
rename gates1 to weyl_gates
ShellyGarion May 6, 2026
59e5e9c
fix clippy errors
ShellyGarion May 6, 2026
f5f33b1
move H, S, SDG matrices to common
ShellyGarion May 6, 2026
e421d4d
simplify append_1q_sequence, remove invert_1q_gate
ShellyGarion May 6, 2026
527aba1
add tests for the number of gates
ShellyGarion May 6, 2026
53e4d17
add another test
ShellyGarion May 6, 2026
dd65e2e
invert matrices inplace using try_inverse_mut
ShellyGarion May 6, 2026
92165a5
add release notes
ShellyGarion May 6, 2026
0d11c70
not inverting the k matrices twice
ShellyGarion May 7, 2026
73faeab
invert the RXX equivalent gate in to_rxx_gate
ShellyGarion May 7, 2026
d195993
handle weyl_gate.global_phase
ShellyGarion May 7, 2026
77185b4
only create the euler_basis once
ShellyGarion May 7, 2026
5fd138d
to_rxx_gate returns only one 2-qubit gate, or its inverse
ShellyGarion May 7, 2026
79de181
minor update to test
ShellyGarion May 7, 2026
11166c1
the two qubit indices are only [0,1]
ShellyGarion May 7, 2026
a7e69bc
update panic error
ShellyGarion May 7, 2026
d71c5e5
modify k_mats in place
ShellyGarion May 7, 2026
3e39016
add circuit pictures
ShellyGarion May 8, 2026
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
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use numpy::{IntoPyArray, ToPyArray};
use pyo3::exceptions::PyValueError;
use pyo3::prelude::*;

use super::common::{DEFAULT_FIDELITY, IPZ, TraceToFidelity, rx_matrix, rz_matrix};
use super::common::{DEFAULT_FIDELITY, HGATE, IPZ, TraceToFidelity, rx_matrix, rz_matrix};
use super::gate_sequence::{TwoQubitGateSequence, TwoQubitSequenceVec};
use super::weyl_decomposition::{__num_basis_gates, _num_basis_gates, TwoQubitWeylDecomposition};

Expand All @@ -41,7 +41,7 @@ use qiskit_circuit::bit::ShareableQubit;
use qiskit_circuit::circuit_data::{CircuitData, PyCircuitData};
use qiskit_circuit::circuit_instruction::OperationFromPython;
use qiskit_circuit::dag_circuit::DAGCircuit;
use qiskit_circuit::gate_matrix::{CX_GATE, H_GATE, ONE_QUBIT_IDENTITY};
use qiskit_circuit::gate_matrix::{CX_GATE, ONE_QUBIT_IDENTITY};
use qiskit_circuit::instruction::{Instruction, Parameters};
use qiskit_circuit::operations::{Operation, OperationRef, Param, StandardGate};
use qiskit_circuit::packed_instruction::PackedOperation;
Expand All @@ -56,9 +56,6 @@ use qiskit_util::complex::{C_M_ONE, C_ONE, IM, M_IM, c64};
// Python space.
const TWO_QUBIT_SEQUENCE_DEFAULT_CAPACITY: usize = 21;

static HGATE: Matrix2<Complex64> =
Matrix2::new(H_GATE[0][0], H_GATE[0][1], H_GATE[1][0], H_GATE[1][1]);

static K12R: Matrix2<Complex64> = Matrix2::new(
c64(0., FRAC_1_SQRT_2),
c64(FRAC_1_SQRT_2, 0.),
Expand Down
12 changes: 12 additions & 0 deletions crates/synthesis/src/two_qubit_decompose/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use numpy::{IntoPyArray, PyArray2, PyReadonlyArray1, PyReadonlyArray2};
use pyo3::prelude::*;

use crate::linalg::ndarray_to_faer;
use qiskit_circuit::gate_matrix::{H_GATE, S_GATE, SDG_GATE};
use qiskit_util::alias::GateArray2Q;
use qiskit_util::complex::{C_M_ONE, C_ONE, C_ZERO, IM, M_IM, c64};
pub(super) const DEFAULT_FIDELITY: f64 = 1.0 - 1.0e-9;
Expand Down Expand Up @@ -231,3 +232,14 @@ pub(super) fn ndarray_to_matrix2<T: Copy>(view: ArrayView2<T>) -> Matrix2<T> {
pub(super) fn ndarray_to_matrix4(view: ArrayView2<Complex64>) -> Matrix4<Complex64> {
Matrix4::from_row_iterator(view.iter().copied())
}

pub static HGATE: Matrix2<Complex64> =
Matrix2::new(H_GATE[0][0], H_GATE[0][1], H_GATE[1][0], H_GATE[1][1]);
pub static SGATE: Matrix2<Complex64> =
Matrix2::new(S_GATE[0][0], S_GATE[0][1], S_GATE[1][0], S_GATE[1][1]);
pub static SDGGATE: Matrix2<Complex64> = Matrix2::new(
SDG_GATE[0][0],
SDG_GATE[0][1],
SDG_GATE[1][0],
SDG_GATE[1][1],
);
Loading
Loading