[−][src]Trait q1tsim::gates::Gate
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
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)
Implementors
impl Gate for CCX
[src]
fn cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[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 cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[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 cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[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 cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[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 cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[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 cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[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 cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[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 cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[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 cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[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 cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[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 cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[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 cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[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 cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[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 cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[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 cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[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 cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[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 cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[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 cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[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 cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[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 cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[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 cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, _state: &mut CVecSliceMut)
[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 cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[src]
fn apply_mat_slice(&self, state: &mut CMatSliceMut)
[src]
fn apply(&self, state: &mut CVector)
[src]
fn apply_mat(&self, state: &mut CMatrix)
[src]
impl Gate for RX
[src]
fn cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[src]
fn apply_mat_slice(&self, state: &mut CMatSliceMut)
[src]
fn apply(&self, state: &mut CVector)
[src]
fn apply_mat(&self, state: &mut CMatrix)
[src]
impl Gate for RY
[src]
fn cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[src]
fn apply_mat_slice(&self, state: &mut CMatSliceMut)
[src]
fn apply(&self, state: &mut CVector)
[src]
fn apply_mat(&self, state: &mut CMatrix)
[src]
impl Gate for RZ
[src]
fn cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[src]
fn apply_mat_slice(&self, state: &mut CMatSliceMut)
[src]
fn apply(&self, state: &mut CVector)
[src]
fn apply_mat(&self, state: &mut CMatrix)
[src]
impl Gate for S
[src]
fn cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[src]
fn apply_mat_slice(&self, state: &mut CMatSliceMut)
[src]
fn apply(&self, state: &mut CVector)
[src]
fn apply_mat(&self, state: &mut CMatrix)
[src]
impl Gate for Sdg
[src]
fn cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[src]
fn apply_mat_slice(&self, state: &mut CMatSliceMut)
[src]
fn apply(&self, state: &mut CVector)
[src]
fn apply_mat(&self, state: &mut CMatrix)
[src]
impl Gate for Swap
[src]
fn cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[src]
fn apply_mat_slice(&self, state: &mut CMatSliceMut)
[src]
fn apply(&self, state: &mut CVector)
[src]
fn apply_mat(&self, state: &mut CMatrix)
[src]
impl Gate for T
[src]
fn cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[src]
fn apply_mat_slice(&self, state: &mut CMatSliceMut)
[src]
fn apply(&self, state: &mut CVector)
[src]
fn apply_mat(&self, state: &mut CMatrix)
[src]
impl Gate for Tdg
[src]
fn cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[src]
fn apply_mat_slice(&self, state: &mut CMatSliceMut)
[src]
fn apply(&self, state: &mut CVector)
[src]
fn apply_mat(&self, state: &mut CMatrix)
[src]
impl Gate for U1
[src]
fn cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[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 cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[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 cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[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 cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[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 cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[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 cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[src]
fn apply_mat_slice(&self, state: &mut CMatSliceMut)
[src]
fn apply(&self, state: &mut CVector)
[src]
fn apply_mat(&self, state: &mut CMatrix)
[src]
impl Gate for Y
[src]
fn cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[src]
fn apply_mat_slice(&self, state: &mut CMatSliceMut)
[src]
fn apply(&self, state: &mut CVector)
[src]
fn apply_mat(&self, state: &mut CMatrix)
[src]
impl Gate for Z
[src]
fn cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[src]
fn apply_mat_slice(&self, state: &mut CMatSliceMut)
[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]
G: Gate,
fn cost(&self) -> f64
[src]
fn description(&self) -> &str
[src]
fn nr_affected_bits(&self) -> usize
[src]
fn matrix(&self) -> CMatrix
[src]
fn apply_slice(&self, state: &mut CVecSliceMut)
[src]
fn apply_mat_slice(&self, state: &mut CMatSliceMut)
[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]
G0: Gate,
G1: Gate,