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
@@ -49,6 +49,11 @@ function parity_checks_z(code::AbstractECC)
49
49
throw(lazy"Codes of type $(typeof(code)) do not have separate X and Z parity checks, either because they are not a CSS code and thus inherently do not have separate checks, or because its separate checks are not yet implemented in this library.")
`Concat(c₁, c₂)` is a code concatenation of two quantum codes [knill1996concatenated](@cite).
3
+
4
+
The inner code c₁ and the outer code c₂.
5
+
The construction is the following: replace each qubit in code c₂ with logical qubits encoded by code c₁.
6
+
The resulting code will have `n = n₁ × n₂` qubits and `k = k₁ × k₂` logical qubits.
7
+
"""
8
+
struct Concat <:AbstractECC
9
+
c₁::AbstractECC
10
+
c₂::AbstractECC
11
+
end
12
+
13
+
functionparity_checks(c::Concat)
14
+
c₁ = c.c₁
15
+
c₂ = c.c₂
16
+
k₁ =code_k(c₁)
17
+
n₁ =code_n(c₁)
18
+
n₂ =code_n(c₂)
19
+
s₁ =code_s(c₁)
20
+
s₂ =code_s(c₂)
21
+
inner_checks =Stabilizer(vcat([embed(n₁ * n₂, 1+(i-1)*n₁:i*n₁, parity_checks(c₁)[j]) for i in1:n₂ for j in1:s₁])) # parity checks of c₁ on each qubit of c₂
22
+
h₂ =parity_matrix(c₂)
23
+
phases₂ =phases(parity_checks(c₂))
24
+
h_logx₁ =stab_to_gf2(logx_ops(c₁))
25
+
phases_logx₁ =phases(logx_ops(c₁))
26
+
h_logz₁ =stab_to_gf2(logz_ops(c₁))
27
+
phases_logz₁ =phases(logz_ops(c₁))
28
+
# parity checks of c₂ with qubits repalced with logical qubits of c₁
29
+
outer_check_h =transpose(hcat([vcat(
30
+
kron(h₂[i, 1:end÷2], h_logx₁[j, 1:end÷2]) .⊻kron(h₂[i, end÷2+1:end], h_logz₁[j, 1:end÷2]), # X part
31
+
kron(h₂[i, 1:end÷2], h_logx₁[j, end÷2+1:end]) .⊻kron(h₂[i, end÷2+1:end], h_logz₁[j, end÷2+1:end]) # Z part
32
+
) for i in1:s₂ for j in1:k₁]...))
33
+
outer_check_phase = [UInt8(sum(h₂[i, 1:end÷2] * phases_logx₁[j]) +sum(h₂[i, end÷2+1:end] * phases_logz₁[j]) + phases₂[i]) &0x3for i in1:s₂ for j in1:k₁]
0 commit comments