Trait roqoqo::operations::InvolveQubits
source · [−]pub trait InvolveQubits {
fn involved_qubits(&self) -> InvolvedQubits;
}
Expand description
Trait for the qubits involved in each Operation.
Example
use roqoqo::operations::{CNOT, DefinitionFloat, InvolveQubits, InvolvedQubits, PragmaRepeatedMeasurement};
use std::collections::{HashMap, HashSet};
// The involved qubits of the operation tell us which qubits are affected by the Operation.
// There are three possibilities:
// 1) The involved qubits are a set of integers (usize): these are the qubits affected by the Operation
let cnot = CNOT::new(0, 1);
let mut qubits: HashSet<usize> = HashSet::new();
qubits.insert(0);
qubits.insert(1);
assert_eq!(cnot.involved_qubits(), InvolvedQubits::Set(qubits));
// 2) The involved qubits are None: there are no qubits affected by this Operation
let def_float = DefinitionFloat::new("ro".to_string(), 1, true);
assert_eq!(def_float.involved_qubits(), InvolvedQubits::None);
// 3) The involved qubits are All: all of the qubits in the Circuit are affected by the Operation
let mut qubit_mapping: HashMap<usize, usize> = HashMap::new();
qubit_mapping.insert(0, 1);
let pragma = PragmaRepeatedMeasurement::new("ro".to_string(), 2, Some(qubit_mapping.clone()));
assert_eq!(pragma.involved_qubits(), InvolvedQubits::All);
Required methods
fn involved_qubits(&self) -> InvolvedQubits
fn involved_qubits(&self) -> InvolvedQubits
Returns a list of all involved qubits.
Implementors
impl InvolveQubits for ConstantGateOperation
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for Definition
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for GateOperation
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for MultiQubitGateOperation
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for MultiQubitOperation
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for Operation
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for PragmaNoiseOperation
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for PragmaNoiseProbaOperation
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for PragmaOperation
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for Rotation
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for SingleQubitGateOperation
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for SingleQubitOperation
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for TwoQubitGateOperation
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for TwoQubitOperation
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for Bogoliubov
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for CNOT
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for ComplexPMInteraction
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for ControlledPauliY
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for ControlledPauliZ
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for ControlledPhaseShift
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for DefinitionBit
impl InvolveQubits for DefinitionComplex
impl InvolveQubits for DefinitionFloat
impl InvolveQubits for DefinitionUsize
impl InvolveQubits for FSwap
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for Fsim
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for GivensRotation
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for GivensRotationLittleEndian
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for Hadamard
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for ISwap
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for InputSymbolic
impl InvolveQubits for InvSqrtISwap
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for InvSqrtPauliX
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for MeasureQubit
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for MolmerSorensenXX
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for MultiQubitMS
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for MultiQubitZZ
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for PMInteraction
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for PauliX
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for PauliY
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for PauliZ
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for PhaseShiftState0
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for PhaseShiftState1
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for PhaseShiftedControlledZ
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for PragmaActiveReset
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for PragmaBoostNoise
impl InvolveQubits for PragmaChangeDevice
impl InvolveQubits for PragmaConditional
impl InvolveQubits for PragmaDamping
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for PragmaDephasing
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for PragmaDepolarising
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for PragmaGeneralNoise
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for PragmaGetDensityMatrix
impl InvolveQubits for PragmaGetOccupationProbability
impl InvolveQubits for PragmaGetPauliProduct
impl InvolveQubits for PragmaGetStateVector
impl InvolveQubits for PragmaGlobalPhase
impl InvolveQubits for PragmaOverrotation
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for PragmaRandomNoise
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for PragmaRepeatGate
impl InvolveQubits for PragmaRepeatedMeasurement
impl InvolveQubits for PragmaSetDensityMatrix
impl InvolveQubits for PragmaSetNumberOfMeasurements
impl InvolveQubits for PragmaSetStateVector
impl InvolveQubits for PragmaSleep
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for PragmaStartDecompositionBlock
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for PragmaStopDecompositionBlock
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for PragmaStopParallelBlock
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for Qsim
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for RotateAroundSphericalAxis
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for RotateX
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for RotateY
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for RotateZ
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for SGate
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for SWAP
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for SingleQubitGate
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for SpinInteraction
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for SqrtISwap
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for SqrtPauliX
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for TGate
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for VariableMSXX
Implements InvolveQubits trait for the qubits involved in this Operation.
impl InvolveQubits for XY
Implements InvolveQubits trait for the qubits involved in this Operation.