feat: add amplitude damping noise model (#497)#543
Conversation
- Add amplitude_damping_channel() and two_qubit_amplitude_damping_channel() to channels.py - Add AmplitudeDampingNoise, TwoQubitAmplitudeDampingNoise, AmplitudeDampingNoiseModel - Follow existing DepolarisingNoiseModel architecture exactly - Add channel tests in test_kraus.py, noise model tests in test_noise_model.py - Add end-to-end simulation tests in test_noisy_density_matrix.py - All 57 tests passing, ruff linting clean
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #543 +/- ##
==========================================
+ Coverage 88.85% 88.87% +0.01%
==========================================
Files 49 50 +1
Lines 7135 7216 +81
==========================================
+ Hits 6340 6413 +73
- Misses 795 803 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Hi @kish-00 , thanks for your contribution to Graphix ! Please take a look at the failing ruff check in CI. Also, Codecov has detected that some lines in your code are not tested. Please include these in your test suite as well. I like the tests you've added to check some specific cases of simulating a Hadamard pattern with amplitude damping noise. However, what we would really like to see is a direct comparison between the result of a pattern simulation given a random noise probability Similarly, we would like to test that the resulting state from applying amplitude damping noise at the preparation, entanglement, measurement, and correction steps matches the expected density matrix. This requires computing the state analytically at each step of the pattern. Do you think you could add this to your tests? |
- Add 4 Kraus-operator-based helper functions that independently compute expected density matrix for hpat pattern under: - measure_channel_prob (AD on measured node) - prepare_error_prob (AD on each prepared node) - entanglement_error_prob (tensor-product AD on entangled qubits) - x_error_prob (AD applied after X correction) - Add 8 parametrized tests (x 2 outcomes) comparing simulation against analytical computation, covering all four noise sources - Fix ruff RUF022: keep __all__ sorted (applied separately)
|
Analytical comparison tests added in commits 2a6808d + 46dc05e
CI needs approval to run (first-time fork contributor). Coverage should improve since the new tests use the density matrix backend path. |
Description
Implements amplitude damping noise model for the density matrix backend, as requested in #497.
Changes
New file:
graphix/noise_models/amplitude_damping.pyAmplitudeDampingNoise— single-qubit amplitude damping noiseTwoQubitAmplitudeDampingNoise— two-qubit amplitude damping noiseAmplitudeDampingNoiseModel— complete noise model with all error parameters (prepare, X/Z correction, entanglement, measurement confuse/channel)Modified files:
graphix/channels.py— addedamplitude_damping_channel()andtwo_qubit_amplitude_damping_channel()graphix/noise_models/__init__.py— updated exportsgraphix/__init__.py— updated exportsTests:
tests/test_kraus.py— channel tests (single/two-qubit, gamma=0/0.5/1 edge cases)tests/test_noise_model.py— noise model tests (nqubits, to_kraus_channel, defaults, input_nodes, confuse_result)tests/test_noisy_density_matrix.py— end-to-end simulation tests (noiseless, state changes, confuse measurement)Verification
DepolarisingNoiseModelarchitecture exactlyRelated
Closes #497
(I'm participating in unitaryHACK — this is my submission for this bounty)