You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+126-2Lines changed: 126 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
# CircuitCompilation2xn
2
-
CircuitCompilation2xn offers some tools to manipulate syndrome extracting circuits for better use on 2xn quantum dot hardwares. For more information please refer to the [paper](https://arxiv.org/abs/2501.09061) , and if one would desire to cite this tool, please cite the paper.
3
-
## How to use this?
2
+
CircuitCompilation2xn offers some tools to manipulate syndrome extracting circuits for better use on 2xn quantum dot hardwares. For more information please refer to our [paper](https://arxiv.org/abs/2501.09061) , and if one would desire to cite this tool, please cite the paper.
3
+
4
+
## Tutorial
4
5
First, we state that this work is closely integrated with [QuantumClifford.jl](https://github.com/QuantumSavory/QuantumClifford.jl)
5
6
6
7
To begin, we will need either a parity check matrix (or stabilizer tableau), or a `Vector{QuantumClifford.AbstractOperation}` containing the syndrome extracting circuit. Currently, we enforce the constraint that syndrome extracting circuit will always be of a form where the two qubit gates act one one qubit in the data qubit region and one in the ancilla region (i.e. there are two qubit gates that go between data or ancilla qubits).
@@ -9,6 +10,10 @@ To begin, we will need either a parity check matrix (or stabilizer tableau), or
9
10
10
11

11
12
13
+
From here on, this tutorial will contain a few examples, divided into sections below:
14
+
- Naive syndrome circuits example
15
+
- Shor syndrome circuits example
16
+
12
17
### Naive syndrome circuits example
13
18
First we will need a error correction code, and while any will do, let's use one that's already defined within `QuantumClifford.jl`, and is quite pedagogical. Furthermore, one might want to consider the X and Z checks seperately to guarantee commutativity, however for this first example and for simplicity, we will consider them together. (This is addressed later in this README)
14
19
@@ -63,6 +68,125 @@ Now we can use CircuitCompilation2xn to compile this circuit in different ways,
`two_qubit_sieve` splits the input circuit into two-qubit gates, and non two-quibit gates, which for both types of syndrome extraction currently available in `QuantumClifford.jl`, will just consist two qubit gates and measurements. If cat states are used in the syndrome extracting circuit, those will need to be removed prior to using `two_qubit_sieve`. This function now gives us with only the two qubit gates in the first item returned, in this example `non_mz`:
74
+
75
+

76
+
77
+
The `calculate_shifts` function is used to evaluate the required shuttling operations required carry out the provided circuit. It returns a vector of vectors, each corresponding to a subcircuit that can be run in parallel. The length of this is then the number of shuttles required. Unsurprisingly, not doing any compilation leads to a requirement of quite a few shuttle operations:
The `ancil_reindex_pipeline` function returns first the reindexed circuit, and second a dictionary which was used to reindex the circuit. The function itself tries a variety of heurisitics and then picks the best one. Gate shuffling is also automatically applied. In the naive syndrome case, we won't need to relabel the measurement circuit (as they are all Z measurements), but for Shor syndrome extraction these dicitonaries will be needed to relabel the cat state generation. For thoroughness this is how one would generally finish up piecing the reindexed circuit back together:
Another thing to note: `ancil_reindex_pipeline` applies the `two_qubit_sieve` function automatically, and then reindexes the qubits in the non-qubit portions as well, so we just as well could have done:
While not mentioned in the paper, for in practice it never affected Shor-style syndrome extraction, on naive syndrome circuit one can instead fix the ancilla and reindex the data qubits instead to achieve a reduction in shuttles with the same simple heuristic techniques:
@@ -498,8 +493,8 @@ function ancil_sort_h3(blockset, startAncil=nothing)
498
493
return order
499
494
end
500
495
501
-
"""This function should replace all other reindexing functions, and should work on an entire circuit."""
502
-
functionperfect_reindex(circ, order::Dict)
496
+
"""This function should replace all other reindexing functions, and should work on an entire circuit. Legacy Note: used to be called perfect_reindex"""
497
+
functionreindex_by_dict(circ, order::Dict)
503
498
functionnew_index(index::Int)
504
499
get(order,index,index)
505
500
end
@@ -721,12 +716,13 @@ function shorNumbers(circuit)
post_ec_error_rates_MC_CA_shor = [CSS_evaluate_code_decoder_shor_syndrome(code, new_cat, new_circuit, p, p_shift*p*m, p_wait*p*m, gate_noise*p*m, nsamples=nsamples) for p in error_rates]
@@ -207,7 +207,7 @@ function CSS_my_plot_both_synd(code::bootleg_CSS, p_shift=0.0001, p_wait=1-exp(-
# Special Shor circuit Compilation - no gate noise
213
213
post_ec_error_rates_MD_CA_shor = [CSS_evaluate_code_decoder_shor_syndrome(code, shor_cat, shor_new_circuit, p, p_shift*p*m, p_wait*p*m, gate_noise*p*m, nsamples=nsamples) for p in error_rates]
shor_post_ec_error_rates_s0 = [evaluate_code_decoder_shor_syndrome(checks, ecirc, shor_cat, add_two_qubit_gate_noise(shor_new_circuit, p_gate), p, p_shift, p_wait, nframes=nframes) for p in error_rates]
495
495
shor_post_ec_error_rates_s1 = [evaluate_code_decoder_shor_syndrome(checks, ecirc, shor_cat, add_two_qubit_gate_noise(shor_new_circuit, p_gate*m), p, p_shift*m, 1-exp(-14.5*m/28_000), nframes=nframes) for p in error_rates]
496
496
shor_x_error_s0 = [shor_post_ec_error_rates_s0[i][1] for i ineachindex(shor_post_ec_error_rates_s0)]
@@ -556,7 +556,7 @@ function realistic_noise_vary_params(code::AbstractECC, p_shift=0.01, p_wait=1-e
0 commit comments