@@ -1019,18 +1019,23 @@ function minimum_words(C::AbstractLinearCode)
10191019 end
10201020end
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+ """
10231028function 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]))
10431048end
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
10901098end
@@ -1146,13 +1154,13 @@ function weight_enumerator_classical(T::Trellis; type::Symbol = :complete)
11461154 return T. CWE
11471155end
11481156
1157+ # TODO : remove C from this, store in WE struct
11491158"""
11501159 MacWilliams_identity(C::AbstractLinearCode, W::WeightEnumerator; dual::Symbol = :Euclidean)
11511160
11521161Return the weight enumerator of the dual (`:Euclidean` or `:Hermitian`) of `C` obtained
11531162by applying the MacWilliams identities to `W`.
11541163"""
1155- # TODO : remove C from this, store in WE struct
11561164function 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." ))
0 commit comments