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

Substitutes symbolic parameters in clone of the operation.

Remaps the qubits in clone of the operation.

Implementors

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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