Clifford2Q

Struct Clifford2Q 

Source
pub struct Clifford2Q {
    pub support: [u32; 2],
    pub out_pauli: [u8; 16],
    pub phase: [Phase; 16],
}
Expand description

Two-qubit Clifford gate stored as a 16-entry conjugation table.

Index encoding: low 2 bits select the input Pauli on support[0], high 2 bits select it on support[1]. Each out_pauli[i] packs four bits (ox0 | (oz0 << 1) | (ox1 << 2) | (oz1 << 3)).

Fields§

§support: [u32; 2]

The two qubits this gate acts on. Convention: support[0] is the “first” qubit (e.g. CNOT control), support[1] the second.

§out_pauli: [u8; 16]

Output Pauli bits per input. 16 entries indexed by (x0 | (z0 << 1) | (x1 << 2) | (z1 << 3)); each entry packs the output bits in the same layout. out_pauli[0] is always 0.

§phase: [Phase; 16]

Phase factor (i^k) per input. phase[0] is always Phase::ONE.

Implementations§

Source§

impl Clifford2Q

Source

pub fn cnot(control: u32, target: u32) -> Self

CNOT with control and target. Conjugation generators: X⊗I → X⊗X, I⊗X → I⊗X, Z⊗I → Z⊗I, I⊗Z → Z⊗Z (all phase +1). The full 16-entry table follows by linearity over Pauli products.

Source

pub fn cz(q0: u32, q1: u32) -> Self

CZ on q0 and q1. Conjugation generators: X⊗I → X⊗Z, I⊗X → Z⊗X, Z⊗I → Z⊗I, I⊗Z → I⊗Z (all phase +1).

Source

pub fn swap(q0: u32, q1: u32) -> Self

SWAP on q0 and q1. Conjugation: (P ⊗ Q) → (Q ⊗ P) for all P, Q (all phase +1).

Trait Implementations§

Source§

impl<const W: usize> Channel<W> for Clifford2Q

Source§

fn max_fanout(&self) -> usize

Maximum number of output terms produced per input term. Used by the engine to size the scratch buffer up-front.
Source§

fn support(&self) -> &[u32]

Qubits this channel acts on. Outputs differ from inputs only at these bit positions; the engine uses this for bucket layout (§5).
Source§

fn apply( &self, input_x: &[u64; W], input_z: &[u64; W], coeff: Complex64, out: &mut OutputBuffer<'_, W>, )

Apply the channel to a single input term, writing outputs to out.
Source§

fn apply_adjoint( &self, input_x: &[u64; W], input_z: &[u64; W], coeff: Complex64, out: &mut OutputBuffer<'_, W>, )

Apply the channel’s adjoint to a single input term, writing outputs to out. Used by the engine in Direction::Heisenberg mode for backpropagating observables. Read more
Source§

impl Clone for Clifford2Q

Source§

fn clone(&self) -> Clifford2Q

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 Clifford2Q

Source§

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

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

impl Copy for Clifford2Q

Auto Trait Implementations§

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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.