[][src]Trait q1tsim::gates::Gate

pub trait Gate {
    fn cost(&self) -> f64;
fn description(&self) -> &str;
fn nr_affected_bits(&self) -> usize;
fn matrix(&self) -> CMatrix; fn apply(&self, state: &mut CVector) { ... }
fn apply_mat(&self, state: &mut CMatrix) { ... }
fn apply_slice(&self, state: &mut CVecSliceMut) { ... }
fn apply_mat_slice(&self, state: &mut CMatSliceMut) { ... } }

Required methods

fn cost(&self) -> f64

An estimate of the cost of using this gate

fn description(&self) -> &str

Return a short description of the gate. This may be the name of the gate (e.g. "H", "CX"), or the way the gate was constructed (like "I⊗Z")

fn nr_affected_bits(&self) -> usize

The number of qubits affected by this gate.

fn matrix(&self) -> CMatrix

Return a matrix describing the unitary transformation that the gate provides

Loading content...

Provided methods

fn apply(&self, state: &mut CVector)

Apply a gate.

Apply a gate to quantum state state. The number of rows r in state must be a multiple of 2n, where n is the number of qubits this gate acts upon. The rows must be ordered, such that the first block of r/2n rows corresponds to qustates with basis states |00...0〉 for the affected qubits, the second block to |00...1〉, etc., up until |11...1〉.

fn apply_mat(&self, state: &mut CMatrix)

fn apply_slice(&self, state: &mut CVecSliceMut)

Apply a gate.

Apply a gate to quantum state state. The number of rows r in state must be a multiple of 2n, where n is the number of qubits this gate acts upon. The rows must be ordered, such that the first block of r/2n rows corresponds to qustates with basis states |00...0〉 for the affected qubits, the second block to |00...1〉, etc., up until |11...1〉.

fn apply_mat_slice(&self, state: &mut CMatSliceMut)

Loading content...

Implementors

impl Gate for CCX[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

impl Gate for CCZ[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

impl Gate for CH[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

impl Gate for CRX[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

impl Gate for CRY[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

impl Gate for CRZ[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

impl Gate for CS[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

impl Gate for CSdg[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

impl Gate for CT[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

impl Gate for CTdg[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

impl Gate for CU1[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

impl Gate for CU2[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

impl Gate for CU3[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

impl Gate for CV[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

impl Gate for CVdg[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

impl Gate for CX[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

impl Gate for CY[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

impl Gate for CZ[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

impl Gate for Composite[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_slice(&self, state: &mut CVecSliceMut)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

impl Gate for H[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

impl Gate for I[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

impl Gate for Loop[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

impl Gate for RX[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

impl Gate for RY[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

impl Gate for RZ[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

impl Gate for S[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

impl Gate for Sdg[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

impl Gate for Swap[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

impl Gate for T[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

impl Gate for Tdg[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

impl Gate for U1[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

impl Gate for U2[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_slice(&self, state: &mut CVecSliceMut)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

impl Gate for U3[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_slice(&self, state: &mut CVecSliceMut)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

impl Gate for V[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_slice(&self, state: &mut CVecSliceMut)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

impl Gate for Vdg[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_slice(&self, state: &mut CVecSliceMut)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

impl Gate for X[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

impl Gate for Y[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

impl Gate for Z[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

impl<G> Gate for C<G> where
    G: Gate
[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

impl<G0, G1> Gate for Kron<G0, G1> where
    G0: Gate,
    G1: Gate
[src]

fn apply(&self, state: &mut CVector)[src]

fn apply_mat(&self, state: &mut CMatrix)[src]

fn apply_mat_slice(&self, state: &mut CMatSliceMut)[src]

Loading content...