Struct roqoqo::noise_models::DecoherenceOnGateModel

source ·
pub struct DecoherenceOnGateModel {
    single_qubit_gate_errors: HashMap<(String, usize), PlusMinusLindbladNoiseOperator>,
    two_qubit_gate_errors: HashMap<(String, (usize, usize)), PlusMinusLindbladNoiseOperator>,
    three_qubit_gate_errors: HashMap<(String, (usize, usize, usize)), PlusMinusLindbladNoiseOperator>,
    multi_qubit_gate_errors: HashMap<(String, Vec<usize>), PlusMinusLindbladNoiseOperator>,
}
Expand description

Error model for noise that is only present on gate executions.

Adds additional noise when specific gates (identified by hqslang name and qubits acted on) are executed. The noise is given in the form of a struqture::spins::PlusMinusLindbladNoiseOperator the same way it is for the ContinuousDecoherence model. Example:

use roqoqo::noise_models::DecoherenceOnGateModel;
use struqture::spins::{PlusMinusLindbladNoiseOperator, PlusMinusProduct};
use struqture::prelude::*;

let mut noise_model = DecoherenceOnGateModel::new();
let mut lindblad_noise = PlusMinusLindbladNoiseOperator::new();
lindblad_noise.add_operator_product(
   (PlusMinusProduct::new().z(0), PlusMinusProduct::new().z(0)),
   0.9.into(),).unwrap();
lindblad_noise.add_operator_product(
   (PlusMinusProduct::new().z(1), PlusMinusProduct::new().z(1)),
   0.9.into(),).unwrap();

noise_model = noise_model.set_two_qubit_gate_error(
"CNOT", 0,1,
lindblad_noise
);

Fields§

§single_qubit_gate_errors: HashMap<(String, usize), PlusMinusLindbladNoiseOperator>

Extra noise for single qubit gates.

§two_qubit_gate_errors: HashMap<(String, (usize, usize)), PlusMinusLindbladNoiseOperator>

Extra noise for two qubit gates.

§three_qubit_gate_errors: HashMap<(String, (usize, usize, usize)), PlusMinusLindbladNoiseOperator>

Extra noise for three qubit gates.

§multi_qubit_gate_errors: HashMap<(String, Vec<usize>), PlusMinusLindbladNoiseOperator>

Extra noise for multi qubit gates.

Implementations§

source§

impl DecoherenceOnGateModel

source

pub fn new() -> Self

Creates a new DecoherenceOnGateModel with default values.

source

pub fn set_single_qubit_gate_error( self, gate: &str, qubit: usize, noise_operator: PlusMinusLindbladNoiseOperator, ) -> Self

Sets extra noise for a single qubit gate.

§Arguments
  • gate - The name of the gate.
  • qubit - The qubit the gate acts on.
  • noise_operator - The noise affecting system when gate is applied.
§Returns

Self - The error model with the new noise on gate set.

source

pub fn get_single_qubit_gate_error( &self, gate: &str, qubit: usize, ) -> Option<&PlusMinusLindbladNoiseOperator>

Returns the extra noise for a single qubit gate, if it exists.

§Arguments
  • gate - The name of the gate.
  • qubit - The qubit the gate acts on.
§Returns

Option<struqture::spins::PlusMinusLindbladNoiseOperator> - The error model applied when gate is applied.

source

pub fn set_two_qubit_gate_error( self, gate: &str, control: usize, target: usize, noise_operator: PlusMinusLindbladNoiseOperator, ) -> Self

Sets extra noise for a two qubit gate.

§Arguments
  • gate - The name of the gate.
  • control - Controlling qubit.
  • target - Target qubit.
  • noise_operator - The noise affecting system when gate is applied.
§Returns

Option<struqture::spins::PlusMinusLindbladNoiseOperator> - The error model applied when gate is applied.

source

pub fn get_two_qubit_gate_error( &self, gate: &str, control: usize, target: usize, ) -> Option<&PlusMinusLindbladNoiseOperator>

Returns the extra noise for a two qubit gate, if it exists.

§Arguments
  • gate - The name of the gate.
  • control - Controlling qubit.
  • target - Target qubit.
§Returns

Option<struqture::spins::PlusMinusLindbladNoiseOperator> - The error model applied when gate is applied.

source

pub fn set_three_qubit_gate_error( self, gate: &str, control0: usize, control1: usize, target: usize, noise_operator: PlusMinusLindbladNoiseOperator, ) -> Self

Sets extra noise for a three qubit gate.

§Arguments
  • gate - The name of the gate.
  • control0 - First controlling qubit.
  • control1 - Second controlling qubit.
  • target - Target qubit.
  • noise_operator - The noise affecting system when gate is applied.
§Returns

Option<struqture::spins::PlusMinusLindbladNoiseOperator> - The error model applied when gate is applied.

source

pub fn get_three_qubit_gate_error( &self, gate: &str, control0: usize, control1: usize, target: usize, ) -> Option<&PlusMinusLindbladNoiseOperator>

Returns the extra noise for a two qubit gate, if it exists.

§Arguments
  • gate - The name of the gate.
  • control0 - First controlling qubit.
  • control1 - Second controlling qubit.
  • target - Target qubit.
§Returns

Option<struqture::spins::PlusMinusLindbladNoiseOperator> - The error model applied when gate is applied.

source

pub fn set_multi_qubit_gate_error( self, gate: &str, qubits: Vec<usize>, noise_operator: PlusMinusLindbladNoiseOperator, ) -> Self

Sets extra noise for a multi qubit gate.

§Arguments
  • gate - The name of the gate.
  • qubits - A vector of qubit indices.
  • noise_operator - The noise affecting system when gate is applied.
§Returns

Self - The error model with the new noise on gate set.

source

pub fn get_multi_qubit_gate_error( &self, gate: &str, qubits: Vec<usize>, ) -> Option<&PlusMinusLindbladNoiseOperator>

Returns the extra noise for a multi qubit gate, if it exists.

§Arguments
  • gate - The name of the gate.
  • qubits - A vector of qubit indices.
§Returns

Option<struqture::spins::PlusMinusLindbladNoiseOperator> - The error model applied when gate is applied.

Trait Implementations§

source§

impl Clone for DecoherenceOnGateModel

source§

fn clone(&self) -> DecoherenceOnGateModel

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for DecoherenceOnGateModel

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for DecoherenceOnGateModel

source§

fn default() -> DecoherenceOnGateModel

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for DecoherenceOnGateModel

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<DecoherenceOnGateModel> for DecoherenceOnGateModelSerialize

source§

fn from(value: DecoherenceOnGateModel) -> Self

Converts to this type from the input type.
source§

impl From<DecoherenceOnGateModel> for NoiseModel

source§

fn from(value: DecoherenceOnGateModel) -> Self

Converts to this type from the input type.
source§

impl From<DecoherenceOnGateModelSerialize> for DecoherenceOnGateModel

source§

fn from(value: DecoherenceOnGateModelSerialize) -> Self

Converts to this type from the input type.
source§

impl PartialEq for DecoherenceOnGateModel

source§

fn eq(&self, other: &DecoherenceOnGateModel) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for DecoherenceOnGateModel

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl SupportedVersion for DecoherenceOnGateModel

source§

fn minimum_supported_roqoqo_version(&self) -> (u32, u32, u32)

Returns the minimum roqoqo version that supports the operation. Read more
source§

impl StructuralPartialEq for DecoherenceOnGateModel

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,