From 26440e6d7e8ddcb8f7998b44d59143fbd9dd3708 Mon Sep 17 00:00:00 2001 From: hannah-mcdougall Date: Tue, 6 Aug 2024 13:47:00 +0100 Subject: [PATCH] fix: Update ToffoliBox permutation type (#64) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Co-authored-by: Agustín Borgna <121866228+aborgna-q@users.noreply.github.com> --- src/circuit_json.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/circuit_json.rs b/src/circuit_json.rs index 35b48fb..74111a4 100644 --- a/src/circuit_json.rs +++ b/src/circuit_json.rs @@ -180,9 +180,15 @@ pub struct Command

{ pub opgroup: Option, } -/// 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, Vec)>); + +/// 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)] @@ -199,7 +205,7 @@ pub struct SerialCircuit

{ /// Input bit registers. pub bits: Vec, /// Implicit permutation of the output qubits. - pub implicit_permutation: Vec, + pub implicit_permutation: Vec, } impl

Default for Operation

{