Struct roqoqo::operations::Toffoli
source · pub struct Toffoli {
control_0: usize,
control_1: usize,
target: usize,
}
Expand description
Implements the Toffoli gate.
The Toffoli gate applies a PauliX gate to the target
qubit
depending on the states of both control_0
and control_1
qubits.
Fields§
§control_0: usize
The index of the most significant qubit in the unitary representation. Here, the first controlling qubit of the operation.
control_1: usize
The index of the second most significant qubit in the unitary representation. Here, the second controlling qubit of the operation.
target: usize
The index of the least significant qubit in the unitary representation. Here, the qubit the phase-shift is applied to.
Implementations§
Trait Implementations§
source§impl<'de> Deserialize<'de> for Toffoli
impl<'de> Deserialize<'de> for Toffoli
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl InvolveQubits for Toffoli
impl InvolveQubits for Toffoli
Implements InvolveQubits trait for the qubits involved in this Operation.
source§fn involved_qubits(&self) -> InvolvedQubits
fn involved_qubits(&self) -> InvolvedQubits
Returns a list of all involed qubits.
source§fn involved_classical(&self) -> InvolvedClassical
fn involved_classical(&self) -> InvolvedClassical
source§impl OperateGate for Toffoli
impl OperateGate for Toffoli
Trait for all Operations acting with a unitary gate on a set of qubits.
source§fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError>
fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError>
Returns unitary matrix of the gate.
§Returns
Ok(Array2<Complex64>)
- The unitary matrix representation of the gate.Err(RoqoqoError)
- The conversion of parameters to f64 failed (here, not possible).
source§impl OperateThreeQubit for Toffoli
impl OperateThreeQubit for Toffoli
Trait for Operations acting on exactly three qubits.
source§impl OperateThreeQubitGate for Toffoli
impl OperateThreeQubitGate for Toffoli
Trait for all gate operations acting on exactly three qubits.
source§impl PartialEq for Toffoli
impl PartialEq for Toffoli
source§impl Substitute for Toffoli
impl Substitute for Toffoli
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
source§fn substitute_parameters(
&self,
calculator: &Calculator
) -> Result<Self, RoqoqoError>
fn substitute_parameters( &self, calculator: &Calculator ) -> Result<Self, RoqoqoError>
Substitutes symbolic parameters in clone of the operation.
source§fn remap_qubits(
&self,
mapping: &HashMap<usize, usize>
) -> Result<Self, RoqoqoError>
fn remap_qubits( &self, mapping: &HashMap<usize, usize> ) -> Result<Self, RoqoqoError>
Remaps the qubits in clone of the operation.
source§impl SupportedVersion for Toffoli
impl SupportedVersion for Toffoli
source§impl TryFrom<GateOperation> for Toffoli
impl TryFrom<GateOperation> for Toffoli
Implements the core::convert::TryFrom trait into this Operation.
source§impl TryFrom<Operation> for Toffoli
impl TryFrom<Operation> for Toffoli
Implements the core::convert::TryFrom trait into this Operation.
source§impl TryFrom<ThreeQubitGateOperation> for Toffoli
impl TryFrom<ThreeQubitGateOperation> for Toffoli
Implements the core::convert::TryFrom trait into this Operation.
source§impl TryFrom<ThreeQubitOperation> for Toffoli
impl TryFrom<ThreeQubitOperation> for Toffoli
Implements the core::convert::TryFrom trait into this Operation.
impl ImplementedIn1point3 for Toffoli
impl StructuralPartialEq for Toffoli
Auto Trait Implementations§
impl Freeze for Toffoli
impl RefUnwindSafe for Toffoli
impl Send for Toffoli
impl Sync for Toffoli
impl Unpin for Toffoli
impl UnwindSafe for Toffoli
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
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.