Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions source/qdk_package/src/qir_simulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,6 @@ impl From<qdk_simulators::noise_config::LossPolicy> for LossPolicy {
#[derive(Debug)]
#[pyclass(module = "qdk._native")]
pub struct NoiseConfig {
#[pyo3(get)]
pub i: Py<NoiseTable>,
#[pyo3(get)]
pub x: Py<NoiseTable>,
#[pyo3(get)]
Expand Down Expand Up @@ -304,7 +302,6 @@ fn bind_noise_config<T: Float, Q: Float>(
value: &qdk_simulators::noise_config::NoiseConfig<T, Q>,
) -> PyResult<NoiseConfig> {
Ok(NoiseConfig {
i: Py::new(py, from_qdk_simulators_noise_table(&value.i, "i"))?,
x: Py::new(py, from_qdk_simulators_noise_table(&value.x, "x"))?,
y: Py::new(py, from_qdk_simulators_noise_table(&value.y, "y"))?,
z: Py::new(py, from_qdk_simulators_noise_table(&value.z, "z"))?,
Expand Down Expand Up @@ -379,7 +376,6 @@ pub(crate) fn unbind_noise_config<T: Float, Q: Float>(
) -> qdk_simulators::noise_config::NoiseConfig<T, Q> {
let value = value.borrow();
qdk_simulators::noise_config::NoiseConfig {
i: from_noise_table_ref(value.i.borrow(py)),
x: from_noise_table_ref(value.x.borrow(py)),
y: from_noise_table_ref(value.y.borrow(py)),
z: from_noise_table_ref(value.z.borrow(py)),
Expand Down
7 changes: 6 additions & 1 deletion source/qdk_package/tests/test_noisy_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ def test_setting_1q_noise():
assert noise.h.x == 0.01


def test_setting_identity_gate_noise_errors():
noise = NoiseConfig()
with pytest.raises(AttributeError, match="'i'"):
noise.i.set_pauli_noise("X", 1.0)


def test_setting_1q_noise_through_attr():
noise = NoiseConfig()
noise.h.x = 0.01
Expand Down Expand Up @@ -168,7 +174,6 @@ def test_setting_phaseflip_on_2q_op_errors():


SINGLE_QUBIT_GATE_ATTRS = [
"i",
"x",
"y",
"z",
Expand Down
1 change: 0 additions & 1 deletion source/simulators/benches/sim_time_noisy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const NOISE_CONFIG: NoiseConfig<f64, f64> = NoiseConfig {
idle: IdleNoiseParams {
s_probability: 0.01,
},
i: NoiseTable::noiseless(1),
x: NoiseTable::noiseless(1),
y: NoiseTable::noiseless(1),
z: NoiseTable::noiseless(1),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ fn noise_table_for<'a>(
noise_config: &'a NoiseConfig<f32, f64>,
) -> Option<&'a NoiseTable<f32>> {
let noise_table = match op.id {
ops::ID => &noise_config.i,
ops::X => &noise_config.x,
ops::Y => &noise_config.y,
ops::Z => &noise_config.z,
Expand Down
8 changes: 1 addition & 7 deletions source/simulators/src/noise_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ impl LossPolicy {
/// written.
#[derive(Clone, Debug)]
pub struct NoiseConfig<T, Q> {
pub i: NoiseTable<T>,
pub x: NoiseTable<T>,
pub y: NoiseTable<T>,
pub z: NoiseTable<T>,
Expand Down Expand Up @@ -162,7 +161,6 @@ pub const fn const_empty_hash_map<K, V>() -> FxHashMap<K, V> {

impl<T, Q> NoiseConfig<T, Q> {
pub const NOISELESS: Self = Self {
i: NoiseTable::<T>::noiseless(1),
x: NoiseTable::<T>::noiseless(1),
y: NoiseTable::<T>::noiseless(1),
z: NoiseTable::<T>::noiseless(1),
Expand Down Expand Up @@ -193,8 +191,7 @@ impl<T, Q> NoiseConfig<T, Q> {

#[must_use]
pub fn is_noiseless(&self) -> bool {
self.i.is_noiseless()
&& self.x.is_noiseless()
self.x.is_noiseless()
&& self.y.is_noiseless()
&& self.z.is_noiseless()
&& self.h.is_noiseless()
Expand Down Expand Up @@ -240,7 +237,6 @@ impl<T: Display, Q: Display> Display for NoiseConfig<T, Q> {
writeln_header(f, "NoiseConfig")?;

// Write stdgates with noise.
write_if_noisy!(i);
write_if_noisy!(x);
write_if_noisy!(y);
write_if_noisy!(z);
Expand Down Expand Up @@ -389,7 +385,6 @@ impl<T: Display> Display for NoiseTable<T> {
/// This is the internal format used by the simulator.
#[derive(Default)]
pub struct CumulativeNoiseConfig {
pub i: CumulativeNoiseTable,
pub x: CumulativeNoiseTable,
pub y: CumulativeNoiseTable,
pub z: CumulativeNoiseTable,
Expand Down Expand Up @@ -427,7 +422,6 @@ impl From<NoiseConfig<f64, f64>> for CumulativeNoiseConfig {
.collect::<FxHashMap<_, _>>();

Self {
i: value.i.into(),
x: value.x.into(),
y: value.y.into(),
z: value.z.into(),
Expand Down
Loading