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

Support for the inversion modifier of OpenQASM 3.0 #26

Closed
2 tasks
burgholzer opened this issue Dec 16, 2021 · 0 comments · Fixed by #309
Closed
2 tasks

Support for the inversion modifier of OpenQASM 3.0 #26

burgholzer opened this issue Dec 16, 2021 · 0 comments · Fixed by #309
Labels
Core Anything related to the Core library and IR enhancement New feature or request good first issue Good for newcomers

Comments

@burgholzer
Copy link
Member

burgholzer commented Dec 16, 2021

The new OpenQASM standard introduces gate modifiers in order to more efficiently describe quantum circuits. Any modifier mod can be applied to a gate g via mod @ g. For more details, see Section 4.2 in https://arxiv.org/pdf/2104.14722.pdf or the Live Specification.

The inversion modifier inv can be used to invert any gate g via inv @ g. The inverse of any gate can be computed as:

  • For any unitary operation U = U_m-1 ... U_0 its inverse U^-1 is defined by reversing the order of operations and inverting each individual gate, i.e., U^-1 = U_0^-1 ... U_m-1^-1.
  • The inverse of a controlled operation is defined as the controlled inverse operation, i.e., inv @ ctrl @ g = ctrl @ inv @ g.
  • inv @ U(a, b, c) = U(-a, -c, -b) and inv @ gphase(a) = gphase(-a)

Note that the global phase gate gphase(a) is not yet introduced and its implementation is left for another issue at the moment.

We should be able to handle many of these inversions in a cleverer fashion, e.g., if it is known, that a gate is self-inverse, or e.g., in case of the phase gate, where the inverse is obtained by negating the parameter.

Enhancing the OpenQASM parser with this feature provides greater flexibility for describing circuits in a standardized way.

Tasks

Preview Give feedback
@burgholzer burgholzer added enhancement New feature or request good first issue Good for newcomers labels Dec 16, 2021
burgholzer added a commit that referenced this issue Jun 2, 2023
* ⚡ improve performance of functions related to dynamic circuits by using sparse vectors
* ✨ add function to efficiently check if a given matrix DD is close to the identity
* 🐛 fixed some bugs that prevented functions to work for more than 32 qubits
* ⬆️ external dependencies
* ⬆️🚨 update linter version
burgholzer added a commit that referenced this issue Jun 2, 2023
* ⚡ running IWYU over the library

Signed-off-by: Lukas Burgholzer <[email protected]>

* 🎨 clang-format

Signed-off-by: Lukas Burgholzer <[email protected]>

Signed-off-by: Lukas Burgholzer <[email protected]>
@burgholzer burgholzer added the Core Anything related to the Core library and IR label Jun 15, 2023
@burgholzer burgholzer added this to MQT and MQT Core Jun 15, 2023
@burgholzer burgholzer moved this to Todo in MQT Jun 15, 2023
@burgholzer burgholzer moved this to Todo in MQT Core Jun 15, 2023
@burgholzer burgholzer linked a pull request Dec 6, 2023 that will close this issue
@github-project-automation github-project-automation bot moved this from Todo to Done in OpenQASM 3.0 Support Dec 13, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in MQT Core Dec 13, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in MQT Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Anything related to the Core library and IR enhancement New feature or request good first issue Good for newcomers
Projects
Archived in project
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant