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

Quantum gate factory for IR integration #23

Merged
merged 111 commits into from
Jun 17, 2021
Merged

Conversation

Mandrenkov
Copy link
Collaborator

Context:
This PR is part of an ongoing series of changes to integrate the XIR with Jet. Implementing the factory method pattern for the Gate class can streamline the interpretation of gate application statements in XIR scripts.

Description of the Change:

  • A GateFactory class has been added to create instances of Gate subclasses by name.

Benefits:

  • It is possible to instantiate a quantum gate without knowing the precise name of its corresponding Gate subclass.

Possible Drawbacks:

  • New Gate subclasses will need to be decorated with a call to @GateFactory.register to be used with the Jet-IR interpreter; this introduces a small implementation burden.

Related GitHub Issues:
None.

@Mandrenkov Mandrenkov added enhancement ✨ New feature or request code quality 🎓 Improvements to code quality labels Jun 10, 2021
@github-actions
Copy link

github-actions bot commented Jun 10, 2021

Test Report (C++) on Ubuntu

    1 files  ±0      1 suites  ±0   0s ⏱️ ±0s
521 tests ±0  521 ✔️ ±0  0 💤 ±0  0 ❌ ±0 
870 runs  ±0  870 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 9f24294. ± Comparison against base commit 9f24294.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Jun 10, 2021

Test Report (C++) on MacOS

    1 files  ±0      1 suites  ±0   0s ⏱️ ±0s
521 tests ±0  521 ✔️ ±0  0 💤 ±0  0 ❌ ±0 
870 runs  ±0  870 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 9f24294. ± Comparison against base commit 9f24294.

♻️ This comment has been updated with latest results.

Copy link
Member

@mlxd mlxd left a comment

Choose a reason for hiding this comment

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

Looks good to me. Just added comments, but feel free to ignore these.

.github/CHANGELOG.md Show resolved Hide resolved
python/jet/gate.py Show resolved Hide resolved
python/jet/gate.py Show resolved Hide resolved
python/jet/gate.py Outdated Show resolved Hide resolved
python/jet/gate.py Show resolved Hide resolved
@Mandrenkov Mandrenkov requested a review from mlxd June 14, 2021 15:10
Base automatically changed from xir-interface-circuit to main June 16, 2021 17:52
Copy link
Member

@mlxd mlxd left a comment

Choose a reason for hiding this comment

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

All good from me --- great job on this!

python/jet/gate.py Show resolved Hide resolved
python/jet/gate.py Show resolved Hide resolved
python/tests/jet/test_gate.py Show resolved Hide resolved
python/jet/gate.py Show resolved Hide resolved
@Mandrenkov Mandrenkov merged commit 9f24294 into main Jun 17, 2021
@Mandrenkov Mandrenkov deleted the xir-interface-gate-factory branch June 17, 2021 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality 🎓 Improvements to code quality enhancement ✨ New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants