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

grid entanglement with multiple paths #106

Merged
merged 12 commits into from
Mar 15, 2024
Merged

Conversation

ba2tro
Copy link
Member

@ba2tro ba2tro commented Feb 16, 2024

Builds on #90

@ba2tro ba2tro added the Skip-Changelog label for control of CI: skips the changelog check label Feb 16, 2024
Copy link

codecov bot commented Feb 16, 2024

Codecov Report

Attention: Patch coverage is 97.43590% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 71.42%. Comparing base (1ebffc0) to head (17bc052).

Files Patch % Lines
src/ProtocolZoo/ProtocolZoo.jl 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #106      +/-   ##
==========================================
+ Coverage   71.14%   71.42%   +0.28%     
==========================================
  Files          37       37              
  Lines        1473     1491      +18     
==========================================
+ Hits         1048     1065      +17     
- Misses        425      426       +1     

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

@ba2tro ba2tro marked this pull request as ready for review February 17, 2024 00:55
@ba2tro ba2tro requested a review from Krastanov February 17, 2024 00:56
src/queries.jl Outdated Show resolved Hide resolved
src/queries.jl Outdated Show resolved Hide resolved
@Krastanov
Copy link
Member

I should have more time to look into this tonight if you have a chance to address my comments.

src/queries.jl Outdated Show resolved Hide resolved
… ::Tag)` bug, move filo to keyword argument
isnothing(i) ? nothing : (;slot=reg[i], tag=tag)
end
function query(reg::Register, tag::Tag, ::Val{allB}=Val{false}(); locked::Union{Nothing,Bool}=nothing, assigned::Union{Nothing,Bool}=nothing, filo::Bool=true) where {allB}
_query(reg, tag, Val{allB}(), Val{filo}(); locked=locked, assigned=assigned)
Copy link
Member

Choose a reason for hiding this comment

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

this indirection from a Bool keyword argument to a Val{Bool} argument, is necessary if we want the compiler to guarantee that separate machine code is compiled for each of the two values (true / false).

It is also a way to avoid code duplication (e.g. queryall simply calls query(...,Val(true)))

It made sense when the function was simpler and it makes sense for private things.

But for public things like the filo keyword, it is cumbersome to use; Moreover, it is not simple anymore, so we should probably just split these methods, instead of having all these compile-time if/else statements (in Julia an if-else that depends only on information in the type system, will be decided during compilation and there will be no if/else actually happening when we run the program)

Comment on lines +100 to +105
@test query(reg, EntanglementCounterpart, 2, 22) == (slot = reg[2], depth = 7, tag = Tag(EntanglementCounterpart,2,22))
@test queryall(reg, EntanglementCounterpart, 2, 22) == [(slot = reg[2], depth = 7, tag = Tag(EntanglementCounterpart,2,22)), (slot = reg[2], depth = 2, tag = Tag(EntanglementCounterpart,2,22))]
@test queryall(reg, Tag(EntanglementCounterpart, 2, 22)) == [(slot = reg[2], depth = 7, tag = Tag(EntanglementCounterpart,2,22)), (slot = reg[2], depth = 2, tag = Tag(EntanglementCounterpart,2,22))]
@test queryall(reg, EntanglementCounterpart, 2, 22) == queryall(reg, EntanglementCounterpart, ==(2), ==(22)) == queryall(reg, Tag(EntanglementCounterpart, 2, 22))
@test queryall(reg, Tag(EntanglementCounterpart, 2, 22); filo=false) == reverse([(slot = reg[2], depth = 7, tag = Tag(EntanglementCounterpart,2,22)), (slot = reg[2], depth = 2, tag = Tag(EntanglementCounterpart,2,22))])
@test queryall(reg, EntanglementCounterpart, 2, 22; filo=false) == queryall(reg, EntanglementCounterpart, ==(2), ==(22); filo=false) == queryall(reg, Tag(EntanglementCounterpart, 2, 22); filo=false)
Copy link
Member

Choose a reason for hiding this comment

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

all of these were failing before I fixed the issue with queryall(::Register, ...)

@Krastanov Krastanov merged commit 269cff2 into QuantumSavory:master Mar 15, 2024
10 of 13 checks passed
@Krastanov
Copy link
Member

@Abhishek-1Bhatt , thank you, this is merged now!

Please check out the changes I made, in terms of consistency of interface or ease of reading of tests.

Please learn more about how rebasing works in git and github. It is crucially important to get more comfortable with it, as it is the only way to scalably work on projects like this: a follow-up PR can not wait on this to be finished, otherwise work will never be done. Rebasing takes care tracking code changes. Testing should always be so thorough that it takes care of worries about how changes affect other code (even if we were not using much rebasing).

@Krastanov
Copy link
Member

Oh, I also marked a todo in one of the test files -- currently the protocols are tested only for a small finite number of rounds. That can hide many bugs -- it is very important to have tests where the number of rounds is not constrained. You are probably already investigating this in your other PRs, but it is worth mentioning it here.

@ba2tro ba2tro deleted the grid branch March 30, 2024 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip-Changelog label for control of CI: skips the changelog check
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants