Skip to content

Commit 829a26c

Browse files
committed
bounds in product codes
1 parent de07816 commit 829a26c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Quantum/product_codes.jl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Return the hypergraph product code of matrices `A` and `B`.
1616
function HypergraphProductCode(A::CTMatrixTypes, B::CTMatrixTypes; char_vec::Union{Vector{zzModRingElem},
1717
Missing} = missing, logs_alg::Symbol = :stnd_frm)
1818

19-
logs_alg [:stnd_frm, :VS, :sys_eqs] || throw(ArgumentError("Unrecognized logicals algorithm"))
19+
logs_alg (:stnd_frm, :VS, :sys_eqs) || throw(ArgumentError("Unrecognized logicals algorithm"))
2020
F = base_ring(A)
2121
F == base_ring(B) || throw(ArgumentError("Matrices need to be over the same base ring"))
2222

@@ -70,7 +70,14 @@ function HypergraphProductCode(A::CTMatrixTypes, B::CTMatrixTypes; char_vec::Uni
7070
isinteger(k) && (k = round(Int, log(BigInt(p), k));)
7171
# TODO is this distance formula not correct?
7272
# (ismissing(C1.d) || ismissing(C2.d)) ? d = missing : d = minimum([C1.d, C2.d])
73-
u_bound_dx, u_bound_dz = upper_bound_CSS(logs)
73+
X_logs = reduce(vcat, [log[1][:, 1:n] for log in logs])
74+
Z_logs = reduce(vcat, [log[2][:, n + 1:end] for log in logs])
75+
_, mat = rref(vcat(H_X, X_logs))
76+
anti = _remove_empty(mat, :rows) * transpose(Z_logs)
77+
u_bound_dx, _ = _min_wt_row(mat[findall(!iszero(anti[i:i, :]) for i in axes(anti, 1)), :])
78+
_, mat = rref(vcat(H_Z, Z_logs))
79+
anti = _remove_empty(mat, :rows) * transpose(X_logs)
80+
u_bound_dz, _ = _min_wt_row(mat[findall(!iszero(anti[i:i, :]) for i in axes(anti, 1)), :])
7481
return HypergraphProductCode(F, n, k, missing, missing, missing, 1, min(u_bound_dx,
7582
u_bound_dz), 1, u_bound_dx, 1, u_bound_dz, stabs, H_X, H_Z, missing, missing, signs,
7683
X_signs, Z_signs, logs, logs_mat, char_vec, over_comp, stabs_stand, stand_r, stand_k,

0 commit comments

Comments
 (0)