Skip to content

Commit dbdbf03

Browse files
committed
Merge branch 'fixdev' of https://github.com/Fe-r-oz/CodingTheory into fixdev
2 parents 97446a4 + 3109544 commit dbdbf03

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

src/Quantum/weight_dist.jl

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -817,9 +817,10 @@ function random_information_set_minimum_distance_bound!(::HasNoGauges, ::IsCSS,
817817
# this is done in the constructor but the logical is not stored at the time
818818
# so must redo here
819819
mat = _rref_no_col_swap(operators_to_reduce)
820-
anti = mat * check_against
821-
curr_u_bound, index = findmin(row_wts_symplectic(mat[findall(!iszero(anti[i, :]) for i in axes(anti, 1)), :]))
822-
found = operators_to_reduce[index, :]
820+
anti = mat * check_against .% order(field(S))
821+
log_locations = findall(!iszero(anti[i, :]) for i in axes(anti, 1))
822+
curr_u_bound, index = findmin(row_wts_symplectic(mat[log_locations, :]))
823+
found = mat[log_locations[index], :]
823824
verbose && println("Starting upper bound: $curr_u_bound")
824825
elseif which == :X
825826
verbose && println("Bounding the X-distance")
@@ -984,19 +985,21 @@ function _RIS_bound_loop!(operators_to_reduce, check_against, curr_l_bound::Int,
984985
perm2 = [perm; perm .+ n]
985986
perm_ops = operators_to_reduce[:, perm2]
986987
_rref_no_col_swap!(perm_ops)
987-
LinearAlgebra.mul!(log_test, perm_ops, check_against[perm2, :])
988+
ops = perm_ops[:, invperm(perm2)]
989+
LinearAlgebra.mul!(log_test, ops, check_against)
990+
log_test .%= 2
988991
for i in axes(log_test, 1)
989992
# then perm_ops[i, :] is a logical
990993
if any(!iszero, log_test[i, :])
991994
w = 0
992995
@inbounds for j in 1:n
993-
iszero(perm_ops[i, j] % 2) && iszero(perm_ops[i, j + n] % 2) || (w += 1;)
996+
!iszero(ops[i, j] % 2) && !iszero(ops[i, j + n] % 2) || (w += 1;)
994997
end
995998

996999
if uppers[t] > w
9971000
uppers[t] = w
9981001
# maybe use invpermute! here?
999-
founds[t] .= perm_ops[i, invperm(perm2)]
1002+
founds[t] .= ops[i, :]
10001003
verbose && println("Adjusting upper bound: $w")
10011004
if curr_l_bound == w
10021005
verbose && println("Found a logical that matched the lower bound of $curr_l_bound")
@@ -1023,18 +1026,19 @@ function _RIS_bound_loop!(operators_to_reduce, check_against, curr_l_bound::Int,
10231026
perm2 = [perm; perm .+ n]
10241027
perm_ops = operators_to_reduce[:, perm2]
10251028
_rref_no_col_swap!(perm_ops)
1026-
LinearAlgebra.mul!(log_test, perm_ops, check_against[perm2, :])
1029+
LinearAlgebra.mul!(log_test, ops, check_against)
1030+
log_test .%= 2
10271031
for i in axes(log_test, 1)
10281032
# then perm_ops[i, :] is a logical
10291033
if any(!iszero, log_test[i, :])
10301034
w = 0
10311035
@inbounds for j in 1:n
1032-
iszero(perm_ops[i. j]) && iszero(perm_ops[i, j + n]) || (w += 1;)
1036+
!iszero(ops[i, j] % 2) && !iszero(ops[i, j + n] % 2) || (w += 1;)
10331037
end
10341038

10351039
if upper_temp > w
10361040
upper_temp = w
1037-
found_temp = perm_ops[i, invperm!(perm2)]
1041+
found_temp = ops[i, :]
10381042
verbose && println("Adjusting upper bound: $w")
10391043
if curr_l_bound == w
10401044
verbose && println("Found a logical that matched the lower bound of $curr_l_bound")

src/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1311,7 +1311,7 @@ end
13111311
function _Pauli_string_to_symplectic(str::T) where T <: Union{String, Vector{Char}}
13121312
n = length(str)
13131313
# F = GF(2, 1, :ω)
1314-
F = GF(2)
1314+
F = Oscar.Nemo.Native.GF(2)
13151315
sym = zero_matrix(F, 1, 2 * n)
13161316
for (i, c) in enumerate(str)
13171317
if c == 'X'

0 commit comments

Comments
 (0)