-
Notifications
You must be signed in to change notification settings - Fork 49
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
Naive Implementation of the Encoding Circuit #154
Conversation
Codecov Report
@@ Coverage Diff @@
## master #154 +/- ##
==========================================
+ Coverage 83.45% 83.51% +0.06%
==========================================
Files 45 48 +3
Lines 3414 3451 +37
==========================================
+ Hits 2849 2882 +33
- Misses 565 569 +4
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
src/ecc/papercode.jl
Outdated
@@ -0,0 +1,9 @@ | |||
struct Paper8 <: AbstractECC end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May we rename this to Cleve8
(from the last name of the author). Paper8
is a bit confusing :D
I will test all of this later today and give comments
I will make a few changes to this branch and push them here. I will comment on why the changes are made in the commit messages. Most of them are just stylistic questions. Please check through the messages so we are on the same page for why I was making the changes. Do not forget to pull the now modified branch before you start making changes of your own. |
src/ecc/ECC.jl
Outdated
""" Check if the code is degenerate or not.""" | ||
function is_degenerate(c::AbstractECC) | ||
tableau = stab_to_gf2(parity_checks(c)) | ||
n = code_n(c) | ||
dictionary = Set() | ||
for column in 1:2*n | ||
temp = tableau[:, column] | ||
if temp in dictionary | ||
return true | ||
else | ||
push!(dictionary, temp) | ||
end | ||
end | ||
return false | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you document where is this from? Where did you find this algorithm?
src/ecc/ECC.jl
Outdated
# and we augment the following third line (for logical qubits) | ||
# 0 E^T I | 0 0 0 | ||
# Then we apply the gates line by line bottom up in accordance with the formalisms here: arXiv:quant-ph/9607030 | ||
standard_tab = stab_to_gf2(stabilizerview(MixedDestabilizer(parity_checks(c), undoperm=false))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at some point you have to undo the permutations of columns, otherwise your qubits are now reindexed from what the user was expecting, and great amount of confusion can ensue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, check this function, it seems to be doing most of what you need. canonicalize_gott
specifically seems to be doing all of the necessary steps, including creating the E^T part
QuantumClifford.jl/src/QuantumClifford.jl
Line 514 in 5ab1f0f
function MixedDestabilizer(stab::Stabilizer{T}; undoperm=true) where {T} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope, I am wrong, it does not do everything you need, but might be a useful inspiration for how to write your code in a more simple way
src/ecc/ECC.jl
Outdated
end | ||
standard_tab = vcat(standard_tab, augment) | ||
end | ||
# Flipping the table so it has the same format as the papercode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just use transpose
, and if you need to reverse axes you can use reverse
. It would be much shorter and more legible.
Could you place any references in this file: https://github.com/QuantumSavory/QuantumClifford.jl/blob/master/docs/src/references.bib You can then refer to them with a |
…ocstring where this algorithm is from
…e same, but it is reusing MixedDestabilizer for all steps
@dmtrung14 , I pushed two commits with small changes. Could you look at the TODOs I have left in them. |
Benchmark ResultJudge resultBenchmark Report for /home/runner/work/QuantumClifford.jl/QuantumClifford.jlJob Properties
ResultsA ratio greater than
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoTarget
Baseline
Target resultBenchmark Report for /home/runner/work/QuantumClifford.jl/QuantumClifford.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Baseline resultBenchmark Report for /home/runner/work/QuantumClifford.jl/QuantumClifford.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Runtime information
Architecture: x86_64
Benchmark ResultJudge resultBenchmark Report for /home/runner/work/QuantumClifford.jl/QuantumClifford.jlJob Properties
ResultsA ratio greater than
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoTarget
Baseline
Target resultBenchmark Report for /home/runner/work/QuantumClifford.jl/QuantumClifford.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Baseline resultBenchmark Report for /home/runner/work/QuantumClifford.jl/QuantumClifford.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Runtime information
Architecture: x86_64
Benchmark ResultJudge resultBenchmark Report for /home/runner/work/QuantumClifford.jl/QuantumClifford.jlJob Properties
ResultsA ratio greater than
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoTarget
Baseline
Target resultBenchmark Report for /home/runner/work/QuantumClifford.jl/QuantumClifford.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Baseline resultBenchmark Report for /home/runner/work/QuantumClifford.jl/QuantumClifford.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Runtime information
Architecture: x86_64
Benchmark ResultJudge resultBenchmark Report for /home/runner/work/QuantumClifford.jl/QuantumClifford.jlJob Properties
ResultsA ratio greater than
|
Trung, have you tested the new encoding circuit function you have created? Just running it with default parameters is raising errors? New functionality should be tested - it helps both with review and with correctness. |
Yes, I did run the functions to test and nothing seems wrong. I did not write new tests for it though. I will do it now |
Oh I think I figured out what is the problem: When I undoperm before I create the circuits, then the check |
I submitted a commit that has a bit of cleanup and a few tests. Currently, with or without undoing permutations I seem to have the wrong results. E.g. with Which seems pretty different from the one in the paper. If you are making modifications, could you add them on top of the cleanup commit I submitted (a Let me know if you figure out what the problem is. |
Why do I keep getting this message when I tried to pull (and consequently my local repo is not updating)? Also, is there a built in method that allows me to create a circuit like that? It might help me to debug faster. Currently I am doing everything by hand.
|
the changes were made to your origin/minor branch (the branch which is being provided in this pull request), not the master branch |
the last two commits you made that I see here seem to match what I was doing, so maybe things are fine? |
I think I figured out what is wrong with the circuit. I think we must have ignored what the It is currently returning this for
while it should return this: As you can see, the 3rd and the 4th rows have their bits flipped. I don't have any reasonable explanation for it. |
@amicciche , I think this should implement all we need. Thank you for the presentation last week, it made it much easier to implement. I also added the references you found to the documentation. @dmtrung14 , thank you so much for the initial implementation during the summer! Anthony gave it another look and pointed out that there seems to be some issues in the paper. It turns out that both the thesis and the paper by Cleve contain some severe but subtle mistakes. This should address them all. |
Compared to the code we saw today I broke the
naive_encoding_circuit
function into 3 parts:rank
calculates the rank,standard_tab_gott
calculates the standardized tableau in the format of PhysRevA.56.76, and the real naive_encoding_circuit.I put all of them in
ecc.jl
I tested each function on the codes I knew and found no apparent mistakes. But they error out when I tried to swap
encoding_circuit
fornaive_encoding_circuit
in thenaive_syndrome_test
Also I added noise to the
naive_syndrome_test