#[non_exhaustive]pub enum WellKnownGate {
Show 14 variants
GPhase,
I,
X,
Y,
Z,
S,
T,
R1,
Rx,
Ry,
Rz,
H,
U,
Swap,
}Expand description
Well-known quantum gates.
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.
GPhase
Global phase operation on the “vacuum” state (no qubits).
G = | exp(iθ) |Inputs:
Floatrotation in radians.
Outputs:
- No outputs
I
Identity (no-op) gate on a single qubit.
I = | 1 0 |
| 0 1 |Inputs:
Qubitto act on.
Outputs:
Qubitacted on.
X
Pauli-X gate. Also known as the NOT gate.
X = | 0 1 |
| 1 0 |Inputs:
Qubitto act on.
Outputs:
Qubitacted on.
Y
Z
S
T
R1
Rx
Rotation around the X axis.
Rx(θ) = | cos(θ/2) -isin(θ/2) |
| -isin(θ/2) cos(θ/2) |Inputs:
Outputs:
Qubitacted on.
Ry
Rotation around the Y axis.
Ry(θ) = | cos(θ/2) -sin(θ/2) |
| sin(θ/2) cos(θ/2) |Inputs:
Outputs:
Qubitacted on.
Rz
Rotation around the Z axis.
Rz(θ) = | exp(-iθ/2) 0 |
| 0 exp(iθ/2) |Inputs:
Outputs:
Qubitacted on.
H
U
Euler gate.
U(θ,φ,λ) = | cos(θ/2) -exp(iλ)sin(θ/2) |
| exp(iφ)sin(θ/2) exp(iλ)cos(θ/2) |Inputs:
Outputs:
Qubitacted on.
Swap
Implementations§
Source§impl WellKnownGate
impl WellKnownGate
Sourcepub fn num_qubits(&self) -> usize
pub fn num_qubits(&self) -> usize
Returns the number of qubits that the gate acts on.
Sourcepub fn num_params(&self) -> usize
pub fn num_params(&self) -> usize
Returns the number of floating point parameters that the gate takes as inputs.
Trait Implementations§
Source§impl Clone for WellKnownGate
impl Clone for WellKnownGate
Source§fn clone(&self) -> WellKnownGate
fn clone(&self) -> WellKnownGate
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for WellKnownGate
Source§impl Debug for WellKnownGate
impl Debug for WellKnownGate
Source§impl Default for WellKnownGate
impl Default for WellKnownGate
Source§fn default() -> WellKnownGate
fn default() -> WellKnownGate
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for WellKnownGate
impl RefUnwindSafe for WellKnownGate
impl Send for WellKnownGate
impl Sync for WellKnownGate
impl Unpin for WellKnownGate
impl UnsafeUnpin for WellKnownGate
impl UnwindSafe for WellKnownGate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more