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
impl DecoherenceOnGateModel
sourcepub fn set_single_qubit_gate_error(
self,
gate: &str,
qubit: usize,
noise_operator: PlusMinusLindbladNoiseOperator,
) -> Self
pub fn set_single_qubit_gate_error( self, gate: &str, qubit: usize, noise_operator: PlusMinusLindbladNoiseOperator, ) -> Self
sourcepub fn get_single_qubit_gate_error(
&self,
gate: &str,
qubit: usize,
) -> Option<&PlusMinusLindbladNoiseOperator>
pub fn get_single_qubit_gate_error( &self, gate: &str, qubit: usize, ) -> Option<&PlusMinusLindbladNoiseOperator>
sourcepub fn set_two_qubit_gate_error(
self,
gate: &str,
control: usize,
target: usize,
noise_operator: PlusMinusLindbladNoiseOperator,
) -> Self
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.
sourcepub fn get_two_qubit_gate_error(
&self,
gate: &str,
control: usize,
target: usize,
) -> Option<&PlusMinusLindbladNoiseOperator>
pub fn get_two_qubit_gate_error( &self, gate: &str, control: usize, target: usize, ) -> Option<&PlusMinusLindbladNoiseOperator>
sourcepub fn set_three_qubit_gate_error(
self,
gate: &str,
control0: usize,
control1: usize,
target: usize,
noise_operator: PlusMinusLindbladNoiseOperator,
) -> Self
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.
sourcepub fn get_three_qubit_gate_error(
&self,
gate: &str,
control0: usize,
control1: usize,
target: usize,
) -> Option<&PlusMinusLindbladNoiseOperator>
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.
sourcepub fn set_multi_qubit_gate_error(
self,
gate: &str,
qubits: Vec<usize>,
noise_operator: PlusMinusLindbladNoiseOperator,
) -> Self
pub fn set_multi_qubit_gate_error( self, gate: &str, qubits: Vec<usize>, noise_operator: PlusMinusLindbladNoiseOperator, ) -> Self
sourcepub fn get_multi_qubit_gate_error(
&self,
gate: &str,
qubits: Vec<usize>,
) -> Option<&PlusMinusLindbladNoiseOperator>
pub fn get_multi_qubit_gate_error( &self, gate: &str, qubits: Vec<usize>, ) -> Option<&PlusMinusLindbladNoiseOperator>
Trait Implementations§
source§impl Clone for DecoherenceOnGateModel
impl Clone for DecoherenceOnGateModel
source§fn clone(&self) -> DecoherenceOnGateModel
fn clone(&self) -> DecoherenceOnGateModel
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for DecoherenceOnGateModel
impl Debug for DecoherenceOnGateModel
source§impl Default for DecoherenceOnGateModel
impl Default for DecoherenceOnGateModel
source§fn default() -> DecoherenceOnGateModel
fn default() -> DecoherenceOnGateModel
source§impl<'de> Deserialize<'de> for DecoherenceOnGateModel
impl<'de> Deserialize<'de> for DecoherenceOnGateModel
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl From<DecoherenceOnGateModel> for DecoherenceOnGateModelSerialize
impl From<DecoherenceOnGateModel> for DecoherenceOnGateModelSerialize
source§fn from(value: DecoherenceOnGateModel) -> Self
fn from(value: DecoherenceOnGateModel) -> Self
source§impl From<DecoherenceOnGateModel> for NoiseModel
impl From<DecoherenceOnGateModel> for NoiseModel
source§fn from(value: DecoherenceOnGateModel) -> Self
fn from(value: DecoherenceOnGateModel) -> Self
source§impl From<DecoherenceOnGateModelSerialize> for DecoherenceOnGateModel
impl From<DecoherenceOnGateModelSerialize> for DecoherenceOnGateModel
source§fn from(value: DecoherenceOnGateModelSerialize) -> Self
fn from(value: DecoherenceOnGateModelSerialize) -> Self
source§impl PartialEq for DecoherenceOnGateModel
impl PartialEq for DecoherenceOnGateModel
source§fn eq(&self, other: &DecoherenceOnGateModel) -> bool
fn eq(&self, other: &DecoherenceOnGateModel) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for DecoherenceOnGateModel
impl Serialize for DecoherenceOnGateModel
impl StructuralPartialEq for DecoherenceOnGateModel
Auto Trait Implementations§
impl Freeze for DecoherenceOnGateModel
impl RefUnwindSafe for DecoherenceOnGateModel
impl Send for DecoherenceOnGateModel
impl Sync for DecoherenceOnGateModel
impl Unpin for DecoherenceOnGateModel
impl UnwindSafe for DecoherenceOnGateModel
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moresource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.