-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Probabilistic Error Cancellation #1097
Conversation
Added PEC to error_mitigation.py
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
@mho291 can you change the name of the PR to something a little bit more evocative, like for instance 'Probabilistic Error Cancellation'? |
Thanks @mho291 for implementing this. The code looks a bit too much as a notebook example. To incorporate it into
such that a user can use it by doing:
Furthermore, by quickly looking into the code I noticed that you are defining by hand the gates. You don't need to do this, qibo is providing the API for simulating the execution of a quantum circuit already. As a rule of thumb, you should try to stick to the functions provided by qibo as much as you can. |
Hi @BrunoLiegiBastonLiegi, thank you for providing useful comments. The code I wrote for PEC works as what you've described. One can call the PEC function directly, for example:
About the hand-defining the gates, it's actually part of the gate set tomography for probabilistic error cancellation. Here, a single qubit circuit is initialized in the { |0>, |1>, |+>, and |y+> } states and measured in the Pauli bases {I, X, Y, Z}. For two qubits, we just take tensor products, i.e. { |00>, |01>, ..., |y+>|y+> } for the states and {II, IX, IY, ..., ZZ} for the measurement bases. The PEC code contains these parts: (1) Gate set tomography, (2) Computing quasi probabilities, (3) Monte Carlo sampling, and (4) Post-processing of Monte Carlo samples. I have incorporated post-processing into the Monte Carlo sampling block of code but will work on separating the parts of PEC into functions that are usable for general use. |
You don't need to define them by hand. Each gate in qibo has a
Yes, then it's better to separate the different pieces and then call them inside PEC, but they probably should not be inside of Moreover, I saw that you are creating directories inside PEC. What do you need them for? |
Split PEC into multiple function for obtaining inverse noise, quasiprobabilities, Monte Carlo sampling. Added gate set tomography into src/qibo/validation/
for more information, see https://pre-commit.ci
I have split up the functions of PEC in the update. Gate set tomography has been added to src/qibo/validation. The functions for calculating the inverse noise, obtain quasi probabilities, and Monte Carlo have been split. I didn't know where to add them so I've placed them into error_mitigation.py for the time being. The final PEC function contains these individual functions and outputs the error-mitigated distribution. As for the creation of directories, it's now part of the argument "save_data". If save_data is not None, then we'll create directories to store all the gate set tomography data and Monte Carlo samples. |
@mho291 could you please open another PR with just the tomography? As discussed during the last meeting, this simplifies review and tests. |
Will do! |
Added PEC to error_mitigation.py
Checklist: