pub trait Substitute
where Self: Sized,
{ // Required methods fn substitute_parameters( &self, calculator: &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(&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);
qubit_mapping_test.insert(2, 0);
let result = rotatez.remap_qubits(&qubit_mapping_test).unwrap();
assert_eq!(result, RotateZ::new(2, CalculatorFloat::from(0.0)));

Required Methods§

source

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>

Remaps the qubits in clone of the operation.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Substitute for ConstantGateOperation

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for Definition

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for GateOperation

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for ModeGateOperation

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for MultiQubitGateOperation

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for MultiQubitOperation

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for Operation

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaNoiseOperation

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaNoiseProbaOperation

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaOperation

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for Rotation

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for SingleModeGateOperation

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for SingleModeOperation

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for SingleQubitGateOperation

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for SingleQubitOperation

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for SpinsAnalogOperation

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for ThreeQubitGateOperation

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for ThreeQubitOperation

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for TwoModeGateOperation

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for TwoModeOperation

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for TwoQubitGateOperation

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for TwoQubitOperation

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for CZQubitResonator

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for JaynesCummings

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for LongitudinalCoupling

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for QuantumRabi

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for SingleExcitationLoad

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for SingleExcitationStore

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for BeamSplitter

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for Bogoliubov

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for CNOT

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for ComplexPMInteraction

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for ControlledControlledPauliZ

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for ControlledControlledPhaseShift

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for ControlledPauliY

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for ControlledPauliZ

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for ControlledPhaseShift

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for ControlledRotateX

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for ControlledRotateXY

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for DefinitionBit

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for DefinitionComplex

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for DefinitionFloat

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for DefinitionUsize

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for EchoCrossResonance

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for FSwap

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for Fsim

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for GPi2

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for GPi

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for GivensRotation

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for GivensRotationLittleEndian

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for Hadamard

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for ISwap

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for Identity

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for InputBit

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for InputSymbolic

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for InvSqrtISwap

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for InvSqrtPauliX

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for MeasureQubit

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for MolmerSorensenXX

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for MultiQubitMS

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for MultiQubitZZ

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PMInteraction

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PauliX

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PauliY

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PauliZ

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PhaseDisplacement

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PhaseShift

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PhaseShiftState0

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PhaseShiftState1

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PhaseShiftedControlledPhase

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PhaseShiftedControlledZ

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PhotonDetection

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaActiveReset

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaAnnotatedOp

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaBoostNoise

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaChangeDevice

Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaConditional

Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaControlledCircuit

Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaDamping

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaDephasing

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaDepolarising

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaGeneralNoise

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaGetDensityMatrix

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaGetOccupationProbability

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaGetPauliProduct

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaGetStateVector

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaGlobalPhase

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaLoop

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaOverrotation

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaRandomNoise

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaRepeatGate

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaRepeatedMeasurement

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaSetDensityMatrix

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaSetNumberOfMeasurements

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaSetStateVector

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaSleep

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaStartDecompositionBlock

Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaStopDecompositionBlock

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for PragmaStopParallelBlock

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for Qsim

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for RotateAroundSphericalAxis

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for RotateX

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for RotateXY

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for RotateY

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for RotateZ

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for SGate

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for SWAP

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for SingleQubitGate

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for SpinInteraction

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for SqrtISwap

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for SqrtPauliX

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for Squeezing

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for TGate

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for Toffoli

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for VariableMSXX

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.

source§

impl Substitute for XY

Implements Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.