-
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
shor syndrome, classic xor, and pauli frame x measurement #170
shor syndrome, classic xor, and pauli frame x measurement #170
Conversation
Codecov Report
@@ Coverage Diff @@
## master #170 +/- ##
==========================================
+ Coverage 83.88% 84.01% +0.13%
==========================================
Files 44 44
Lines 3326 3391 +65
==========================================
+ Hits 2790 2849 +59
- Misses 536 542 +6
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
src/misc_ops.jl
Outdated
|
||
"""Applies an XOR gate to classical bits. Currently only implemented for funcitonality with pauli frames.""" | ||
struct ClassicalXOR <: AbstractOperation | ||
bits::Vector{Int} # the indices of the classical bits to be xored |
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.
Turn these into NTuple{N, Int}
where N
is a type parameter for ClassicalXOR
. That way it will be non-allocating (Vector
can not be stored on the stack, they only go in the heap).
src/pauli_frames.jl
Outdated
function apply!(frame::PauliFrame, op::sMZ) # TODO sMX, sMY | ||
function apply!(frame::PauliFrame, xor::ClassicalXOR) | ||
for f in eachindex(frame) | ||
value = reduce(⊻,frame.measurements[f,xor.bits]) |
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.
use a view, otherwise this will allocate a new array at each itteration
src/misc_ops.jl
Outdated
bits::Vector{Int} # the indices of the classical bits to be xored | ||
store::Int # the index of the classical bit that will store the results | ||
end | ||
ClassicalXOR(bits::NTuple, store::Int) = ClassicalXOR(collect(bits),store) |
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.
after the ClassicalXOR above is changed to use tuples, this constructor can be deleted
could you add tests Something along the lines of:
|
@amicciche, I will try to help with this in the next few days. Let me know if you have local unpushed changes so that I avoid causing merge conflicts. |
Thank you very much for asking this! (I do enjoy avoiding merge conflicts myself). I'll add a commit soon which changes the |
I just pushed my latest changes. Here is an example for how to use the new
|
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
|
@amicciche , check the last two commits and let me know if something is unclear. A pretty important addition was the tests. I also slightly changed the API for the syndrome measurement circuits (they return a bit more information now). That might require changing some of your user code. |
the tests will fail until the new Quantikz version is registered (should be done in a few minutes). I will rerun the tests tomorrow. |
These all make sense to me. I agree that returning the ancillary qubit information is helpful, otherwise the user needs to run a loop like this to calculate it:
|
Shor-style syndrome extraction, classical xor gate, and a lazy implementation x measurement for pauli frames.
ClassicalXOR
Here is some sample code to run the shor syndrome circuit:
I tested all single qubit errors after encoding on the Steane code.
I tested random single qubit errors on the Shor code.