Skip to content

Commit d8b2b62

Browse files
committed
RIS updates
1 parent 7299003 commit d8b2b62

File tree

5 files changed

+290
-41
lines changed

5 files changed

+290
-41
lines changed

Manifest.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
julia_version = "1.10.5"
44
manifest_format = "2.0"
5-
project_hash = "26354b5f3440d58ba825c3a08bb43d55c1f95c59"
5+
project_hash = "2d6645f27d1e47bd5cddd8a51982054007baf2cb"
66

77
[[deps.ASL_jll]]
88
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
@@ -562,6 +562,12 @@ version = "1.4.3"
562562
deps = ["Unicode"]
563563
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
564564

565+
[[deps.ProgressMeter]]
566+
deps = ["Distributed", "Printf"]
567+
git-tree-sha1 = "8f6bc219586aef8baf0ff9a5fe16ee9c70cb65e4"
568+
uuid = "92933f4c-e287-5a05-a399-4b506db050ca"
569+
version = "1.10.2"
570+
565571
[[deps.PtrArrays]]
566572
git-tree-sha1 = "77a42d78b6a92df47ab37e177b2deac405e1c88f"
567573
uuid = "43287f4e-b6f4-7ad1-bb20-aadabca52c3d"

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
1313
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
1414
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1515
Oscar = "f1435218-dba5-11e9-1e4d-f1a5fab5fc13"
16+
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
1617
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1718
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1819
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

src/Classical/weight_dist.jl

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,18 +1019,23 @@ function minimum_words(C::AbstractLinearCode)
10191019
end
10201020
end
10211021

1022+
"""
1023+
random_information_set_minimum_distance_bound!(C::AbstractLinearCode; max_iters::Int = 10000, verbose::Bool = false)
10221024
1025+
Return an upper bound on the minimum distance of `C` and a codeword of that weight using
1026+
`max_iters` random information sets.
1027+
"""
10231028
function random_information_set_minimum_distance_bound!(C::AbstractLinearCode; max_iters::Int = 10000, verbose::Bool = false)
10241029

1025-
println("here")
10261030
order(field(C)) == 2 || throw(DomainError(C, "Currently only implemented for binary codes."))
10271031
is_positive(max_iters) || throw(DomainError(max_iters, "The number of iterations must be a positive integer."))
10281032

10291033
!ismissing(C.d) && (println("Distance already known"); return C.d;)
10301034
verbose && println("Bounding the distance")
10311035
G = _Flint_matrix_to_Julia_T_matrix(_rref_no_col_swap(C.G), UInt8)
1036+
G = _remove_empty(G, :rows)
10321037
upper, ind = _min_wt_row(G)
1033-
found = _Flint_matrix_to_Julia_T_matrix(G[ind:ind, :], UInt8)
1038+
found = G[ind, :]
10341039
# TODO this can contradict C.u_bound cause that requires a different found
10351040
verbose && println("Starting lower bound: $(C.l_bound)")
10361041
verbose && println("Starting upper bound: $upper")
@@ -1042,7 +1047,7 @@ function random_information_set_minimum_distance_bound!(C::AbstractLinearCode; m
10421047
return uppers[loc], matrix(field(C), permutedims(founds[loc]))
10431048
end
10441049

1045-
function _RIS_bound_loop!(operators_to_reduce::Matrix{T}, curr_l_bound::Int, curr_u_bound::Int,
1050+
function _RIS_bound_loop(operators_to_reduce::Matrix{T}, curr_l_bound::Int, curr_u_bound::Int,
10461051
found::Vector{T}, max_iters::Int, n::Int, verbose::Bool) where T <: Integer
10471052

10481053
num_thrds = Threads.nthreads()
@@ -1053,6 +1058,7 @@ function _RIS_bound_loop!(operators_to_reduce::Matrix{T}, curr_l_bound::Int, cur
10531058
founds = [found for _ in 1:num_thrds]
10541059
thread_load = Int(floor(max_iters / num_thrds))
10551060
remaining = max_iters - thread_load * num_thrds
1061+
prog_meter = Progress(max_iters)
10561062
Threads.@threads for t in 1:num_thrds
10571063
orig_ops = deepcopy(operators_to_reduce)
10581064
perm_ops = similar(orig_ops)
@@ -1083,8 +1089,10 @@ function _RIS_bound_loop!(operators_to_reduce::Matrix{T}, curr_l_bound::Int, cur
10831089
end
10841090
end
10851091
end
1092+
next!(prog_meter)
10861093
end
10871094
end
1095+
finish!(prog_meter)
10881096

10891097
return uppers, founds
10901098
end
@@ -1146,13 +1154,13 @@ function weight_enumerator_classical(T::Trellis; type::Symbol = :complete)
11461154
return T.CWE
11471155
end
11481156

1157+
# TODO: remove C from this, store in WE struct
11491158
"""
11501159
MacWilliams_identity(C::AbstractLinearCode, W::WeightEnumerator; dual::Symbol = :Euclidean)
11511160
11521161
Return the weight enumerator of the dual (`:Euclidean` or `:Hermitian`) of `C` obtained
11531162
by applying the MacWilliams identities to `W`.
11541163
"""
1155-
# TODO: remove C from this, store in WE struct
11561164
function MacWilliams_identity(C::AbstractLinearCode, W::WeightEnumerator; dual::Symbol = :Euclidean)
11571165
dual (:Euclidean, :Hermitian) ||
11581166
throw(ArgumentError("The MacWilliams identities are only programmed for the Euclidean and Hermitian duals."))

src/CodingTheory.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ using Random
1818
using DataStructures
1919
using StatsBase
2020
using Distributions
21+
using ProgressMeter
2122

2223
import LinearAlgebra: tr, Adjoint, transpose, kron, diagm
2324
import Oscar: dual, factor, transpose, order, polynomial, nrows, ncols, degree,

0 commit comments

Comments
 (0)