Enum OpType

Source
#[non_exhaustive]
pub enum OpType {
Show 122 variants Input, Output, Create, Discard, ClInput, ClOutput, Barrier, Label, Branch, Goto, Stop, ClassicalTransform, WASM, SetBits, CopyBits, RangePredicate, ExplicitPredicate, ExplicitModifier, MultiBit, Phase, Z, X, Y, S, Sdg, T, Tdg, V, Vdg, SX, SXdg, H, Rx, Ry, Rz, U3, U2, U1, TK1, TK2, CX, CY, CZ, CH, CV, CVdg, CSX, CSXdg, CS, CSdg, CRz, CRx, CRy, CU1, CU3, PhaseGadget, CCX, SWAP, CSWAP, BRIDGE, noop, Measure, Collapse, Reset, ECR, ISWAP, PhasedX, NPhasedX, ZZMax, XXPhase, YYPhase, ZZPhase, XXPhase3, ESWAP, FSim, Sycamore, ISWAPMax, PhasedISWAP, CnRx, CnRy, CnRz, CnX, CnY, CnZ, GPI, GPI2, AAMS, CircBox, Unitary1qBox, Unitary2qBox, Unitary3qBox, ExpBox, PauliExpBox, PauliExpPairBox, PauliExpCommutingSetBox, TermSequenceBox, CliffBox, PhasePolyBox, Conditional, StabiliserAssertionBox, ProjectorAssertionBox, CustomGate, QControlBox, UnitaryTableauBox, ClassicalExpBox, MultiplexorBox, MultiplexedRotationBox, MultiplexedU2Box, MultiplexedTensoredU2Box, ToffoliBox, ConjugationBox, DummyBox, StatePreparationBox, DiagonalBox, ClExpr, RNGInput, RNGOutput, RNGSeed, RNGBound, RNGIndex, RNGNum, JobShotNum,
}
Expand description

Operation types in a quantum circuit.

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.
§

Input

Quantum input node of the circuit

§

Output

Quantum output node of the circuit

§

Create

Quantum node with no predecessors, implicitly in zero state.

§

Discard

Quantum node with no successors, not composable with input nodes of other circuits.

§

ClInput

Classical input node of the circuit

§

ClOutput

Classical output node of the circuit

§

Barrier

No-op that must be preserved by compilation

§

Label

FlowOp introducing a target for Branch or Goto commands

§

Branch

Execution jumps to a label if a condition bit is true (1), otherwise continues to next command

§

Goto

Execution jumps to a label unconditionally

§

Stop

Execution halts and the program terminates

§

ClassicalTransform

A general classical operation where all inputs are also outputs

§

WASM

Op containing a classical wasm function call.

§

SetBits

An operation to set some bits to specified values

§

CopyBits

An operation to copy some bit values

§

RangePredicate

A classical predicate defined by a range of values in binary encoding

§

ExplicitPredicate

A classical predicate defined by a truth table

§

ExplicitModifier

An operation defined by a truth table that modifies one bit

§

MultiBit

A classical operation applied to multiple bits simultaneously

§

Phase

Global phase $\alpha \mapsto [\e^{i\pi\alpha}]$

§

Z

\f$ \left[ \begin{array}{cc} 1 & 0 \ 0 & -1 \end{array} \right] \f$

§

X

\f$ \left[ \begin{array}{cc} 0 & 1 \ 1 & 0 \end{array} \right] \f$

§

Y

\f$ \left[ \begin{array}{cc} 0 & -i \ i & 0 \end{array} \right] \f$

§

S

\f$ \left[ \begin{array}{cc} 1 & 0 \ 0 & i \end{array} \right] = \mathrm{U1}(\frac12) \f$

§

Sdg

\f$ \left[ \begin{array}{cc} 1 & 0 \ 0 & -i \end{array} \right] = \mathrm{U1}(-\frac12) \f$

§

T

\f$ \left[ \begin{array}{cc} 1 & 0 \ 0 & e^{i\pi/4} \end{array} \right] = \mathrm{U1}(\frac14) \f$

§

Tdg

\f$ \left[ \begin{array}{cc} 1 & 0 \ 0 & e^{-i\pi/4} \end{array} \right] \equiv \mathrm{U1}(-\frac14) \f$

§

V

\f$ \frac{1}{\sqrt 2} \left[ \begin{array}{cc} 1 & -i \ -i & 1 \end{array} \right] = \mathrm{Rx}(\frac12) \f$

§

Vdg

\f$ \frac{1}{\sqrt 2} \left[ \begin{array}{cc} 1 & i \ i & 1 \end{array} \right] = \mathrm{Rx}(-\frac12) \f$

§

SX

\f$ \frac{1}{2} \left[ \begin{array}{cc} 1+i & 1-i \ 1-i & 1+i \end{array} \right] = e^{\frac{i\pi}{4}}\mathrm{Rx}(\frac12) \f$

§

SXdg

\f$ \frac{1}{2} \left[ \begin{array}{cc} 1-i & 1+i \ 1+i & 1-i \end{array} \right] = e^{\frac{-i\pi}{4}}\mathrm{Rx}(-\frac12) \f$

§

H

\f$ \frac{1}{\sqrt 2} \left[ \begin{array}{cc} 1 & 1 \ 1 & -1 \end{array} \right] \f$

§

Rx

\f$ \mathrm{Rx}(\alpha) = e^{-\frac12 i \pi \alpha X} = \left[ \begin{array}{cc} \cos\frac{\pi\alpha}{2} & -i\sin\frac{\pi\alpha}{2} \ -i\sin\frac{\pi\alpha}{2} & \cos\frac{\pi\alpha}{2} \end{array} \right] \f$

§

Ry

\f$ \mathrm{Ry}(\alpha) = e^{-\frac12 i \pi \alpha Y} = \left[ \begin{array}{cc} \cos\frac{\pi\alpha}{2} & -\sin\frac{\pi\alpha}{2} \ \sin\frac{\pi\alpha}{2} & \cos\frac{\pi\alpha}{2} \end{array} \right] \f$

§

Rz

\f$ \mathrm{Rz}(\alpha) = e^{-\frac12 i \pi \alpha Z} = \left[ \begin{array}{cc} e^{-\frac12 i \pi\alpha} & 0 \ 0 & e^{\frac12 i \pi\alpha} \end{array} \right] \f$

§

U3

\f$ \mathrm{U3}(\theta, \phi, \lambda) = \left[ \begin{array}{cc} \cos\frac{\pi\theta}{2} & -e^{i\pi\lambda} \sin\frac{\pi\theta}{2} \ e^{i\pi\phi} \sin\frac{\pi\theta}{2} & e^{i\pi(\lambda+\phi)} \cos\frac{\pi\theta}{2} \end{array} \right] = e^{\frac12 i\pi(\lambda+\phi)} \mathrm{Rz}(\phi) \mathrm{Ry}(\theta) \mathrm{Rz}(\lambda) \f$

§

U2

\f$ \mathrm{U2}(\phi, \lambda) = \mathrm{U3}(\frac12, \phi, \lambda) = e^{\frac12 i\pi(\lambda+\phi)} \mathrm{Rz}(\phi) \mathrm{Ry}(\frac12) \mathrm{Rz}(\lambda) \f$

§

U1

\f$ \mathrm{U1}(\lambda) = \mathrm{U3}(0, 0, \lambda) = e^{\frac12 i\pi\lambda} \mathrm{Rz}(\lambda) \f$

§

TK1

\f$ \mathrm{TK1}(\alpha, \beta, \gamma) = \mathrm{Rz}(\alpha) \mathrm{Rx}(\beta) \mathrm{Rz}(\gamma) \f$

§

TK2

\f$ \mathrm{TK2}(\alpha, \beta, \gamma) = \mathrm{XXPhase}(\alpha) \mathrm{YYPhase}(\beta) \mathrm{ZZPhase}(\gamma) \f$

§

CX

Controlled OpType::X.

§

CY

Controlled OpType::Y

§

CZ

Controlled OpType::Z

§

CH

Controlled OpType::H

§

CV

Controlled OpType::V

