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 mask for entangling gates #32

Merged
merged 17 commits into from
Sep 1, 2021
Merged

Add mask for entangling gates #32

merged 17 commits into from
Sep 1, 2021

Conversation

eileen-kuehn
Copy link
Member

This PR adds functionality to support removal of entangling gates from a given circuit via Masks. Idea to support this feature is to explicitly support lowering the expressivity of a quantum circuit and therefore maybe raising the trainability.

Closes #31.

@codecov
Copy link

codecov bot commented Aug 11, 2021

Codecov Report

Merging #32 (6c7a37d) into main (0076739) will increase coverage by 3.46%.
The diff coverage is 98.27%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #32      +/-   ##
==========================================
+ Coverage   75.13%   78.60%   +3.46%     
==========================================
  Files          15       15              
  Lines        1122     1173      +51     
  Branches      108      117       +9     
==========================================
+ Hits          843      922      +79     
+ Misses        275      246      -29     
- Partials        4        5       +1     
Impacted Files Coverage Δ
main.py 0.00% <0.00%> (ø)
maskit/circuits.py 84.21% <100.00%> (+84.21%) ⬆️
maskit/masks.py 100.00% <100.00%> (ø)
tests/test_masks.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0076739...6c7a37d. Read the comment docs.

@eileen-kuehn eileen-kuehn marked this pull request as ready for review August 11, 2021 16:31
@eileen-kuehn
Copy link
Member Author

@maxfischer2781, when reviewing, please have a specific look on how the entangling_mask is currently handled. I opted for making it optional what requires to test if it is set in case actions are performed. This will probably fail for the execute function if the mask is not properly initialised.
Any ideas on this? Further, I am a bit afraid, that this mask might even have not a so well-defined shape... However, I would like to give it a try already. What do you think?

Copy link
Contributor

@maxfischer2781 maxfischer2781 left a comment

Choose a reason for hiding this comment

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

I've only sprinkled is not Nones on the cases that were relying on implicit falseyness. That's somewhat faster and should be more robust if you ever refactor.

Do you think you can hit the continues with unittests? I can't really comment on whether they work as expected.

maskit/masks.py Outdated Show resolved Hide resolved
maskit/masks.py Outdated Show resolved Hide resolved
maskit/masks.py Outdated Show resolved Hide resolved
maskit/circuits.py Outdated Show resolved Hide resolved
maskit/circuits.py Outdated Show resolved Hide resolved
Co-authored-by: Max Fischer <maxfischer2781@gmail.com>
@maxfischer2781
Copy link
Contributor

Sorry, I missed your previous comment. TBH I'm not totally sure how exactly this change works, so it's hard for me to say how it might affect other things.

Perhaps we should discuss at a literal drawing board. :P

@eileen-kuehn
Copy link
Member Author

Do you think you can hit the continues with unittests? I can't really comment on whether they work as expected.

I added another unit test that should exactly test for that :) Now you will have to review again!

Copy link
Contributor

@maxfischer2781 maxfischer2781 left a comment

Choose a reason for hiding this comment

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

Pretty sneaky just raising the coverage while I was looking... 😜

@eileen-kuehn eileen-kuehn merged commit f0addfd into main Sep 1, 2021
@eileen-kuehn eileen-kuehn deleted the add/entangling-gate branch September 1, 2021 19:22
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.

Support dropping of entangling gates
2 participants