Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: Update ToffoliBox permutation type #64

Merged
Merged
Changes from 4 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
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(Vec<(Vec<bool>, Vec<bool>)>);
hannah-mcdougall marked this conversation as resolved.
Show resolved Hide resolved

/// 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
Loading