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

embed for single-qubit and two-qubit symbolic Clifford Operators #415

Closed
wants to merge 1 commit into from

Conversation

Fe-r-oz
Copy link
Contributor

@Fe-r-oz Fe-r-oz commented Nov 2, 2024

The PR #413 revealed to us that we don't have embed for single-qubit dense/symbolic Clifford Operator or two-qubit dense/symbolic Clifford Operator. Thus, this PR attemps to define embed for single-qubit Clifford Operator, thereby addressing a chunk of #151

Edit:

I think is is straightforward as we have already defined implicit embed as CliffordOperator(sCNOT(1, 2), 4) for instance!

julia> embed(5, (2,3), sCNOT)
X₁ ⟼ + X____
X₂ ⟼ + _XX__
X₃ ⟼ + __X__
X₄ ⟼ + ___X_
X₅ ⟼ + ____X
Z₁ ⟼ + Z____
Z₂ ⟼ + _Z___
Z₃ ⟼ + _ZZ__
Z₄ ⟼ + ___Z_
Z₅ ⟼ + ____Z

Before considering your pull request ready for review and merging make sure that all of the following are completed (please keep the clecklist as part of your PR):

  • The code is properly formatted and commented.
  • Substantial new functionality is documented within the docs.
  • All new functionality is tested.
  • All of the automated tests on github pass.
  • We recently started enforcing formatting checks. If formatting issues are reported in the new code you have written, please correct them. There will be plenty of old code that is flagged as we are slowly transitioning to enforced formatting. Please do not worry about or address older formatting issues -- keep your PR just focused on your planned contribution.

@Fe-r-oz Fe-r-oz changed the title embed for single-qubit Clifford Operator embed for single-qubit dense and symbolic Clifford Operator Nov 2, 2024
@Fe-r-oz Fe-r-oz marked this pull request as draft November 2, 2024 17:30
Copy link

codecov bot commented Nov 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.95%. Comparing base (c3546cd) to head (c940f2f).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #415   +/-   ##
=======================================
  Coverage   82.94%   82.95%           
=======================================
  Files          70       70           
  Lines        4557     4559    +2     
=======================================
+ Hits         3780     3782    +2     
  Misses        777      777           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Fe-r-oz Fe-r-oz force-pushed the fa/embedClifford branch 2 times, most recently from ae51ac6 to 4186fb1 Compare November 2, 2024 18:13
@Fe-r-oz Fe-r-oz marked this pull request as ready for review November 2, 2024 18:17
@Fe-r-oz Fe-r-oz changed the title embed for single-qubit dense and symbolic Clifford Operator embed for single-qubit and two-qubit symbolic Clifford Operators Nov 2, 2024
@Fe-r-oz Fe-r-oz force-pushed the fa/embedClifford branch 2 times, most recently from 8e18dd4 to af7a20a Compare November 2, 2024 18:40
@Fe-r-oz Fe-r-oz marked this pull request as draft November 2, 2024 19:09
@Fe-r-oz Fe-r-oz marked this pull request as ready for review November 2, 2024 19:56
@Fe-r-oz
Copy link
Contributor Author

Fe-r-oz commented Nov 2, 2024

The PR is ready for review. Thank you!

Copy link
Member

@Krastanov Krastanov 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 looking into this. Do we need an embed for these though? They already work fine on arbitrary number of qubits, i.e. they are already implicitly embedded. You can run apply!(stab, sCNOT(1,2)) on any size stab (if anything, an embed here would make thinks slower). You can not do that with apply!(stab, tCNOT) so an embed is needed.

I guess adding this functionality makes sense just for completeness, but there should be a warning in the docstring that this is a bad way to do it.

Also, it seems there is a single docstring for one of the methods that includes what is supposed to be a docstring for the other method. This should be two separate docstrings (if they are method dosctrings).

Lastly, the single-qubit embed should still permit one-tuples as argument types for i to be consistent with the rest of the embed methods

@Krastanov
Copy link
Member

also, new functionality like this needs tests

@Fe-r-oz
Copy link
Contributor Author

Fe-r-oz commented Nov 3, 2024

Thank you for your comments.

Do we need an embed for these though?

Actually, I considered closing this PR since the embedding is already handled implicitly. While it’s worth exploring alternative approaches while looking into #151, the final outcome here doesn’t offer much added value.

Instead of adding code that SLOW DOWN performance || is a BAD way to do things || might introduce redundant checks, we can simply update the documentation to clarify that the embedding is implicitly supported.

This also seems like an inefficient use of your valuable review time.

So, let's just close it :)

@Fe-r-oz Fe-r-oz closed this Nov 3, 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.

2 participants