Trait roqoqo::operations::OperatePragmaNoise
source · pub trait OperatePragmaNoise: Operate + InvolveQubits + Substitute + Clone + PartialEq + OperatePragma + SupportedVersion {
// Required methods
fn superoperator(&self) -> Result<Array2<f64>, RoqoqoError>;
fn powercf(&self, power: CalculatorFloat) -> Self;
}
Expand description
Trait for PRAGMA Operations that are not necessary available on all universal quantum hardware, that indicate noise.
§Example
use ndarray::{array, Array2};
use roqoqo::operations::{OperatePragmaNoise, OperatePragmaNoiseProba, PragmaDamping};
use qoqo_calculator::CalculatorFloat;
let pragma = PragmaDamping::new(0, CalculatorFloat::from(0.005), CalculatorFloat::from(0.02));
// 1) The superoperator representation of the noise Pragma
let superop_prob: f64 = *pragma.probability().float().unwrap();
let superop_sqrt: f64 = (1.0 - superop_prob.clone()).sqrt();
let superop: Array2<f64> = array![
[1.0, 0.0, 0.0, superop_prob.clone()],
[0.0, superop_sqrt, 0.0, 0.0],
[0.0, 0.0, superop_sqrt, 0.0],
[0.0, 0.0, 0.0, 1.0 - superop_prob.clone()],
];
assert_eq!(superop, pragma.superoperator().unwrap());
// 2) The power function applied to the noise Pragma
let pragma_test = PragmaDamping::new(
0,
CalculatorFloat::from(0.005 * 1.5),
CalculatorFloat::from(0.02),
);
assert_eq!(pragma_test, pragma.powercf(CalculatorFloat::from(1.5)));
Required Methods§
sourcefn superoperator(&self) -> Result<Array2<f64>, RoqoqoError>
fn superoperator(&self) -> Result<Array2<f64>, RoqoqoError>
Returns superoperator matrix of the Operation.
sourcefn powercf(&self, power: CalculatorFloat) -> Self
fn powercf(&self, power: CalculatorFloat) -> Self
Returns the gate to the power of power
.
Object Safety§
This trait is not object safe.
Implementors§
impl OperatePragmaNoise for PragmaNoiseOperation
impl OperatePragmaNoise for PragmaNoiseProbaOperation
impl OperatePragmaNoise for PragmaDamping
OperatePragmaNoise trait creating necessary functions for a PRAGMA noise Operation.
impl OperatePragmaNoise for PragmaDephasing
OperatePragmaNoise trait creating necessary functions for a PRAGMA noise Operation.
impl OperatePragmaNoise for PragmaDepolarising
OperatePragmaNoise trait creating necessary functions for a PRAGMA noise Operation.
impl OperatePragmaNoise for PragmaGeneralNoise
OperatePragmaNoise trait creating necessary functions for a PRAGMA noise Operation.
impl OperatePragmaNoise for PragmaRandomNoise
OperatePragmaNoise trait creating necessary functions for a PRAGMA noise Operation.