add back add/remove_qubit to density matrix sim state#6259
add back add/remove_qubit to density matrix sim state#6259tanujkhattar merged 2 commits intoquantumlib:masterfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
tanujkhattar
left a comment
There was a problem hiding this comment.
This is great, thanks Sanuj for debugging the issue and sending the fix! Good to know that it was a minor fix and not a bigger issue with rest of the infrastructure.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #6259 +/- ##
==========================================
- Coverage 97.60% 97.60% -0.01%
==========================================
Files 1116 1116
Lines 95848 95858 +10
==========================================
+ Hits 93556 93564 +8
- Misses 2292 2294 +2
☔ View full report in Codecov by Sentry. |
* wip: add back add/remove_qubit to density matrix sim state * factorize inplace while removing qubit in density matrix simulation state
For #6081.
add/remove_qubit()was added in #6108 and removed in #6127. I've added back the functions and updatedremove_qubit()toself.factor()inplace to make the test (simulation_state_test.test_delegating_gate_channel()) pass.The test was failing because the final density matrices were different for the control and test circuit. The
simulate(test_circuit).final_density_matrix.shapewas (2, 2, 2, 2) whilesimulate(control_circuit).final_density_matrix.shapewas (2, 2). My guess was that the adding qubit was working fine butremove_qubit()was not able to remove the qubit. After debugging, I found that remove qubit was also working fine butself.factor()was not being done inplace and the density matrix was not getting updated during the removal of the qubit.