\f$ \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \ 0 & 1 & 0 & 0 \ 0 & 0 & \frac{1}{\sqrt 2} & -i \frac{1}{\sqrt 2} \ 0 & 0 & -i \frac{1}{\sqrt 2} & \frac{1}{\sqrt 2} \end{array} \right] \f$

§

CVdg

Controlled OpType::Vdg

\f$ \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \ 0 & 1 & 0 & 0 \ 0 & 0 & \frac{1}{\sqrt 2} & i \frac{1}{\sqrt 2} \ 0 & 0 & i \frac{1}{\sqrt 2} & \frac{1}{\sqrt 2} \end{array} \right] \f$

§

CSX

Controlled OpType::SX

\f$ \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \ 0 & 1 & 0 & 0 \ 0 & 0 & \frac{1+i}{2} & \frac{1-i}{2} \ 0 & 0 & \frac{1-i}{2} & \frac{1+i}{2} \end{array} \right] \f$

§

CSXdg

Controlled OpType::SXdg

\f$ \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \ 0 & 1 & 0 & 0 \ 0 & 0 & \frac{1-i}{2} & \frac{1+i}{2} \ 0 & 0 & \frac{1+i}{2} & \frac{1-i}{2} \end{array} \right] \f$

§

CS

Controlled OpType::S gate

§

CSdg

Controlled OpType::Sdg gate

§

CRz

Controlled OpType::Rz

\f$ \mathrm{CRz}(\alpha) = \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \ 0 & 1 & 0 & 0 \ 0 & 0 & e^{-\frac12 i \pi\alpha} & 0 \ 0 & 0 & 0 & e^{\frac12 i \pi\alpha} \end{array} \right] \f$

The phase parameter \f$ \alpha \f$ is defined modulo \f$ 4 \f$.

§

CRx

Controlled OpType::Rx

\f$ \mathrm{CRx}(\alpha) = \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \ 0 & 1 & 0 & 0 \ 0 & 0 & \cos \frac{\pi \alpha}{2} & -i \sin \frac{\pi \alpha}{2} \ 0 & 0 & -i \sin \frac{\pi \alpha}{2} & \cos \frac{\pi \alpha}{2} \end{array} \right] \f$

The phase parameter \f$ \alpha \f$ is defined modulo \f$ 4 \f$.

§

CRy

Controlled OpType::Ry

\f$ \mathrm{CRy}(\alpha) = \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \ 0 & 1 & 0 & 0 \ 0 & 0 & \cos \frac{\pi \alpha}{2} & -\sin \frac{\pi \alpha}{2} \ 0 & 0 & \sin \frac{\pi \alpha}{2} & \cos \frac{\pi \alpha}{2} \end{array} \right] \f$

The phase parameter \f$ \alpha \f$ is defined modulo \f$ 4 \f$.

§

CU1

Controlled OpType::U1

\f$ \mathrm{CU1}(\alpha) = \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \ 0 & 1 & 0 & 0 \ 0 & 0 & 1 & 0 \ 0 & 0 & 0 & e^{i\pi\alpha} \end{array} \right] \f$

§

CU3

Controlled OpType::U3

§

PhaseGadget

\f$ \alpha \mapsto e^{-\frac12 i \pi\alpha Z^{\otimes n}} \f$

§

CCX

Controlled OpType::CX

§

SWAP

Swap two qubits

§

CSWAP

Controlled OpType::SWAP

§

BRIDGE

Three-qubit gate that swaps the first and third qubits

§

noop

Identity

§

Measure

Measure a qubit, producing a classical output

§

Collapse

Measure a qubit producing no output

§

Reset

Reset a qubit to the zero state

§

ECR

\f$ \frac{1}{\sqrt 2} \left[ \begin{array}{cccc} 0 & 0 & 1 & i \ 0 & 0 & i & 1 \ 1 & -i & 0 & 0 \ -i & 1 & 0 & 0 \end{array} \right] \f$

§

ISWAP

\f$ \alpha \mapsto e^{\frac14 i \pi\alpha (X \otimes X + Y \otimes Y)} = \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \ 0 & \cos\frac{\pi\alpha}{2} & i\sin\frac{\pi\alpha}{2} & 0 \ 0 & i\sin\frac{\pi\alpha}{2} & \cos\frac{\pi\alpha}{2} & 0 \ 0 & 0 & 0 & 1 \end{array} \right] \f$

Also known as an XY gate.

§

PhasedX

\f$ (\alpha, \beta) \mapsto \mathrm{Rz}(\beta) \mathrm{Rx}(\alpha) \mathrm{Rz}(-\beta) \f$

§

NPhasedX

PhasedX gates on multiple qubits

§

ZZMax

\f$ \mathrm{ZZPhase}(\frac12) \f$

§

XXPhase

\f$ \alpha \mapsto e^{-\frac12 i \pi\alpha (X \otimes X)} = \left[ \begin{array}{cccc} \cos\frac{\pi\alpha}{2} & 0 & 0 & -i\sin\frac{\pi\alpha}{2} \ 0 & \cos\frac{\pi\alpha}{2} & -i\sin\frac{\pi\alpha}{2} & 0 \ 0 & -i\sin\frac{\pi\alpha}{2} & \cos\frac{\pi\alpha}{2} & 0 \ -i\sin\frac{\pi\alpha}{2} & 0 & 0 & \cos\frac{\pi\alpha}{2} \end{array} \right] \f$

§

YYPhase

\f$ \alpha \mapsto e^{-\frac12 i \pi\alpha (Y \otimes Y)} = \left[ \begin{array}{cccc} \cos\frac{\pi\alpha}{2} & 0 & 0 & i\sin\frac{\pi\alpha}{2} \ 0 & \cos\frac{\pi\alpha}{2} & -i\sin\frac{\pi\alpha}{2} & 0 \ 0 & -i\sin\frac{\pi\alpha}{2} & \cos\frac{\pi\alpha}{2} & 0 \ i\sin\frac{\pi\alpha}{2} & 0 & 0 & \cos\frac{\pi\alpha}{2} \end{array} \right] \f$

§

ZZPhase

\f$ \alpha \mapsto e^{-\frac12 i \pi\alpha (Z \otimes Z)} = \left[ \begin{array}{cccc} e^{-\frac12 i \pi\alpha} & 0 & 0 & 0 \ 0 & e^{\frac12 i \pi\alpha} & 0 & 0 \ 0 & 0 & e^{\frac12 i \pi\alpha} & 0 \ 0 & 0 & 0 & e^{-\frac12 i \pi\alpha} \end{array} \right] \f$

§

XXPhase3

Three-qubit phase MSGate

§

ESWAP

\f$ \alpha \mapsto e^{-\frac12 i\pi\alpha \cdot \mathrm{SWAP}} = \left[ \begin{array}{cccc} e^{-\frac12 i \pi\alpha} & 0 & 0 & 0 \ 0 & \cos\frac{\pi\alpha}{2} & -i\sin\frac{\pi\alpha}{2} & 0 \ 0 & -i\sin\frac{\pi\alpha}{2} & \cos\frac{\pi\alpha}{2} & 0 \ 0 & 0 & 0 & e^{-\frac12 i \pi\alpha} \end{array} \right] \f$

§

FSim

\f$ (\alpha, \beta) \mapsto \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \ 0 & \cos \pi\alpha & -i\sin \pi\alpha & 0 \ 0 & -i\sin \pi\alpha & \cos \pi\alpha & 0 \ 0 & 0 & 0 & e^{-i\pi\beta} \end{array} \right] \f$

§

Sycamore

Fixed instance of a OpType::FSim gate with parameters \f$ (\frac12, \frac16) \f$: \f$ \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \ 0 & 0 & -i & 0 \ 0 & -i & 0 & 0 \ 0 & 0 & 0 & e^{-i\pi/6} \end{array} \right] \f$

§

ISWAPMax

Fixed instance of a OpType::ISWAP gate with parameter \f$ 1.0 \f$: \f$ \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \ 0 & 0 & i & 0 \ 0 & i & 0 & 0 \ 0 & 0 & 0 & 1 \end{array} \right] \f$

§

PhasedISWAP

ISwap gate with extra Rzs on each qubit

§

CnRx

N-controlled OpType::Rx

§

CnRy

N-controlled OpType::Ry

§

CnRz

N-controlled OpType::Rz

§

CnX

Multiply-controlled OpType::X

§

CnY

Multiply-controlled OpType::Y

§

CnZ

Multiply-controlled OpType::Z

§

GPI

GPi gate

\f$ (\phi) \mapsto \left[ \begin{array}{cc} 0 & e^{-i\pi\phi} \\ e^{i\pi\phi} & 0 \end{array} \right] \f$

§

GPI2

GPi2 gate

\f$ (\phi) \mapsto \frac{1}{\sqrt 2} \left[ \begin{array}{cc} 1 & -ie^{-i\pi\phi} \\ -ie^{i\pi\phi} & 1 \end{array} \right] \f$

§

AAMS

AAMS gate

\f$

(\theta, \phi_0, \phi_1) \mapsto \left[ “ \begin{array}{cccc} \cos\frac{\pi\theta}{2} & 0 & 0 & -ie^{-i\pi(\phi_0+\phi_1)}\sin\frac{\pi\theta}{2} \\ 0 & \cos\frac{\pi\theta}{2} & -ie^{i\pi(\phi_1-\phi_0)}\sin\frac{\pi\theta}{2} & 0 \\ 0 & -ie^{i\pi(\phi_0-\phi_1)}\sin\frac{\pi\theta}{2} & \cos\frac{\pi\theta}{2} & 0 \\ -ie^{i\pi(\phi_0+\phi_1)}\sin\frac{\pi\theta}{2} & 0 & 0 & \cos\frac{\pi\theta}{2} \end{array} \right]` \f$

§

CircBox

See CircBox

§

Unitary1qBox

§

Unitary2qBox

§

Unitary3qBox

§

ExpBox

See ExpBox

§

PauliExpBox

§

PauliExpPairBox

§

PauliExpCommutingSetBox

§

TermSequenceBox

§

CliffBox

NYI

§

PhasePolyBox

§

Conditional

NYI

§

StabiliserAssertionBox

§

ProjectorAssertionBox

§

CustomGate

§

QControlBox

§

UnitaryTableauBox

§

ClassicalExpBox

See ClassicalExpBox

Deprecated. Use OpType::ClExpr instead.

§

MultiplexorBox

§

MultiplexedRotationBox

§

MultiplexedU2Box

§

MultiplexedTensoredU2Box

§

ToffoliBox

§

ConjugationBox

§

DummyBox

§

StatePreparationBox

§

DiagonalBox

§

ClExpr

Classical expression.

An operation of this type is accompanied by a ClExpr object.

This is a replacement of the deprecated OpType::ClassicalExpBox.

§

RNGInput

RNG input node of the circuit

§

RNGOutput

RNG output node of the circuit

§

RNGSeed

Seed an RNG using 64 bits

§

RNGBound

Set an (inclusive) 32-bit upper bound on RNG output

§

RNGIndex

Set a 32-bit index on an RNG

§

RNGNum

Get 32-bit output from an RNG

§

JobShotNum

Get 32-bit (little-endian) shot number

Trait Implementations§

Source§

impl Clone for OpType

Source§

fn clone(&self) -> OpType

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 OpType

Source§

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

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

impl Default for OpType

Source§

fn default() -> OpType

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for OpType

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 Display for OpType

Source§

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

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

impl FromStr for OpType

Source§

type Err = ParseError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<OpType, <Self as FromStr>::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for OpType

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for OpType

Source§

fn eq(&self, other: &OpType) -> 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 OpType

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 TryFrom<&str> for OpType

Source§

type Error = ParseError

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

fn try_from(s: &str) -> Result<OpType, <Self as TryFrom<&str>>::Error>

Performs the conversion.
Source§

impl Copy for OpType

Source§

impl Eq for OpType

Source§

impl StructuralPartialEq for OpType

Auto Trait Implementations§

§

impl Freeze for OpType

§

impl RefUnwindSafe for OpType

§

impl Send for OpType

§

impl Sync for OpType

§

impl Unpin for OpType

§

impl UnwindSafe for OpType

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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>,