Trait roqoqo::operations::Substitute
source · [−]pub trait Substitute where
Self: Sized, {
fn substitute_parameters(
&self,
calculator: &mut Calculator
) -> Result<Self, RoqoqoError>;
fn remap_qubits(
&self,
mapping: &HashMap<usize, usize>
) -> Result<Self, RoqoqoError>;
}
Expand description
Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
Example
use roqoqo::operations::{RotateZ, Substitute};
use qoqo_calculator::{Calculator, CalculatorFloat};
use std::collections::HashMap;
// 1) The substitute_parameters function substitutes all symbolic parameters in the Operation and its inputs
let rotatez = RotateZ::new(0, CalculatorFloat::from("sub"));
let mut substitution_dict: Calculator = Calculator::new();
substitution_dict.set_variable("sub", 0.0);
let result = rotatez
.substitute_parameters(&mut substitution_dict)
.unwrap();
assert_eq!(result, RotateZ::new(0, CalculatorFloat::from(0.0)));
// 2) The remap_qubits function remaps all qubits in the Operation and its inputs
let rotatez = RotateZ::new(0, CalculatorFloat::from(0.0));
let mut qubit_mapping_test: HashMap<usize, usize> = HashMap::new();
qubit_mapping_test.insert(0, 2);
let result = rotatez.remap_qubits(&qubit_mapping_test).unwrap();
assert_eq!(result, RotateZ::new(2, CalculatorFloat::from(0.0)));
Required methods
fn substitute_parameters(
&self,
calculator: &mut Calculator
) -> Result<Self, RoqoqoError>
fn substitute_parameters(
&self,
calculator: &mut Calculator
) -> Result<Self, RoqoqoError>
Substitutes symbolic parameters in clone of the operation.
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.
Implementors
impl Substitute for ConstantGateOperation
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for Definition
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for GateOperation
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for MultiQubitGateOperation
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for MultiQubitOperation
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for Operation
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaNoiseOperation
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaNoiseProbaOperation
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaOperation
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for Rotation
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for SingleQubitGateOperation
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for SingleQubitOperation
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for TwoQubitGateOperation
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for TwoQubitOperation
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for Bogoliubov
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for CNOT
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for ComplexPMInteraction
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for ControlledPauliY
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for ControlledPauliZ
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for ControlledPhaseShift
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for DefinitionBit
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for DefinitionComplex
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for DefinitionFloat
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for DefinitionUsize
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for FSwap
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for Fsim
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for GivensRotation
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for GivensRotationLittleEndian
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for Hadamard
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for ISwap
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for InputSymbolic
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for InvSqrtISwap
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for InvSqrtPauliX
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for MeasureQubit
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for MolmerSorensenXX
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for MultiQubitMS
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for MultiQubitZZ
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PMInteraction
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PauliX
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PauliY
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PauliZ
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PhaseShiftState0
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PhaseShiftState1
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PhaseShiftedControlledZ
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaActiveReset
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaBoostNoise
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaChangeDevice
Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaConditional
Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaDamping
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaDephasing
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaDepolarising
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaGeneralNoise
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaGetDensityMatrix
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaGetOccupationProbability
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaGetPauliProduct
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaGetStateVector
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaGlobalPhase
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaOverrotation
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaRandomNoise
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaRepeatGate
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaRepeatedMeasurement
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaSetDensityMatrix
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaSetNumberOfMeasurements
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaSetStateVector
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaSleep
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaStartDecompositionBlock
Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaStopDecompositionBlock
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for PragmaStopParallelBlock
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for Qsim
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for RotateAroundSphericalAxis
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for RotateX
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for RotateY
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for RotateZ
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for SGate
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for SWAP
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for SingleQubitGate
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for SpinInteraction
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for SqrtISwap
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for SqrtPauliX
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for TGate
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for VariableMSXX
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
impl Substitute for XY
Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.