mitiq
mitiq copied to clipboard
Add Qiskit example on mitigating the energy landscape of a variational circuit
Description
Resolves #1334. Makes a Qiskit version of the tutorial Mitigating the energy landscape of a variational circuit with Mitiq.
License
- [x] I license this contribution under the terms of the GNU GPL, version 3 and grant Unitary Fund the right to provide additional permissions as described in section 7 of the GNU GPL, version 3.
Before opening the PR, please ensure you have completed the following where appropriate.
- [x] I added unit tests for new code.
- [x] I used type hints in function signatures.
- [x] I used Google-style docstrings for functions.
- [x] I updated the documentation where relevant.
- [x] Added myself / the copyright holder to the AUTHORS file
Codecov Report
Merging #1551 (ac0fc26) into master (38b6a9c) will not change coverage. The diff coverage is
n/a
.
@@ Coverage Diff @@
## master #1551 +/- ##
=======================================
Coverage 98.21% 98.21%
=======================================
Files 63 63
Lines 2921 2921
=======================================
Hits 2869 2869
Misses 52 52
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
@natestemen Ok it should be good to go!
Along with making the changes necessary for the new qiskit example to show up on the gallery, I made the following additional changes which I thought would be helpful (but if not obviously they can be discarded!):
To make the original cirq example more consistent with the new qiskit example, as well as with the future pennylane and braket examples, I made these changes
- in examples.myst, change title to "Using ZNE to compute the energy landscape of a variational circuit with Cirq"
- in _thumbnails/ and conf.py, change thumbnail to a version that includes the Cirq logo
Toward the end of maintaining consistent thumbnail format as we add more examples from various frontends, I thought it would be helpful to have a set of canonical images for frontend logos. So I made this change
- in _thumbnails/, add a folder frontend-logos/ which contains .png files for cirq, qiskit, pennylane, and braket logos
If any of the additional changes should be discarded or edited, just let me know and I can update the PR.
Happy with the built doc! Everything looks good to me, great job Nick! Just one thing to follow up during the meeting - but after that should be good to go.
@Rahul-Mistri @natestemen Ok I think "simple_landscape" is now renamed everywhere it needs to be.
One question: In my local copy of the Mitiq repository, the name "simple_landscape" also occurs (see below) in docs/jupyter_execute/examples/, but the folder jupyter_execute/ doesn't seem to exist on my fork on github (where I was making the renaming changes), so I didn't change these occurrences. I'm guessing jupyter_execute/ is somehow generated automatically? Is it ok to leave these unchanged?
docs/jupyter_execute/examples/simple_landscape.ipynb docs/jupyter_execute/examples/simple_landscape.py docs/jupyter_execute/examples/simple_landscape_13_0.png docs/jupyter_execute/examples/simple_landscape_17_0.png docs/jupyter_execute/examples/simple_landscape_23_0.png
@nickdgardner it shouldn't be an issue. I'd recommend pulling from your fork to update your local repo and rebuilding docs. It should resolve everything.
@Rahul-Mistri That fixed everything. Thanks!
BTW Nick, I plan to do a release tomorrow (Oct 31 🎃). If you aren't able to do these changes soon (sorry for the late comments), I'll make them and push them up to you branch before I merge it.
@andreamari @natestemen Thanks for the edits, and for the heads-up about the release! I'll get these done at some point within the next hour.
The build is failing, but with expected errors due to a link renaming, and a flaky test which is being tracked in https://github.com/unitaryfund/mitiq/issues/1509.