Skip to content

Commit

Permalink
fix: Update ToffoliBox permutation type (#64)
Browse files Browse the repository at this point in the history
Updated ToffoliBox permutation type to match tket schema and nexus
dataclasses. This inconsistency caused failures when getting circuits
that include a ToffoliBox from the database.

---------

Co-authored-by: Hannah McDougall <[email protected]>
Co-authored-by: Agustín Borgna <[email protected]>
  • Loading branch information
3 people authored Aug 6, 2024
1 parent 688123d commit 26440e6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/circuit_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,15 @@ pub struct Command<P = String> {
pub opgroup: Option<String>,
}

/// A permutation of the elements of a register.
/// A classic basis state permutation.
/// Used when defining Toffoli boxes.
#[derive(Deserialize, Serialize, Clone, Debug, PartialEq, Eq, Hash)]
pub struct Permutation(pub Register, pub Register);
#[serde(transparent)]
pub struct Permutation(pub Vec<(Vec<bool>, Vec<bool>)>);

/// An implicit permutation of the elements of a register.
#[derive(Deserialize, Serialize, Clone, Debug, PartialEq, Eq, Hash)]
pub struct ImplicitPermutation(pub Register, pub Register);

/// Pytket canonical serialized circuit
#[derive(Deserialize, Serialize, Clone, Debug, PartialEq)]
Expand All @@ -199,7 +205,7 @@ pub struct SerialCircuit<P = String> {
/// Input bit registers.
pub bits: Vec<Register>,
/// Implicit permutation of the output qubits.
pub implicit_permutation: Vec<Permutation>,
pub implicit_permutation: Vec<ImplicitPermutation>,
}

impl<P> Default for Operation<P> {
Expand Down

0 comments on commit 26440e6

Please sign in to comment.