Skip to content
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

Add test for bug fix for issue #7335 #24

Closed

Conversation

jlapeyre
Copy link

@jlapeyre jlapeyre commented Jul 19, 2024

The title refers to Qiskit#7335 .
The bug/deficiency is fixed, but not tested, by Qiskit#12776

This PR (#24) adds a test for this bug fix.

jakelishman and others added 9 commits July 16, 2024 12:50
This rewrites the symbol handling of the OpenQASM 3 exporter to decouple
object identities from the necessary object identifiers.  As part of
this, we use the same trick of standard-gate reparametrisation to
produce gate-definition sources for Qiskit built-ins, which fixes many
cases of bad parametrisation of gates like `rzx`.

This kind of rewrite was necessary to fix the now-bad assumption within
the OQ3 exporter that "gate identity" is always static within a circuit.
Since standard gate `Gate` instances are now only generated on demand,
there is no guarantee of stability of them.  The fix to the definition
source for these makes them independent of object identity.
User-defined gates can still use the identity, as these are still
guaranteed static.

This commit fixes almost all of the "bad parametrisation" tests in the
test suite.  There are several other changes in the test suite
necessary:

* since the uniqueness of the identifier is now independent of how the
  lookup of a Qiskit object works, there is no need to include the
  highly non-deterministic `id` in the generated symbols for user gates.
  Several tests changed to use the new, simple count-based unique names.

* the escaping and uniqueness rules now apply uniformly to all gate
  definitions, fixing several bad test cases that previously were
  testing invalid OpenQASM 3.

* the escaping rules changed slightly for naming collisions with
  keywords, making them slightly more consistent with how other renaming
  rules worked.
…iskit#12772)

* Optimization for the MCX Recursive Gate

Change the recursive method for the Lemma 9 of arXiv:1501.06911, first shown in Lemma 7.3 of https://link.aps.org/doi/10.1103/PhysRevA.52.3457

Co-Authored-By: Rafaella Vale <26910380+rafaella-vale@users.noreply.github.com>
Co-Authored-By: Jefferson Deyvis <67497412+jeffersondeyvis@users.noreply.github.com>

* Revert "Optimization for the MCX Recursive Gate"

This reverts commit 507d5b3.

Co-Authored-By: Rafaella Vale <26910380+rafaella-vale@users.noreply.github.com>
Co-Authored-By: Jefferson Deyvis <67497412+jeffersondeyvis@users.noreply.github.com>

* Revert "Revert "Optimization for the MCX Recursive Gate""

This reverts commit 4671b7e.

* Optimization for MCX Recursive

Fixing co-authors

Co-Authored-By: Rafaella Vale <26910380+rafaella-vale@users.noreply.github.com>
Co-Authored-By: Jefferson Deyvis <67497412+jeffersondeyvis@users.noreply.github.com>
Co-Authored-By: Adenilton Silva <7927558+adjs@users.noreply.github.com>

* Optimization of MCX Recursive

Now with fixed co-authors

Co-Authored-By: Rafaella Vale <26910380+rafaella-vale@users.noreply.github.com>
Co-Authored-By: Jefferson Deyvis <67497412+jeffersondeyvis@users.noreply.github.com>
Co-Authored-By: Adenilton Silva <7927558+adjs@users.noreply.github.com>

* refactored MCXRecursive and unused method deleted

* fixed qasm string for mcx test with variants

* remove draw

* fix qasm file in test_circuit_qasm_with_mcx_gate_variants

* update the MCXRecursive class docstring

* add a test of the upper bound limit of the number of CX gates

* fix failing qasm test

* fix qasm file in test_export in qasm2 tests

* fix format lint errors in qasm strings

* add release notes

* update references format

* update release notes after review

---------

Co-authored-by: Thiago Melo <thiagomdazevedo@hotmail.com>
Co-authored-by: Rafaella Vale <26910380+rafaella-vale@users.noreply.github.com>
Co-authored-by: Jefferson Deyvis <67497412+jeffersondeyvis@users.noreply.github.com>
Co-authored-by: Adenilton Silva <7927558+adjs@users.noreply.github.com>
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.62 to 1.0.63.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](dtolnay/thiserror@1.0.62...1.0.63)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
)

* riverlane paper

* docs

* improvement

* empty

* fix linting and add abs

* Update qiskit/primitives/backend_estimator_v2.py

Co-authored-by: Takashi Imamichi <31178928+t-imamichi@users.noreply.github.com>

* CR

* Update qiskit/primitives/backend_estimator_v2.py

Co-authored-by: Ian Hincks <ian.hincks@gmail.com>

* CR

* indent

* Update releasenotes/notes/backend-estimator-v2-variance-905c953415ad0e29.yaml

Co-authored-by: Takashi Imamichi <31178928+t-imamichi@users.noreply.github.com>

---------

Co-authored-by: Takashi Imamichi <31178928+t-imamichi@users.noreply.github.com>
Co-authored-by: Ian Hincks <ian.hincks@gmail.com>
* added circuit functions

* updated circuits functions

* added qasm files

* added benchmarking metrics

* cleaning up circuits

* updated tests

* updated tests

* formatting

* removed unused import

* clifford synthesis circ test

* lint test
@jakelishman
Copy link
Owner

Merged as 2cbf15f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants