Skip to content

#5275 Template library [unitaryhack]#8191

Closed
grageragarces wants to merge 37 commits intoQiskit:mainfrom
grageragarces:main
Closed

#5275 Template library [unitaryhack]#8191
grageragarces wants to merge 37 commits intoQiskit:mainfrom
grageragarces:main

Conversation

@grageragarces
Copy link
Copy Markdown

Summary

Proposed template library, that Closes #5275 .

Details and comments

I am currently actively working on this, please let me know if it requires reformatting.

@grageragarces grageragarces requested a review from a team as a code owner June 16, 2022 19:25
@qiskit-bot
Copy link
Copy Markdown
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

One or more of the the following people are requested to review this:

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jun 16, 2022

CLA assistant check
All committers have signed the CLA.

@grageragarces
Copy link
Copy Markdown
Author

all templates have now been added to the library

@grageragarces
Copy link
Copy Markdown
Author

please let me know if there is a need for any additional commits or changes to the current proposal :)

@javabster
Copy link
Copy Markdown
Contributor

hi @mgg39 it looks like you have some linting issues, you should be able to fix these by running tox -eblack

Copy link
Copy Markdown
Contributor

@javabster javabster left a comment

Choose a reason for hiding this comment

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

Thanks for working on this @mgg39!

@@ -0,0 +1,18 @@
# This code is part of Qiskit.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this file is missing a .py extension

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

also the naming convention should match the other template library file. so either both should be templates or template not one of each :)

Copy link
Copy Markdown
Author

@grageragarces grageragarces Jun 17, 2022

Choose a reason for hiding this comment

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

Hi! Thanks will change both of those

@grageragarces
Copy link
Copy Markdown
Author

Hi @javabster ! Thank you so much for your help! I changed the ran tox -eblack, added the .py extension, and eliminated the s from templates (hopefully everywhere in the files) . Hopefully there won't be any issues now :)

@ShellyGarion
Copy link
Copy Markdown
Member

Thank you very much @mgg39 for your contribution!

A few comments:

  • The templates (like other parts of the qiskit code) should have tests. Currently, the tests for the templates are here:
    https://github.com/Qiskit/qiskit-terra/blob/main/test/python/circuit/test_templates.py
    Now, this test should check the templates in the new Template Library.
    However, there should be a minor correction: all the templates should be equal to identity, except of the Clifford templates which should be equivalent to identity (up to a global phase).

  • Currently the picture of the circuit of the template appears as a comment in the code, but not in the documentation of the template. It should be moved in a way such that it will appear as part of the documentation.

@grageragarces
Copy link
Copy Markdown
Author

Hi @ShellyGarion !
I am quite new to test driven development. Could you give me some guidance on how the testing file should look like? I am unsure of where to start.
Also where exactly is the relevant documentation where I should add the pictures?

@ShellyGarion
Copy link
Copy Markdown
Member

Please see the contributing guidelines about tests, code style, documentation and release notes:
https://github.com/Qiskit/qiskit-terra/blob/main/CONTRIBUTING.md

@1ucian0 1ucian0 added the unitaryhack Issues/PR participating (now or in the past) in the UnitaryHack event see https://unitaryhack.dev/ label Jun 21, 2022
@HuangJunye HuangJunye added the Community PR PRs from contributors that are not 'members' of the Qiskit repo label Jun 21, 2022
@1ucian0
Copy link
Copy Markdown
Member

1ucian0 commented Jun 28, 2022

Moving it to Draft, as it seems there is still in progress.

@grageragarces
Copy link
Copy Markdown
Author

hi! I believe the remaining conflict is associated with a slightly moved indentation at the end of " qiskit/circuit/init.py "

@grageragarces grageragarces marked this pull request as ready for review December 16, 2022 18:14
@javabster
Copy link
Copy Markdown
Contributor

hi @mgg39 I resolved the merge conflict but you'll probably need to run make black again to sort out the indentation issue

Copy link
Copy Markdown
Member

@1ucian0 1ucian0 left a comment

Choose a reason for hiding this comment

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

hi @mgg39 It seems that, there still some black issues:

Running black, any errors reported can be fixed with 'tox -eblack'
would reformat qiskit/circuit/library/__init__.py
would reformat qiskit/circuit/library/standard_gates/templates.py
would reformat test/python/circuit/test_templates.py

Oh no! 💥 💔 💥
3 files would be reformatted, 1733 files would be left unchanged.

@grageragarces
Copy link
Copy Markdown
Author

hopefully they are resolved now!

@1ucian0 1ucian0 removed unitaryhack-accepted unitaryhack Issues/PR participating (now or in the past) in the UnitaryHack event see https://unitaryhack.dev/ labels Apr 25, 2023
@1ucian0 1ucian0 added the unitaryhack Issues/PR participating (now or in the past) in the UnitaryHack event see https://unitaryhack.dev/ label May 4, 2023
Comment thread qiskit/circuit/library/__init__.py
Copy link
Copy Markdown
Member

@1ucian0 1ucian0 May 11, 2023

Choose a reason for hiding this comment

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

I think #5275 expects something like test/python/circuit/test_equivalence.py, where templetes are test to be equivalent to identity.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

will look into this

@1ucian0 1ucian0 removed the unitaryhack Issues/PR participating (now or in the past) in the UnitaryHack event see https://unitaryhack.dev/ label Sep 23, 2024
@1ucian0
Copy link
Copy Markdown
Member

1ucian0 commented May 4, 2026

The branch grageragarces:main is not writable to fix the conflicts. Closing in favor of #16131

@1ucian0 1ucian0 mentioned this pull request May 4, 2026
3 tasks
1ucian0 added a commit to 1ucian0/qiskit-terra that referenced this pull request May 4, 2026
@1ucian0 1ucian0 closed this May 4, 2026
@github-project-automation github-project-automation Bot moved this from PR open / Contributor working on it to Done in Contributor Monitoring May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community PR PRs from contributors that are not 'members' of the Qiskit repo

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

template library organization

7 participants