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

Set-up a most basic circuit equivalence checker #5700

Closed
wants to merge 41 commits into from
Closed

Set-up a most basic circuit equivalence checker #5700

wants to merge 41 commits into from

Conversation

yaelbh
Copy link
Contributor

@yaelbh yaelbh commented Jan 25, 2021

Summary

The first pull request in the list: #5692 (comment)

Details and comments

Still in progress, to be ready requires:

  • Testing.
  • Documentation.
  • Style and lint.

@yaelbh yaelbh requested review from chriseclectic and a team as code owners January 25, 2021 15:52
@yaelbh yaelbh changed the title [WIP] Set-up a most basic circuit equivalence checker Set-up a most basic circuit equivalence checker Feb 4, 2021
@yaelbh
Copy link
Contributor Author

yaelbh commented Feb 4, 2021

What can be done to perform CI testing to the Aer option of the equivalence checker? I see four options:

  1. Skip tests that import Aer (as far as I see, this is what the VQE tests do with AerPauliExpectation) - code will remain untested for many platforms.
  2. Move the equivalence checker to another repository: qiskit-aer, or its own repository - cumbersome.
  3. Copy the very same tests to qiskit-aer - code duplication.
  4. Make Terra's CI install Aer and run these tests properly - this is my preferred option. Since the same issue arises also with AerPauliExpectation, we conclude that this is a general problem that requires a general solution.

@yaelbh
Copy link
Contributor Author

yaelbh commented Feb 4, 2021

Following the discussion in #5783, I'll modify the tests to skip Aer if not installed.

@yaelbh
Copy link
Contributor Author

yaelbh commented Jul 26, 2021

@chriseclectic @ajavadia @1ucian0 @burgholzer Ready for a new cycle of review. Note that some of the previous review comments were not addressed in the code but in answers in #5692.

Comment on lines +38 to +39
phase (str): Options are 'global' - ignoring global phase;
or 'equal' - not ignoring global phase.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
phase (str): Options are 'global' - ignoring global phase;
or 'equal' - not ignoring global phase.
up_to_global_phase (bool): Option ignoring global phase or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see #5700 (comment)

@ecpeterson
Copy link
Contributor

I'm curious: why trap raise at all? Is it saving the user work to have to check a boolean for failure vs letting them do their own trapping?

@yaelbh
Copy link
Contributor Author

yaelbh commented Sep 29, 2021

@ecpeterson Which raise are you referring to?

@ecpeterson
Copy link
Contributor

@yaelbh
Copy link
Contributor Author

yaelbh commented Sep 30, 2021

@ecpeterson Essentially yes (save the user work etc.). The idea is that the equivalence checker doesn't crash but always return a result. If something went wrong, this will be reflected in the result.

@1ucian0
Copy link
Member

1ucian0 commented Oct 3, 2021

does this PR closes #761 ?

@edoaltamura
Copy link

Have there been recent updates about this PR or circuit equivalence in general?

@burgholzer
Copy link
Contributor

Have there been recent updates about this PR or circuit equivalence in general?

Please excuse the shameless plug here:

If you are interested in an easy-to-use and scalable equivalence checker that works out of the box with Qiskit, have a look at MQT QCEC (https://github.com/cda-tum/mqt-qcec, pip install mqt.qcec).

Verifying the equivalence of two Qiskit circuits is as easy as

from mqt.qcec import verify 

res = verify(qc1, qc2)

Note that the tool uses dedicated data structures (decision diagrams and ZX calculus) plus dedicated verification schemes to make the verification way more scalable than the simple construction and comparison of the circuits' unitaries. More information can be found in the documentation at https://mqt.rtfd.io/projects/qcec

@yaelbh yaelbh closed this by deleting the head repository Apr 2, 2024
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.

9 participants