Enum OpBox

Source
#[non_exhaustive]
pub enum OpBox {
Show 25 variants CircBox { id: BoxID, circuit: SerialCircuit, }, Unitary1qBox { id: BoxID, matrix: [[(f64, f64); 2]; 2], }, Unitary2qBox { id: BoxID, matrix: [[(f64, f64); 4]; 4], }, Unitary3qBox { id: BoxID, matrix: Box<[[(f64, f64); 8]; 8]>, }, ExpBox { id: BoxID, matrix: [[(f64, f64); 4]; 4], phase: f64, }, PauliExpBox { id: BoxID, paulis: Vec<String>, phase: String, cx_config: String, }, PauliExpPairBox { id: BoxID, paulis_pair: Vec<Vec<String>>, phase_pair: Vec<String>, cx_config: String, }, PauliExpCommutingSetBox { id: BoxID, pauli_gadgets: Vec<(Vec<String>, String)>, cx_config: String, }, TermSequenceBox { id: BoxID, pauli_gadgets: Vec<(Vec<String>, String)>, synth_strategy: PauliSynthStrat, partition_strategy: PauliPartitionStrat, graph_colouring: GraphColourMethod, cx_config: CXConfigType, }, PhasePolyBox { id: BoxID, n_qubits: u32, qubit_indices: Vec<(Qubit, u32)>, phase_polynomial: Vec<Vec<(Bitstring, String)>>, linear_transformation: Matrix, }, StabiliserAssertionBox { id: BoxID, stabilisers: Vec<PauliStabiliser>, }, ProjectorAssertionBox { id: BoxID, matrix: Matrix, }, CustomGate { id: BoxID, gate: CustomGate, params: Vec<String>, }, QControlBox { id: BoxID, n_controls: u32, op: Box<Operation>, control_state: u32, }, ClassicalExpBox { id: BoxID, n_i: u32, n_io: u32, n_o: u32, exp: ClassicalExp, }, UnitaryTableauBox { id: BoxID, tab: UnitaryTableau, }, MultiplexorBox { id: BoxID, op_map: Vec<(Bitstring, Operation)>, }, MultiplexedRotationBox { id: BoxID, op_map: Vec<(Bitstring, Operation)>, }, MultiplexedU2Box { id: BoxID, op_map: Vec<(Bitstring, Operation)>, impl_diag: bool, }, MultiplexedTensoredU2Box { id: BoxID, op_map: Vec<(Bitstring, Operation)>, }, ToffoliBox { id: BoxID, permutation: Permutation, strat: ToffoliBoxSynthStrat, rotation_axis: Option<OpType>, }, ConjugationBox { id: BoxID, compute: Box<Operation>, action: Box<Operation>, uncompute: Option<Box<Operation>>, }, DummyBox { id: BoxID, n_qubits: u32, n_bits: u32, resource_data: ResourceData, }, StatePreparationBox { id: BoxID, statevector: Matrix, is_inverse: bool, with_initial_reset: bool, }, DiagonalBox { id: BoxID, diagonal: Matrix, upper_triangle: bool, },
}
Expand description

Box for an operation, the enum variant names come from the names of the C++ operations and are renamed if the string corresponding to the operation is differently named when serializing.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

CircBox

Operation defined as a circuit.

Fields

§circuit: SerialCircuit

The circuit defining the operation.

§

Unitary1qBox

One-qubit operation defined as a unitary matrix.

Fields

§matrix: [[(f64, f64); 2]; 2]

2x2 matrix of complex numbers

§

Unitary2qBox

Two-qubit operation defined as a unitary matrix.

Fields

§matrix: [[(f64, f64); 4]; 4]

4x4 matrix of complex numbers

§

Unitary3qBox

Three-qubit operation defined as a unitary matrix.

Fields

§matrix: Box<[[(f64, f64); 8]; 8]>

8x8 matrix of complex numbers

§

ExpBox

Two-qubit operation defined in terms of a hermitian matrix and a phase.

Fields

§matrix: [[(f64, f64); 4]; 4]

4x4 matrix of complex numbers

§phase: f64

Phase of the operation.

§

PauliExpBox

Operation defined as the exponential of a tensor of Pauli operators.

Fields

§paulis: Vec<String>

List of Pauli operators.

§phase: String

Symengine expression.

§cx_config: String

Config param for decomposition of Pauli exponentials.

§

PauliExpPairBox

A pair of (not necessarily commuting) Pauli exponentials performed in sequence.

Fields

§paulis_pair: Vec<Vec<String>>

List of List of Pauli operators.

§phase_pair: Vec<String>

List of Symengine expressions.

§cx_config: String

Config param for decomposition of Pauli exponentials.

§

PauliExpCommutingSetBox

Operation defined as a set of commuting exponentials of a tensor of Pauli operators.

Fields

§pauli_gadgets: Vec<(Vec<String>, String)>

List of Symengine expressions.

§cx_config: String

Config param for decomposition of Pauli exponentials.

§

TermSequenceBox

An unordered collection of Pauli exponentials that can be synthesised in any order, causing a change in the unitary operation. Synthesis order depends on the synthesis strategy chosen only.

Fields

§pauli_gadgets: Vec<(Vec<String>, String)>

List of Symengine expressions.

§synth_strategy: PauliSynthStrat

Synthesis strategy. See PauliSynthStrat.

§partition_strategy: PauliPartitionStrat

Partition strategy. See PauliPartitionStrat.

§graph_colouring: GraphColourMethod

Graph colouring method. See GraphColourMethod.

§cx_config: CXConfigType

Configurations for CXs upon decompose phase gadgets.

§

PhasePolyBox

An operation capable of representing arbitrary Circuits made up of CNOT and RZ, as a PhasePolynomial plus a boolean matrix representing an additional linear transformation.

Fields

§n_qubits: u32

Number of qubits.

§qubit_indices: Vec<(Qubit, u32)>

Map from qubits to inputs.

§phase_polynomial: Vec<Vec<(Bitstring, String)>>

The phase polynomial definition. Represented by a map from bitstring to expression of coefficient.

§linear_transformation: Matrix

The additional linear transformation.

§

StabiliserAssertionBox

A user-defined assertion specified by a list of Pauli stabilisers.

Fields

§stabilisers: Vec<PauliStabiliser>
§

ProjectorAssertionBox

A user-defined assertion specified by a 2x2, 4x4, or 8x8 projector matrix.

Fields

§matrix: Matrix
§

CustomGate

A user-defined gate defined by a parametrised Circuit.

Fields

§gate: CustomGate

The gate defined as a circuit.

§params: Vec<String>
§

QControlBox

Wraps another quantum op, adding control qubits.

Fields

§n_controls: u32

Number of control qubits.

§op: Box<Operation>

The operation to be controlled.

§control_state: u32

The state of the control.

§

ClassicalExpBox

Holding box for abstract expressions on Bits.

Deprecated in favour of OpType::ClExpr.

Fields

§n_i: u32
§n_io: u32
§n_o: u32
§

UnitaryTableauBox

Binary matrix form of a stabilizer tableau for unitary Clifford circuits.

Fields

§tab: UnitaryTableau

The tableau.

§

MultiplexorBox

A user-defined multiplexor specified by a map from bitstrings to Operations.

Fields

§

MultiplexedRotationBox

A user-defined multiplexed rotation gate specified by a map from bitstrings to Operations.

Fields

§

MultiplexedU2Box

A user-defined multiplexed rotation gate specified by a map from bitstrings to Operations.

Fields

§impl_diag: bool
§

MultiplexedTensoredU2Box

A user-defined multiplexed tensor product of U2 gates specified by a map from bitstrings to lists of Op or a list of bitstring-list(Op s) pairs.

Fields

§

ToffoliBox

An operation that constructs a circuit to implement the specified permutation of classical basis states.

Fields

§permutation: Permutation

The classical basis state permutation.

§rotation_axis: Option<OpType>
§

ConjugationBox

An operation composed of ‘action’, ‘compute’ and ‘uncompute’ circuits

Fields

§compute: Box<Operation>

Reversible computation.

§action: Box<Operation>

Internal operation to be applied.

§uncompute: Option<Box<Operation>>

Reverse uncomputation.

§

DummyBox

A placeholder operation that holds resource data. This box type cannot be decomposed into a circuit. It only serves to record resource data for a region of a circuit: for example, upper and lower bounds on gate counts and depth. A circuit containing such a box cannot be executed.

Fields

§n_qubits: u32

Number of qubits.

§n_bits: u32

Number of bits.

§resource_data: ResourceData

Dummy resource data.

§

StatePreparationBox

A box for preparing quantum states using multiplexed-Ry and multiplexed-Rz gates.

Fields

§statevector: Matrix

Normalised statevector of complex numbers

§is_inverse: bool

Whether to implement the dagger of the state preparation circuit, default to false.

§with_initial_reset: bool

Whether to explicitly set the state to zero initially (by default the initial zero state is assumed and no explicit reset is applied).

§

DiagonalBox

A box for synthesising a diagonal unitary matrix into a sequence of multiplexed-Rz gates.

Fields

§diagonal: Matrix

Diagonal entries.

§upper_triangle: bool

Indicates whether the multiplexed-Rz gates take the shape of an upper triangle or a lower triangle. Default to true.

Trait Implementations§

Source§

impl Clone for OpBox

Source§

fn clone(&self) -> OpBox

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OpBox

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for OpBox

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for OpBox

Source§

fn eq(&self, other: &OpBox) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for OpBox

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for OpBox

Auto Trait Implementations§

§

impl Freeze for OpBox

§

impl RefUnwindSafe for OpBox

§

impl Send for OpBox

§

impl Sync for OpBox

§

impl Unpin for OpBox

§

impl UnwindSafe for OpBox

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,